Does nanosleep() yields the processor?

Alex kbyte at iol.pt
Tue Aug 16 15:12:11 UTC 2005


Hi,

Suppose a program with a main thread and a secondary thread.
Evenry thread executes in a round-robin policy and with same priority.

Suppose the system has configured with time slice = 500ms

Suppose the main thread executes nanosleep for 750 ms.

Suppose secondary thread is executing heavy computation.

When main thread executes the nanosleep function the processor 
is yield for the secondary thread, right?

what happens if the nanosleep time expires and processor is in 
the midle of the secondary thread time slice? the secondary thread must 
consume its all time slice, right?

Remember, both threads have the same priority.

Thanks a lot,

Alex


_________________________________________________________________________________
Com o IOL Talki fale a 0 Euros!
CHAMADAS GRATIS atraves da Internet.
Saber mais em http://www.iol.pt/correio/rodape.php?dst=0508111




More information about the users mailing list