LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-08-2008, 12:10 AM   #1
ruj.sabya
LQ Newbie
 
Registered: Mar 2007
Posts: 16

Rep: Reputation: 0
Question Implementing shared/exclusive locking (readers/writer) lock


Hi,
I am using semaphore to implement Single Writer Multiple Readers (Reader / writer) lock.
The problem is that semaphores are critical resources in linux systems, and there is a limit on the number of semaphores

that you can create.
So, after creating some semaphores, sometimes my application exceeds this limit, and I get an error like 'No space left on

device.'.

I have to reboot the system sometimes, to release the semaphores, if my application is terminated abruptly!

How should I implement readers/writers lock using something else than semaphore, which is scalable?

I don't need reader/writer locks across multiple processes. I just need to use them in multiple threads of my application,

which is a single process.
But I want a very scalable solution, say I want 500 locks through out my application daemon's lifetime.

I read in the link below that postgres also suffered the same problem, but there it is recommended that the limit should be

increased, which I don't want users to do.
http://www2.units.it/~nircdc/doc/pos...resources.html

Sabyasachi.

Last edited by ruj.sabya; 05-08-2008 at 12:14 AM.
 
Old 05-08-2008, 02:23 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,287

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
Semaphores are a memory flag, should have nothing to do with disk space (afaik)
 
Old 05-08-2008, 04:21 AM   #3
ruj.sabya
LQ Newbie
 
Registered: Mar 2007
Posts: 16

Original Poster
Rep: Reputation: 0
That is the error you get when you exceed the limit.
That is: ENOSPC (errno 28).
 
  


Reply

Tags
locks, semaphore, semaphores, shared


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot get exclusive lock Enochs Fedora 6 09-16-2007 10:22 AM
Cannot get exclusive lock apokryphos Linux - Newbie 3 12-02-2004 07:22 AM
error: cannot get exclusive lock on /var/lib/rpm/Packages orly Linux - Software 2 09-06-2004 07:13 AM
exclusive lock on cd burning rosscopeeko Red Hat 2 09-01-2003 01:22 PM
exclusive lock on cd burning rosscopeeko Linux - Software 0 08-30-2003 07:39 AM


All times are GMT -5. The time now is 03:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration