Date: Wed, 01 Apr 2009 09:34:40 +0800 From: David Xu <davidxu@freebsd.org> To: Randall Stewart <rrs@lakerest.net> Cc: threads@freebsd.org, freebsd-threads@freebsd.org Subject: Re: WITNESS for pthreads Message-ID: <49D2C4B0.2020805@freebsd.org> In-Reply-To: <F0D957B2-E451-4F83-8C30-4A73140470B6@lakerest.net> References: <7D4F6788-0F12-4863-9635-7FADA9115D16@lakerest.net> <9157F968-5CCF-451C-9BA0-E12A957D6B38@lakerest.net> <Pine.GSO.4.64.0903310235580.5671@sea.ntplx.net> <200903311038.43401.jhb@freebsd.org> <F0D957B2-E451-4F83-8C30-4A73140470B6@lakerest.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Randall Stewart wrote: > This was one of the places I was heading (as I wrote privately to Daniel > ;-D) > > I suppose I can share it all i.e. the pthread mutex stuff > will of course work with shared mutexe's but it won't: > > a) Build an easy to use semantic for the app to agree on sharing > memory.. i.e. you > have left undefined how the process figure out what they are sharing. > There is > some value in setting up a easy semantic for app dev's to use. > > <i.e. insert the mmap and all the other goo through an additional > interface> > > b) What happens when a process exits or hits a core dump while holding one > of these mutex's? Is this what you are thinking the PROCESS_SHARED would > do?? > > <i.e. I don't think a process by itself can fully solve this... maybe the > PROCESS_SHARED could be made to help here> > Yes, kernel has to involve in this area, maybe all locking and unlocking for PROCESS_SHARED mutex should be done in kernel, so kernel can remember a list of mutex the current thread owned, when the thread exits for whatever reason, kernel should reset the mutexes to a state and wake up threads waiting on these mutexes. It seems that Solaris does it in this way, another way is setting a mutex list pointer in kernel, but the list itself is in user address space, it is a bit tricky for kernel to figure out the list's intermediate states when the thread is killed and fix the mutex states, the benefit is locking and unlocking are fast because they are done by userland when possible, it seems Linux does it in this way. > c) If you build something to do <a> so you have some nice way of naming > mutex's you can do something similar to our WITNESS option in the > kernel... this is something the few times I have played in user > space recently that I have missed... having LOR warnings and such > can be a useful tool. You can't have this without <a> IMO. > > > I was am interested in a/b but one of my long term intents is to do <c> ;-) > > > R
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49D2C4B0.2020805>