[M3devel] variations of waitpid..?
Tony Hosking
hosking at cs.purdue.edu
Thu Jan 1 02:29:24 CET 2009
If someone uses waitpid they get what they paid for.
On 1 Jan 2009, at 06:24, Jay wrote:
>
> You mean, this function is easy to misuse?
>> People who declare their own <*EXTERNAL*>
> Like waitpid exposed from m3core?
>
> waitpid is already easy to misuse, on a userthread system, leading
> to possible (though I think rare) deadlock.
> It is easy to misuse on pthreads, lead "just" to bad performance,
> and in fact I believe cm3 is doing this, via sysutils.
> This at least guides you between two patterns of use, and fix the
> perf of cm3/sysutils.
>
> On a userthread system, waitpid(pid, flags = 0) waits for the child
> process, with all parent threads suspended.
> Generally I doubt the child depends on parent threads progressing,
> but, yeah, that could deadlock, like if a parent thread is waiting
> to a file or stdin of the child, or reading a child's stdout.
>
> The various uses do waitpid(pid, flags = nohang) and then sleep and
> try again.
>
> pthreads just uses waitpid(pid, flags = 0) and all threads keep
> running
More information about the M3devel
mailing list