2004/01/23 locking

Multiple users having access to the same data usually requires some sort of mecanism to give exclusive access to all or part of the data for some period of time. Locking is an extensive subject, which would need far more space than we have here, but overall there are two basic concepts: advisory locking (enforced by cooperating processes) and mandatory locking (enforced by the kernel).

Advisory locking does involve the kernel: the lockf() and fcntl() system calls are really the same function ;early BSD had a more limited flock(). But the kernel only restricts processes that specifically use the lockf() or fcntl() calls: any other process can read or write at will.


Hate these ads?

Mandatory locking is interesting because it is enabled by a hack of setting a file's set-group-id on and turning group execute off:



[root@mail root]# chmod 2760 t
[root@mail root]# ls -l t
-rwxrwS---    1 root     root          550 Dec  5 09:12 


That odd "S" is the result of this otherwise senseless combination,

Mandatory locking can be surprising though: Stevens points out that it can be circumvented by unlinking and then opening a new version of the file.



Comments /Words/2004_01_23.html


Add your comments

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner





Views for this page
Today This Week This Month This Year  Overall
158223 1,310

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

pavatar.jpg
More:




Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://echo3.net/ Unix/Linux Custom Applications, Web Hosting, C/C++ Programming Courses


http://www.m3ipinc.com Security, firewalls, ids, audits, vulnerability assesments, BS7799, HIPAA, GLB, incident handling


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering









Change Congress


Related Posts