Date: Sat, 10 Mar 2007 03:51:03 +0000 (GMT) From: Robert Watson <rwatson@FreeBSD.org> To: Vlad GALU <dudu@dudu.ro> Cc: hackers@freebsd.org Subject: Re: user-space locks Message-ID: <20070310034922.R30274@fledge.watson.org> In-Reply-To: <ad79ad6b0703091538t274ecc0cyd984b69cb5a0fd7d@mail.gmail.com> References: <45F1A97D.7090608@cs.rice.edu> <989648.79906.qm@web32913.mail.mud.yahoo.com> <b1fa29170703091455q7f60bdb2r92ddfa447e5657b7@mail.gmail.com> <ad79ad6b0703091538t274ecc0cyd984b69cb5a0fd7d@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 10 Mar 2007, Vlad GALU wrote: > On 3/10/07, Kip Macy <kip.macy@gmail.com> wrote: >> umtx > > Is it safe/recommended to use spinlocks, like in jemalloc, for very small > portions of code? I'm particularly interested in protecting writes to a > couple of word sized ints on amd64, so the critical section wouldn't be > longer than two assignments. Of course, I could use a lockless queue for my > purposes, but I'm asking anyway. I believe that the system malloc library is forced to use low level locking primitives because the pthread library depends on malloc. I would suggest using the pthread mutex primitives where at all possible. We might want to consider adding "adaptive" mutex support to the pthread libraries if we don't have it. Robert N M Watson Computer Laboratory University of Cambridge
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070310034922.R30274>