LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 12-05-2006, 09:24 PM   #1
mel_c0
LQ Newbie
 
Registered: Dec 2006
Posts: 1

Rep: Reputation: 0
System V Semaphore Problems


Hi! Wanted to know what else can cause semval value to increase, other than through semctl() SETVAL cmd, semop() with sembuf.sem_op of greater than 0, and kernel doing undo if semop() calls has SEM_UNDO flag set.

The problem I am experiencing is that N processes that use a shared library runs fine, then after some period of time (say after 5 hrs, or 9 hrs, or sometimes 15 hrs), it fails. During my debugging process, I found out that at some point, semval becomes 2, and one time, it became 3. I printed the semval through semctl() GETVAL cmd, after doing a lock of the semaphore.

The shared library is the one that creates or uses existing named semaphore, locks and unlocks the semaphore, and removes the semaphore if it identifies that no other process is using the semaphore. I am certain that I have all the lock/unlock pair in the code, and does not have an unlock semaphore call without a lock first. Also, semctl() SETVAL is done after the semaphore is created. If semaphore exists, I did not do semctl() SETVAL. Could it be that somehow, the kernel thought it needs to adjust the semval inappropriately? Or there is a problem because one of my processes has system() calls to a process that also uses the shared library? Or maybe because one of my processes has threads that uses the shared library might have confused the kernel?

I know it is not the best way to handle semaphores through a shared library, but I am stuck with this due to reasons beyond my control.

Thanks!
 
  


Reply



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
Semaphore vs Signal scanner Linux - General 4 11-18-2006 01:05 PM
Implementing semaphore operations as system calls deviantish Programming 4 11-15-2005 03:55 AM
Semaphore tzzdvd Programming 1 05-24-2005 09:23 PM
semaphore beginner_84 Programming 5 08-25-2004 06:54 PM
about semaphore dummyagain Programming 1 11-11-2003 11:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:23 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration