Stewart Stremler wrote:
You can actually do locking between asynchronous processes without any
atomic instructions.
You need a test-and-set or equivalent.
No, you actually don't. I thought you did, but you don't. As long as I
can read memory you've written to and eventually see it, it works.
The basic technique is to allocate a semi-private memory cell to each
process, and a shared one to say whose turn it is. When someone is (say)
ready for a timeslice, they set their own cell to "I'm ready." Then
whoever's turn it is is responsible to find someone who is ready and set
the shared cell to point to that process before they sleep.
Essentially, you organize things so there's only one process that can
write to any given memory address at any given time, and the identity of
that process can't be changed by more than one process.
It depends. Does "atomic" block out all other execution? Or does it
block out only other "atomic" blocks, in which case lots of languages
have that and it's pretty much one of the older synchronization
primitives invented.
The former.
I think they call that an "interrupt disable".
--
Darren New / San Diego, CA, USA (PST)
His kernel fu is strong.
He studied at the Shao Linux Temple.
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg