Subj : Re: mutex and process termination To : comp.programming.threads From : Casper H.S. Dik Date : Fri Apr 01 2005 11:45 am Christoph Bartoschek writes: >what happens when a process holding mutexes dies? I'm speaking in terms of >pthread mutexes. Well, if they're in a shared address space, then they'll appear to be held (this is why Solaris has "robust" mutexes which allow for processes or threads dying. (The locking of such a mutex can fail with EOWNERDEAD but will then also acquire the mutex; it can then do the necessary cleanup steps_ >Are the mutex ressources cleaned up by the kernel as for example open file >descriptors? Are some kernel structures left used which are limited and can >eventually get exhausted? Mutexes generally do not have kernel structures associated with them unless there are waiters. In the general case, the waiters will block indefinately. >I wonder whether a faulty programm, which locks a mutex and dies immediately >after that, can force me to reboot the machine, if it is executed several >million times. No; there's no kernel state to get lost. Other processes may hang but you can kill those and the net effect will be no kernel memory oss. >Is there a difference with mutexes which are shared between processes and >normal mutexes? In the way they are handled, yes. In the way kernel resources get reaped, no. Casper -- Expressed in this posting are my opinions. They are in no way related to opinions held by my employer, Sun Microsystems. Statements on Sun products included here are not gospel and may be fiction rather than truth. .