semget() returns EAGAIN?

Corinna Vinschen
Wed Aug 7 08:20:00 GMT 2019

On Aug  7 10:12, Corinna Vinschen wrote:
> On Aug  7 05:02, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
> > I'm noticing that in a high-contention situation (many processes try
> > to get ahold of a semaphore) semget() on Cygwin starts to return
> > EAGAIN (try again) after about 62 processes has gotten to call
> > semget() and are actively competing for the semaphore (i.e. using the
> > semaphore ID semget() returned to them).
> > 
> > EAGAIN is not documented in any of semget() API documentation that I
> > can find.
> > 
> > I understand that in Cygwin semget() is implemented as a connection to
> > cygserver, and the error probably stems from there, but I don't think
> > that such a code is appropriate as a final errno.  And why is there a
> > limit, to begin with?  What exactly imposes it?
> The number of parallel open pipes, for instance.  By default, 10
> worker threads handle the load and up to 62 processes can be handled
> in parallel.  If the numbers are too low in your scenario, try to
> raise them in /etc/cygserver.conf.

Apart from that, the preferred way to use semaphores is to use POSIX
semaphores, that is, sem_open and friends.  These don't require


Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <>

More information about the Cygwin mailing list