By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,956 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,956 IT Pros & Developers. It's quick & easy.

Semaphore handling

P: n/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 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/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

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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.