Tuesday, February 9, 2010

Deamonous Indeed - > Linux Deamons

What is a Deamon ??
A deamon, in a multiprogrammed environement  is a process running in the background and not under the direct supervision of the user.

They are usually initialised , by the init process ( pid =1 ) . They are usually forked , by the parent process and are dropped by the parent process , causing init to take over the process . They are not attached to any terminals ,ie standard input devices.
They are , used for handling tasks , such as auditing kernel messages and handling network requests.

1) auditd -> which facilitates , the kernel auditing facilities.
2) initd -> Which is the initialisation demon.
3) avahi deamon -> Which is the deamon , for handling network requests (DHCP).

Feel free to Comment.

Wednesday, February 3, 2010

Mirroring MySQL database

As I was learning Data Mining , where we study the importance of commercial data , and mirroring as a backup measure , I thought of "googling" for a simple application , which could mirror my database onto another host on the network . The below given example , can transfer a complete database to another , within any host. My next post shall help mirroring data to another network host.

The code is in PHP:

$adminc=@mysql_connect("localhost","admin","pesit123") OR die('Couldn\'t connect to MySql:'.mysql_error());

$result = mysql_list_tables ("admin");

while ($table_row = mysql_fetch_row($result)) {

$table = $table_row[0];
$qry="drop table if exists adminmirror".$table;
mysql_query($qry)or die("Failed to delete:".mysql_error());

$query= "create table adminmirror.".$table." LIKE admin.".$table;
mysql_query($query)or die("Table create failed:".mysql_error());
$query="Insert INTO adminmirror.".$table." SELECT * FROM admin.".$table;
mysql_query($query)or die("Table copy failed:".mysql_error());
echo "$table copy done...";
? >

Please incorporate the required changes in the database names , so as to mirror the database.

Please feel free to Comment .

Wednesday, January 27, 2010

Think Parallel With Open MP

Ya pretty significant article this , due to the rapid development of MultiCore technologies , to take advantage of the multithreaded aspects of processes.

Open MP is a platform for writing parallel programs in C , C++ or Fortran in the form of library routines and environment variables.

The main advantage is the conversion of existing serialised code , into parallel codes. So , if we would like to use the multicore aspect of our processors , this platform is the place to start.

This platform is maintained by market leaders , such as AMD,Cray,HP,IBM,INTEL,Microsoft etc..

To find a list of supported compilers visit:


and for more info on the platform ,visit


You can try this Simple Code Snippet :

// A program to test the working of open MP platform on fedora 12 (TRIED BY ME ELSE INSTALL IT ON YOUR PLATFORM)
// Author : Prashanth R
include omp.h and stdio.h

int main(){
int nthreads,tid;
/*parallel code here*/

#pragma omp parallel
tid = omp_get_thread_num();
printf("Called by thread %d \n",tid);

nthreads = omp_get_num_threads();
printf("The number of threads is %d \n",nthreads);
return 0;

compile the following code as :
gcc -fopenmp filename.c

As usual feel free to comment .