Subject: Re: sched_yield() and relinquishing CPU
To: Dan MacLean <dmaclean82@gmail.com>
From: Perry E. Metzger <perry@piermont.com>
List: netbsd-help
Date: 07/05/2005 20:15:50
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.

Perry