473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Semaphore handling

Hello all,

I m facing a memory related problem with semaphores. Our business
application uses semaphores extensively and the limit imposed by the OS
on the number of semaphores that can exist on the system is only 128.

This could be increased to a higher value but that would not be a
permanant solution to my belief. We are using the sem_get, sem_acquire
php functions. After the use we are releasing the semaphore by using
sem_release.

The problem is that the semaphore will remain on the system until it is
rebooted. And once the limit of 128 semaphores is reached, any attemt
to create a new semaphore will result in a "No space left on device"
error.

Can anybody help with any solutions in this regard.

Thanks

Ratheesh K J

Jun 28 '06 #1
5 2492
try sem_remove();
Marek

Unni napsal(a):
Hello all,

I m facing a memory related problem with semaphores. Our business
application uses semaphores extensively and the limit imposed by the OS
on the number of semaphores that can exist on the system is only 128.

This could be increased to a higher value but that would not be a
permanant solution to my belief. We are using the sem_get, sem_acquire
php functions. After the use we are releasing the semaphore by using
sem_release.

The problem is that the semaphore will remain on the system until it is
rebooted. And once the limit of 128 semaphores is reached, any attemt
to create a new semaphore will result in a "No space left on device"
error.

Can anybody help with any solutions in this regard.

Thanks

Ratheesh K J

Jun 28 '06 #2
sem_remove will cause trouble if there are other processes blocking on
the semaphore. This has already been tried.

Is there any way to remove a semaphore only if there are no processes
waiting on it?

I mean to say that if there are processes blocking on the sem then
release the semaphore after use otherwise remove it.

I m in search of the best possible strategy to do this....

Any suggestions?

Thanks
Ratheesh K J

Marek Simon wrote:
try sem_remove();
Marek

Unni napsal(a):
Hello all,

I m facing a memory related problem with semaphores. Our business
application uses semaphores extensively and the limit imposed by the OS
on the number of semaphores that can exist on the system is only 128.

This could be increased to a higher value but that would not be a
permanant solution to my belief. We are using the sem_get, sem_acquire
php functions. After the use we are releasing the semaphore by using
sem_release.

The problem is that the semaphore will remain on the system until it is
rebooted. And once the limit of 128 semaphores is reached, any attemt
to create a new semaphore will result in a "No space left on device"
error.

Can anybody help with any solutions in this regard.

Thanks

Ratheesh K J


Jun 28 '06 #3
1st idea. try to aquire semaphore and remove it only if aquire was
succesfull.
2nd idea. prevent creating new semaphores and reuse the old.
Marek

Ratvin napsal(a):
sem_remove will cause trouble if there are other processes blocking on
the semaphore. This has already been tried.

Is there any way to remove a semaphore only if there are no processes
waiting on it?

I mean to say that if there are processes blocking on the sem then
release the semaphore after use otherwise remove it.

I m in search of the best possible strategy to do this....

Any suggestions?

Thanks
Ratheesh K J

Jun 29 '06 #4
I am not very clear about the 1st idea. The 2nd idea can be looked
into.

At the same time i would like to know whether message queues would help
in synchronization?

Any suggestions!!!

Thanks,

Ratheesh K J

Marek Simon wrote:
1st idea. try to aquire semaphore and remove it only if aquire was
succesfull.
2nd idea. prevent creating new semaphores and reuse the old.
Marek

Ratvin napsal(a):
sem_remove will cause trouble if there are other processes blocking on
the semaphore. This has already been tried.

Is there any way to remove a semaphore only if there are no processes
waiting on it?

I mean to say that if there are processes blocking on the sem then
release the semaphore after use otherwise remove it.

I m in search of the best possible strategy to do this....

Any suggestions?

Thanks
Ratheesh K J


Jun 29 '06 #5
Marek Simon can u pls tell me what do you exactly intend in that first
idea.

Thanks,

Ratheesh K J

Ratvin wrote:
I am not very clear about the 1st idea. The 2nd idea can be looked
into.

At the same time i would like to know whether message queues would help
in synchronization?

Any suggestions!!!

Thanks,

Ratheesh K J

Marek Simon wrote:
1st idea. try to aquire semaphore and remove it only if aquire was
succesfull.
2nd idea. prevent creating new semaphores and reuse the old.
Marek

Ratvin napsal(a):
sem_remove will cause trouble if there are other processes blocking on
the semaphore. This has already been tried.
>
Is there any way to remove a semaphore only if there are no processes
waiting on it?
>
I mean to say that if there are processes blocking on the sem then
release the semaphore after use otherwise remove it.
>
I m in search of the best possible strategy to do this....
>
Any suggestions?
>
Thanks
Ratheesh K J
>
Jul 6 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bastian Hammer | last post by:
Hi I´m wondering why there are so few examples with Semaphore. Is it obsolete? I´ve got a Class Data. It offers 2 Threads methods for updating, editing, .. a private dictionary. Now I...
0
by: dede | last post by:
Dear community, having written a working example for using Semphores on a windows client, I created a little "server-application" that does the following: A Server continously "listens/tails"...
1
by: rushik | last post by:
Hello all, I m facing an interesting problem related to semaphore in php. We are using a huge business application running on LAMP. For database operations we are maintaining centralized DB...
5
by: marvind | last post by:
I tried using a Semaphore class (have included the full listing reproduced from article Figure 1 at the end of this email) in .NET 1.1. It works fine most of the time, however, I see the following...
2
by: techi_C | last post by:
Hi I'm getting a problem while removing semaphore from system. Before removing semaphore I'm checking the usage count of a smaphore. // checking usage count usage_count =...
1
by: cranfic | last post by:
Please help... To make it simple, I have a simple test C program which calls my semphore library functions only. (It doesn't call any db2 function at all). And the following is the test...
0
by: sukasa | last post by:
Greetings. After first noticing a malfunction in my application, I ran some tests which have given me the following insights on the code performance: -The " infinite" loop which waits on...
0
by: Samuel R. Neff | last post by:
I'm having trouble creating a Semaphore with read-access rights for everyone. Originally I was trying to use this code: semaphore = new Semaphore(maxLocks, maxLocks, "RwLock#" + name); but...
5
by: GHUM | last post by:
hello, in my application I am using hSem = win32event.CreateSemaphore (None, 1, 1,"stringincludinginterfaceandport") rt=win32event.WaitForSingleObject (hSem, 0) if rt !=...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.