RE: Nagios and threads

From: Daniel Eischen (eischen_at_vigrid.com)
Date: 06/22/05

  • Next message: Daniel Eischen: "Re: Nagios and threads"
    Date: Wed, 22 Jun 2005 10:25:19 -0400 (EDT)
    To: Norbert Koch <NKoch@demig.de>
    
    

    On Wed, 22 Jun 2005, Norbert Koch wrote:

    > > [snip]
    > > > at least some assumptions that the child won't be
    > > > doing much before
    > > > execing or exiting. (But Im sure one of the
    > >
    > > The child process should be able to call any system
    > > calls it likes -without assuming that pthreads from
    > > the parent process have been copied over to the child
    > > process. I spose most implementations support that.
    > >
    > > regards
    > > -kamal
    >
    > >From "Programming with POSIX Threads" [David R. Butenhof]:
    >
    > p.197-198:
    > ... Avoid using fork in a threaded program (if you can)
    > unless you intend to exec a new program immediately
    > ... Pthreads does not "terminate" the other threads
    > in a forked process. ... They simple cease to exist.
    > ... The state of mutexes is not affected by a fork. If
    > it was locked in the parent it is locked in the child!

    Yes, and realize that both libc and libpthread are consumers
    themselves of mutexes (and CVs). Also, some system calls
    are wrapped by libpthread to provide cancellation points.
    Unless you exec after the fork, you may be relying on
    inconsistent mutex state.

    -- 
    DE
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: Daniel Eischen: "Re: Nagios and threads"

    Relevant Pages

    • Re: Concurrent usage of glibc 2.2.4 and 2.3.2
      ... child process, which execve's /bin/ls (that's how Communicator 4.8 ... Before the fork, the parent process ... Here the LD_LIBRARY_PATH points to the main glibc libraries, ...
      (comp.os.linux.misc)
    • Re: Net::SSH::Perl bind socket problem
      ... unfortunatly, I don't quite get how I should use fork. ... the croak code could be the problem, and a possibility could be not to croak so fast, but try port after port until binding has been done or the port range has fully be tested. ... a bit wrong, since you just created a child process, in that childprocess you get the filehandles from the org. ... The parent process can ident his child. ...
      (perl.beginners)
    • Re: fork and exec
      ... process "read" access to the parent process' address space. ... parent and child are identical. ... That's why exec*() exists: if a running program thinks it should be ... Note that the COW scheme is not _necessary_ for fork() to operate. ...
      (comp.unix.programmer)
    • fork and exec
      ... The Linux fork() system call gives both the child process and the ... process "read" access to the parent process' address space. ... why should it call exec system call ????? ...
      (comp.unix.programmer)
    • Re: c++: Run process and get stdout into string-variable
      ... Florian Erfurth wrote: ... I wrote you should fork() your process. ... program) and a child process. ... The parent process gets the child's pid back, ...
      (comp.os.linux.development.apps)