Posix vs SystemV semaphores

Posix vs SystemV semaphores

Post by Stephane Richar » Thu, 28 Sep 2000 09:10:38



I want to use semaphores with process sharing under Linux RH 6.2.
I'm currently using sem_init() as a POSIX semaphore under a Linux
system and with a parameter to decide to use process sharing or not.

It seems that I have some problems with it anyway. I don't know why.
I've got the information from one source that POSIX semaphores don't
work with process sharing, is that true?

This call (sem_init) is described as a POSIX semaphore. Should I use
the SystemV semaphores (semctl, semop) ?

Is POSIX semaphores only an API on top of SystemV implementation or is
it completly different implementation?

Does somebody know if something changed between RH6.1 (2.2.5) and RH 6.2
(2.2.14) because my program was working fine with 6.1

Thanks for your help/time.

Stef

--
_________________________________________________
               Stephane Richard
 Kasenna Inc.         Redefining Broadband Video!

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Posix vs SystemV semaphores

Post by Frank Hofman » Wed, 04 Oct 2000 04:00:00


: I want to use semaphores with process sharing under Linux RH 6.2.
: I'm currently using sem_init() as a POSIX semaphore under a Linux
: system and with a parameter to decide to use process sharing or not.

: It seems that I have some problems with it anyway. I don't know why.
: I've got the information from one source that POSIX semaphores don't
: work with process sharing, is that true?

: This call (sem_init) is described as a POSIX semaphore. Should I use
: the SystemV semaphores (semctl, semop) ?

: Is POSIX semaphores only an API on top of SystemV implementation or is
: it completly different implementation?

: Does somebody know if something changed between RH6.1 (2.2.5) and RH 6.2
: (2.2.14) because my program was working fine with 6.1

: Thanks for your help/time.

: Stef

: --
: _________________________________________________
:                Stephane Richard
:  Kasenna Inc.         Redefining Broadband Video!

: Sent via Deja.com http://www.deja.com/
: Before you buy.

--
Frank Hofmann                      Telefon: [(0049)931 888] 5876
Sysadmin CIP-Pool Physik           Zimmer:  C 060
Find out more: http://cip.physik.uni-wuerzburg.de/~hofmann/

  I will not say: Do not weep, for not all tears are an evil.

 
 
 

Posix vs SystemV semaphores

Post by Frank Hofman » Wed, 04 Oct 2000 04:00:00


: I want to use semaphores with process sharing under Linux RH 6.2.
: I'm currently using sem_init() as a POSIX semaphore under a Linux
: system and with a parameter to decide to use process sharing or not.

: It seems that I have some problems with it anyway. I don't know why.
: I've got the information from one source that POSIX semaphores don't
: work with process sharing, is that true?

: This call (sem_init) is described as a POSIX semaphore. Should I use
: the SystemV semaphores (semctl, semop) ?

: Is POSIX semaphores only an API on top of SystemV implementation or is
: it completly different implementation?

: Does somebody know if something changed between RH6.1 (2.2.5) and RH 6.2
: (2.2.14) because my program was working fine with 6.1

: Thanks for your help/time.

POSIX semaphores and SysV semaphores are an entirely different thing.

        - POSIX semaphores are implemented in LinuxThreads
        - SysV semaphores are in libc core and use syscalls directly
        - POSIX semaphores work in multiple threads within one process
        - SysV semaphores work over multiple processes

