[concurrency-interest] thread queueing qn
crazybob at crazybob.org
Mon Jan 21 21:29:01 EST 2008
Try [A, B, C].
- Thread A acquires L
- Thread B attempts L, but L is locked, so it blocks
- Thread C attempts L, but L is locked, so it blocks
- Thread A completes critical section and releases L
- Thread B or C is notified, and continues into the critical section
On Jan 21, 2008 6:20 PM, Dhanji R. Prasanna <dhanji at gmail.com> wrote:
> On 1/22/08, David Holmes <dcholmes at optusnet.com.au> wrote:
> > No it doesn't mean that. There's no guarantee of FIFO access to a
> > synchronized region.
> I don't think I follow. Let's do this in the abstract (i.e. not
> necessarily Java):
> Threads: [A, B] Locks: [L]
> - Thread A acquires L
> - Thread B attempts L, but L is locked, so it blocks
> - Thread A completes critical section and releases L
> - Thread B is notified, and continues into the critical section
> A came first, A exited first. B came last, B exited last.
> Does j.u.c.l.Lock or java monitors not guarantee such ordering (i.e. on
> acquisition or release of locks)?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest