Hello Yang ... > Part of the code using fork is listed below: > > childpid = fork(); > if (childpid >= 0) > { > if (childpid == 0) > { > for (i=0; i<3; i++) > { > printf("mark 1!\n"); > } > exit(0); > } > } > else > { > for (i=0; i<3; i++) > printf("mark 2!\n"); > wait(&status); > exit(0); > } Are you sure you put the "else" part on the correct place? If the above program is executed, you will get "mark 1" only :) But I am sure, you were just making small mistakes on pasting the codes.. MHD Tayser and Tyler were already suggested several good advices, so I just add another idea. What you "refer" by competition is actually a result of scheduler picking a runnable process with highest priority on certain time. This is the basic rule, so even another process wants to preempt another, it must have sufficient priority to "beat" the currently running process. Of course, currently running process will always be kicked out from CPU if its timeslice is up (or is voluntarily given up using yield() ) . So, how to simulate this? Besides you need to lengthen the "for" loop (i think while(1) is great), try to call sleep() with random interval too. Why random interval? It will simulate a task blocking on an unpredictable event (the event might come fast, or slow). Random sleep will make the O(1) scheduler award different interactivity bonus for both your parent and child task, thus it will make them having random dynamic priority on each quantum. Hope it helps. regards, Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/