Subject: Re: sched_yield() and relinquishing CPU
To: None <netbsd-help@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: netbsd-help
Date: 07/06/2005 05:42:33
In article <87zmt0ssax.fsf@snark.piermont.com>,
Perry E. Metzger <perry@piermont.com> wrote:
>
>Dan MacLean <dmaclean82@gmail.com> writes:
>> A program I am writing is currently having a problem with
>> relinquishing the CPU to other processes.  The only thing I've found
>> thus far to do something like this is the sched_yield() call.
>> However, the manual page states that this will only give control of
>> the CPU to another thread within the same process.  Since my program
>> is a single thread, this does nothing.  Are there any other system
>> calls that will give up the CPU to another process, instead of
>> simply another thread within the same process?  Or perhaps does
>> anyone know of a workaround that will accomplish the same thing?
>
>You give up the CPU automatically whenever your process blocks or when
>you run out of your time quantum. If you want to give up the CPU
>earlier by intent, just block.

Or do a system call eg. select(0, NULL, NULL, NULL, NULL);

christos