DragonFly BSD
DragonFly kernel List (threaded) for 2004-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: lkwt in DragonFly


To: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
From: David Xu <davidxu@xxxxxxxxxxxxxx>
Date: Mon, 09 Feb 2004 17:16:12 +0800

Matthew Dillon wrote:
:Your explanation is interesting, I am sorry that I am new to DFly,
:but if two threads on same CPU wants to exclusivly access a data :structure, what lock should be used ? does token still work ? on
:FreeBSD, one can use mutex, but token is holden by CPU on DFly not by :thread, so a thread really does not know if it already held the lock
:or not, although its CPU already hold the token.
:
:David Xu


If you want something that stays valid through a switch or a blocking
condition then you would need to use a lockmgr lock. If you just
need atomicy across a short period of time in which you know the
thread will not block, or in a situation where the code does the right thing if another piece of code operates on the same
data structure while the first piece is blocked, then a token
would be sufficient.


That's the thing I need, thanks !

And sorry a bit OT, what's the plan of pthread supports in DFly, I am
very interested to work on it in near future.

-Matt
Matthew Dillon <dillon@xxxxxxxxxxxxx>

David Xu





[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]