$done=0; unless($pid = fork()) {#child #This is a simple query that constantly runs on table like dual at regular intervals print $ur->connect() while (!$done) and sleep 5 ; } #calling other methods that loads data to database $obj->method1(); $done=1;