[M3devel] variations of waitpid..?

Jay jay.krell at cornell.edu
Mon Jan 5 20:04:16 CET 2009


 > - Start child process  > - Call Process.Wait, which...  > - Calls Thread.Pause(somesmallnumber) 
There is a call to waitpid before the Thread.Pause.
If the process finishes /very/ quickly, probably never happens, no pause/sleep.
> There are no runnable threads, so the runtime yields the processor. > I think it calls Unix's sleep?
 
Agreed probably no runnable threads typically and sleep().
Perhaps the scheduler knows that none of the threads will become runnable,
but I doubt it.
 > The OS scheduler then schedules the process at a very low priority.  > In most OSes, processes waiting for I/O have the highest priority,  > and processes sleeping have the lowest. So you've gone from waiting  > for a process to exit, at high priority, to sleeping, at very low  > priority. The OS then takes its time to get around to waking you  > up again. 
 
Hm. Why does sleep() imply anything about priority?
Why doesn't it mean "don't run at all for a certain duration,
and then when the duration elapses, resume running ASAP,
with the same priority as it has before sleeping"?
 
Surely "not running at all for a certain duration" does not mean "low priority"?
 
There is a problem -- it will wait the entire duration, even if the process
exists half way through.
 
> Getting rid of the Thread.Pause speeds things up substantially :-)
But it can also cause damage.
If there is a dependency between the child process and other parent threads.
Often there is not, sometimes there is.
 
 - Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20090105/2eadb15e/attachment-0002.html>


More information about the M3devel mailing list