diff of advisory lock and mandatory locks

B

Bangalore

Hi,
Plz, clarify me , with the differences between advisory lock
and mandatory locks.

Thnanks in advance
Bangalore.
 
V

velthuijsen

Not the right place to ask since C++ doesn't know threading, you might
find a better explanation in the newsgroup for the os you are working
on.
That said a mandatory lock blocks access until whatever that has
received the lock releases it. An advisory lock just informs others
accessing that memory/file that someone else is working in that part
already and that they should behave.

Note that advisory locking is also called shared locking and mandatory
locking is also called exclusive locking.
 
J

Joe Seigh

Bangalore said:
Hi,
Plz, clarify me , with the differences between advisory lock
and mandatory locks.

Thnanks in advance
Bangalore.
(reposting. Comcast's news feed is fubar)

Advisory locks don't prevent you from accessing the data without
a lock. Mandatory locks do. Advisory locking depends on threads
or processes behaving properly and only accessing the data when
holding a lock.

In order for mandatory locks to be able to be enforcable, there
has to be a mechansim to control all access to the data. In OO
programming that would be by making the data private and only
accessable through method calls. The method implementations would
be responsible for determining whether locking was in effect and
enforcing it properly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top