[concurrency-interest] difference latch and lock

Peter Veentjer alarmnummer at gmail.com
Wed Aug 30 17:32:07 EDT 2006


Ps: a 'lock' in Oracle is something that is kept for a longer period
of time (in most cases a lock is maintained untill the transaction
completes).

Maybe this is the reason why they have introduced Locks and Latches?

A Latch is a Lock that is invisible from the outside and only locked
for a small period of time (to prevent multiple threads screwing
around with internal system structures)

A (Database) Lock is a Lock that is visible from the outside. If I
have locked a record, you can't update it untill I have released the
lock.A Database lock prevent isolation problems: acid)

Could that be the reason why there is a difference between Latches
(internal Locks) and Locks (database locks)?

On 8/30/06, Peter Veentjer <alarmnummer at gmail.com> wrote:
> I don't know what a latch is supposed to do. I see the term in
> documentation (especially in concurrency control documentation of
> Oracle). And I think a Latch can be compared to a Lock, but I don't
> know for sure and I can't find any usefull documentation about what a
> Latch is supposed to do.
>
> So I want to know what it does.
>
> On 8/30/06, David Holmes <dcholmes at optusnet.com.au> wrote:
> > Peter,
> >
> > Depends exactly what you mean by "latch". A latch or gate is a
> > synchronization barrier that is either open or closed. If open anyone can
> > pass, if closed no one can pass. A Lock is intended to let through one
> > thread at a time.
> >
> > I don't know what they meant by a latch being more lightweight than a lock
> > ???
> >
> > David Holmes
> >
> > > -----Original Message-----
> > > From: concurrency-interest-bounces at cs.oswego.edu
> > > [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Peter
> > > Veentjer
> > > Sent: Thursday, 31 August 2006 6:14 AM
> > > To: concurrency-interest at cs.oswego.edu
> > > Subject: [concurrency-interest] difference latch and lock
> > >
> > >
> > > Who can tell me what the difference between a Latch and a Lock is. I
> > > have read multiple times that a Latch is considered a more lightweight
> > > lock than the lock (maybe only in the context of databases and heavy
> > > weight locks).
> > >
> > > But in Java all Locks and synchronized blocks are lightweight.. so are
> > > there differences?
> > > _______________________________________________
> > > Concurrency-interest mailing list
> > > Concurrency-interest at altair.cs.oswego.edu
> > > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
> >
>


More information about the Concurrency-interest mailing list