Connecting Tech Pros Worldwide Help | Site Map

Semaphore handling

 
LinkBack Thread Tools Search this Thread
  #1  
Old June 28th, 2006, 08:55 AM
Unni
Guest
 
Posts: n/a
Default 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


  #2  
Old June 28th, 2006, 10:05 AM
Marek Simon
Guest
 
Posts: n/a
Default Re: Semaphore handling

try sem_remove();
Marek

Unni napsal(a):[color=blue]
> 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
>[/color]
  #3  
Old June 28th, 2006, 12:15 PM
Ratvin
Guest
 
Posts: n/a
Default Re: Semaphore handling

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:
[color=blue]
> try sem_remove();
> Marek
>
> Unni napsal(a):[color=green]
> > 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
> >[/color][/color]

  #4  
Old June 29th, 2006, 07:35 AM
Marek Simon
Guest
 
Posts: n/a
Default Re: Semaphore handling

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):[color=blue]
> 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
>[/color]
  #5  
Old June 29th, 2006, 07:55 AM
Ratvin
Guest
 
Posts: n/a
Default Re: Semaphore handling

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:
[color=blue]
> 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):[color=green]
> > 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
> >[/color][/color]

  #6  
Old July 6th, 2006, 09:15 AM
Ratvin
Guest
 
Posts: n/a
Default Re: Semaphore handling

Marek Simon can u pls tell me what do you exactly intend in that first
idea.

Thanks,

Ratheesh K J

Ratvin wrote:
Quote:
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:
>
Quote:
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):
Quote:
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
>
 

Bookmarks

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.