I can't answer whether POSIX semaphores are implemented on top of SysV
semaphores under Linux (don't know LinuxThreads well enough). It may but
it needn't be (e.g. Solaris implements them via different system calls).

When programming semaphores, decide to use one implementation (sem_* is
POSIX, sem* - no underscore - is SysV). You'll surely run into problems
if you mix sem_t (POSIX type) and int (SysV semid type) ...

Because the POSIX stuff is made for thread synchronization (i.e. to be
used within the scope of the same process) it may be required to:

        - specify interprocess sharing when creating the semaphore
        - sem_init() the semaphore once in each process using it
        - creating the semaphore in shared memory.

POSIX semaphores should work between processes provided these three
requirements are met.

Note that RH 6.1 and 6.2 aren't so much different regarding the kernel,
but are profoundly different ('another system' would not be an exaggeration)
with respect to the GNU libc version they use. Pthreads bugs in glibc, esp.
the old buggy versions RH 6.0/6.1 were based on, are not new - maybe you've
written code that broke after the library implemented the correct behaviour ...

Bye,
Frank

 
 
 

Posix vs SystemV semaphores

Post by Stephane Richar » Thu, 05 Oct 2000 04:00:00


Danke fur deine answere.

I agree with all what you've said, except:

Quote:>    - specify interprocess sharing when creating the semaphore

I've looked at the code that creates the semaphore and saw that
specifying or not interprocess sharing in sem_init will arrive to the
same result. It is not implemented and not soon to be if I listen to
Xavier Leroy the author of pthread under Linux.

I'm going to try to swith to SysV semaphores and see...

Xavier: Any idea about my problem?

Stef.




> : I want to use semaphores with process sharing under Linux RH 6.2.
> : I'm currently using sem_init() as a POSIX semaphore under a Linux
> : system and with a parameter to decide to use process sharing or not.

> : It seems that I have some problems with it anyway. I don't know why.
> : I've got the information from one source that POSIX semaphores don't
> : work with process sharing, is that true?

> : This call (sem_init) is described as a POSIX semaphore. Should I use
> : the SystemV semaphores (semctl, semop) ?

> : Is POSIX semaphores only an API on top of SystemV implementation or
is
> : it completly different implementation?

> : Does somebody know if something changed between RH6.1 (2.2.5) and
RH 6.2
> : (2.2.14) because my program was working fine with 6.1

> : Thanks for your help/time.

> POSIX semaphores and SysV semaphores are an entirely different thing.

>    - POSIX semaphores are implemented in LinuxThreads
>    - SysV semaphores are in libc core and use syscalls directly
>    - POSIX semaphores work in multiple threads within one process
>    - SysV semaphores work over multiple processes

> I can't answer whether POSIX semaphores are implemented on top of SysV
> semaphores under Linux (don't know LinuxThreads well enough). It may
but
> it needn't be (e.g. Solaris implements them via different system
calls).

> When programming semaphores, decide to use one implementation (sem_*
is
> POSIX, sem* - no underscore - is SysV). You'll surely run into
problems
> if you mix sem_t (POSIX type) and int (SysV semid type) ...

> Because the POSIX stuff is made for thread synchronization (i.e. to be
> used within the scope of the same process) it may be required to:

>    - specify interprocess sharing when creating the semaphore
>    - sem_init() the semaphore once in each process using it
>    - creating the semaphore in shared memory.

> POSIX semaphores should work between processes provided these three
> requirements are met.

> Note that RH 6.1 and 6.2 aren't so much different regarding the
kernel,
> but are profoundly different ('another system' would not be an
exaggeration)
> with respect to the GNU libc version they use. Pthreads bugs in
glibc, esp.
> the old buggy versions RH 6.0/6.1 were based on, are not new - maybe
you've
> written code that broke after the library implemented the correct
behaviour ...

> Bye,
> Frank

--
_________________________________________________
               Stephane Richard
 Kasenna Inc.         Redefining Broadband Video!

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Posix vs SystemV semaphores

Post by Stephane Richar » Sat, 07 Oct 2000 09:22:54


Could someone give me some pointers, bugs#, to know exactly what got
fixed in the kernel between RH 6.1 and 6.2? Those fixes make my code
not working anymore with POSIX semaphores.

By the way, it's now working using SystemV semaphores.

Thanks,
Stef.



> Danke fur deine answere.

> I agree with all what you've said, except:

> >       - specify interprocess sharing when creating the semaphore

> I've looked at the code that creates the semaphore and saw that
> specifying or not interprocess sharing in sem_init will arrive to the
> same result. It is not implemented and not soon to be if I listen to
> Xavier Leroy the author of pthread under Linux.

> I'm going to try to swith to SysV semaphores and see...

> Xavier: Any idea about my problem?

> Stef.




> > : I want to use semaphores with process sharing under Linux RH 6.2.
> > : I'm currently using sem_init() as a POSIX semaphore under a Linux
> > : system and with a parameter to decide to use process sharing or
not.

> > : It seems that I have some problems with it anyway. I don't know
why.
> > : I've got the information from one source that POSIX semaphores
don't
> > : work with process sharing, is that true?

> > : This call (sem_init) is described as a POSIX semaphore. Should I
use
> > : the SystemV semaphores (semctl, semop) ?

> > : Is POSIX semaphores only an API on top of SystemV implementation
or
> is
> > : it completly different implementation?

> > : Does somebody know if something changed between RH6.1 (2.2.5) and
> RH 6.2
> > : (2.2.14) because my program was working fine with 6.1

> > : Thanks for your help/time.

> > POSIX semaphores and SysV semaphores are an entirely different
thing.

> >       - POSIX semaphores are implemented in LinuxThreads
> >       - SysV semaphores are in libc core and use syscalls directly
> >       - POSIX semaphores work in multiple threads within one process
> >       - SysV semaphores work over multiple processes

> > I can't answer whether POSIX semaphores are implemented on top of
SysV
> > semaphores under Linux (don't know LinuxThreads well enough). It may
> but
> > it needn't be (e.g. Solaris implements them via different system
> calls).

> > When programming semaphores, decide to use one implementation (sem_*
> is
> > POSIX, sem* - no underscore - is SysV). You'll surely run into
> problems
> > if you mix sem_t (POSIX type) and int (SysV semid type) ...

> > Because the POSIX stuff is made for thread synchronization (i.e. to
be
> > used within the scope of the same process) it may be required to:

> >       - specify interprocess sharing when creating the semaphore
> >       - sem_init() the semaphore once in each process using it
> >       - creating the semaphore in shared memory.

> > POSIX semaphores should work between processes provided these three
> > requirements are met.

> > Note that RH 6.1 and 6.2 aren't so much different regarding the
> kernel,
> > but are profoundly different ('another system' would not be an
> exaggeration)
> > with respect to the GNU libc version they use. Pthreads bugs in
> glibc, esp.
> > the old buggy versions RH 6.0/6.1 were based on, are not new - maybe
> you've
> > written code that broke after the library implemented the correct
> behaviour ...

> > Bye,
> > Frank

> --
> _________________________________________________
>                Stephane Richard
>  Kasenna Inc.         Redefining Broadband Video!

> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
_________________________________________________
               Stephane Richard
 Kasenna Inc.         Redefining Broadband Video!

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

1. using Posix/SystemV semaphores under Linux RH 6.2

I want to use semaphores with process sharing under Linux RH 6.2.
I'm currently using sem_init() as a POSIX semaphore under a Linux
system and with a parameter to decide to use process sharing or not.

It seems that I have some problems with it anyway. I don't know why.

This call (sem_init) is described as a POSIX semaphore. Should I use
the SystemV semaphores (semctl, semop) ?

Does somebody know if something changed between RH6.1 (2.2.5) and RH 6.2
(2.2.14) because my program was working fine with 6.1

Thanks for your help/time.

Stef.

--
_________________________________________________
               Stephane Richard
 Kasenna Inc.         Redefining Broadband Video!

--
_________________________________________________
               Stephane Richard
 Kasenna Inc.         Redefining Broadband Video!

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Helw with CRC vs Check Sum.

3. Sys V Semaphores vs. POSIX Semaphores??

4. Can I set 3 keyboard mappings via xmodmap?

5. urgent help needed with systemV semaphores

6. Just installed Mandrake 9.0...

7. SystemV vs. BSD

8. How many free Windows Managers available for XFree86?

9. posix named semaphore value not reflected across process

10. %!@# Help Posix semaphores & mmap

11. POSIX Namned Semaphore

12. POSIX semaphores and Kernel 2.4.7, glibc 2.2.4 (RedHat 7.2)

13. POSIX.4 Semaphore questions