Discussion:
solution for pid recycling
(too old to reply)
kmting
2011-07-06 01:43:08 UTC
Permalink
If some program calls fork() but all pids are being used.Although some
pids already exited,they are still needed by other program.If this
happen,what should we do?
should we make the fork() to wait until one of the pids can be reuse?
Or should we just reuse one of the pid even if other program need it later?

Thank you
cs350
2011-07-06 18:30:30 UTC
Permalink
You should return an error in this case. This situation is similar to
running out of memory.

However, your implementation should support enough pids so this condition
never arises during testing.

-Alex
If some program calls fork() but all pids are being used.Although some pids
already exited,they are still needed by other program.If this happen,what
should we do?
should we make the fork() to wait until one of the pids can be reuse?
Or should we just reuse one of the pid even if other program need it later?
Thank you
Loading...