Ok, so how can we avoid starvation?
If more threads start blocking on the monitor, how can we be sure that
Thread-2 will eventually grab the lock?
Thanks,
Cássio
On Mon, Apr 7, 2008 at 12:59 AM, Orion Letizi <
orion@...> wrote:
> You're right. There's no order guarantee.
>
> --Orion
>
>
>
> On Apr 6, 2008, at 8:24 PM, Cássio M. M. Pereira wrote:
> > Let's assume I have three threads trying to get the monitor of a
> > shared object. Thread-1 gets the exclusive access to a synchronized
> > code block, while Thread-2 and Thread-3 remain blocked. What is the
> > priority of unblocking the two threads when Thread-1 releases the lock
> > ?
> >
> > Assume Thread-2 asked for the lock a moment before Thread-3. Is FIFO
> > guaranteed?
> >
> > I couldn't find this in the Java language specification, but I've been
> > told there's no order guarantee.
> >
> > Thank you,
> > Cássio.
> >
> > --
> > Cássio M. M. Pereira
> > _______________________________________________
> > tc-users mailing list
> >
tc-users@...
> >
http://lists.terracotta.org/mailman/listinfo/tc-users>
> _______________________________________________
> tc-users mailing list
>
tc-users@...
>
http://lists.terracotta.org/mailman/listinfo/tc-users>
--
Cássio M. M. Pereira
_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users