<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: fork usage in a multithreading environment in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602470#M679784</link>
    <description>"man fork":&lt;BR /&gt;(emphasis mine)&lt;BR /&gt;&lt;BR /&gt;-----&lt;BR /&gt;DESCRIPTION&lt;BR /&gt;&lt;BR /&gt;The fork() system call causes the creation of a new process. The new child process is created with _exactly one thread_ or lightweight process. The new child process contains a replica of the calling thread (if the calling process is multi-threaded) and its entire address space, possibly including the state of mutexes and other resources.&lt;BR /&gt;[...]&lt;BR /&gt;-----&lt;BR /&gt;i.e. the answer is "No, only the thread calling fork() is replicated."&lt;BR /&gt;&lt;BR /&gt;The same is true of the vfork() system call.&lt;BR /&gt;&lt;BR /&gt;MK</description>
    <pubDate>Wed, 17 Mar 2010 12:44:44 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2010-03-17T12:44:44Z</dc:date>
    <item>
      <title>fork usage in a multithreading environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602469#M679783</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I have a multi-thread process, that in a specific thread executes a fork.&lt;BR /&gt;&lt;BR /&gt;My question is: does the child process inerit all father process threads?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;Giuseppe</description>
      <pubDate>Wed, 17 Mar 2010 12:36:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602469#M679783</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2010-03-17T12:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: fork usage in a multithreading environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602470#M679784</link>
      <description>"man fork":&lt;BR /&gt;(emphasis mine)&lt;BR /&gt;&lt;BR /&gt;-----&lt;BR /&gt;DESCRIPTION&lt;BR /&gt;&lt;BR /&gt;The fork() system call causes the creation of a new process. The new child process is created with _exactly one thread_ or lightweight process. The new child process contains a replica of the calling thread (if the calling process is multi-threaded) and its entire address space, possibly including the state of mutexes and other resources.&lt;BR /&gt;[...]&lt;BR /&gt;-----&lt;BR /&gt;i.e. the answer is "No, only the thread calling fork() is replicated."&lt;BR /&gt;&lt;BR /&gt;The same is true of the vfork() system call.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Wed, 17 Mar 2010 12:44:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602470#M679784</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2010-03-17T12:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: fork usage in a multithreading environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602471#M679785</link>
      <description>Hi Giuseppe,&lt;BR /&gt;&lt;BR /&gt;From a perf point of view it should be avoided as long as possible.&lt;BR /&gt;&lt;BR /&gt;To fork() the kernel need to stop all the parent threads before duplicating its memory and fds. They are resumed after those operations.&lt;BR /&gt;&lt;BR /&gt;So avoid fork() in multithread applications&lt;BR /&gt;use coprocess to launch forked processes and communiate with that coprocess through pipe, UNIX socket, or any other mean to ask a launch. From a perf point of view it will be much better.&lt;BR /&gt;if you need to share fds, you can send fds through UNIX sockets. for instance. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Mar 2010 13:14:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602471#M679785</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-03-17T13:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: fork usage in a multithreading environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602472#M679786</link>
      <description>&amp;gt;I have a multi-thread process, that in a specific thread executes a fork.&lt;BR /&gt;&lt;BR /&gt;Note: system(3) also does a fork.&lt;BR /&gt;&lt;BR /&gt;As Matti said, you only have the one thread.  But libpthread would have to execute every atfork handler when you fork.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Laurent: if you need to share fds, you can send fds through UNIX sockets&lt;BR /&gt;&lt;BR /&gt;How can you do that unless you have a common grandparent?</description>
      <pubDate>Wed, 17 Mar 2010 14:47:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602472#M679786</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-03-17T14:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: fork usage in a multithreading environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602473#M679787</link>
      <description>Denis:&lt;BR /&gt;&amp;gt;How can you do that unless you have a common grandparent?&lt;BR /&gt;&lt;BR /&gt;2 main ways:&lt;BR /&gt;one using /dev/echo and I_SENDFD/I_RECVFD ioctls&lt;BR /&gt;&lt;BR /&gt;UNIX domain socket access right send with sendmsg() (man sendmsg)&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Mar 2010 18:13:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602473#M679787</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-03-17T18:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: fork usage in a multithreading environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602474#M679788</link>
      <description>I've been a sysadmin for over 15 years, but have never needed to understand the things you folks are discussing.  It's mostly greek to me, but can you describe in general what you're doing?  When does one need to know how to understand these system calls?  I'm guessing you're writing a script or C program, but this is not clear.  Is there an HP resource I can tap to begin to learn/understand this area of UNIX?&lt;BR /&gt;&lt;BR /&gt;Thanks!  Also, if you'd rather, I could create a new topic so I can assign some points too.</description>
      <pubDate>Thu, 18 Mar 2010 16:38:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602474#M679788</guid>
      <dc:creator>RC Park</dc:creator>
      <dc:date>2010-03-18T16:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: fork usage in a multithreading environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602475#M679789</link>
      <description>&amp;gt;RC Park: I've been a sysadmin for over 15 years, but have never needed to understand the things you folks are discussing.&lt;BR /&gt;&lt;BR /&gt;This is a developer question.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I'm guessing you're writing a script or C program, but this is not clear.&lt;BR /&gt;&lt;BR /&gt;This is very clear.  It is a probably C or C++ program.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I could create a new topic so I can assign some points too.&lt;BR /&gt;&lt;BR /&gt;You should create your own thread for your different question.</description>
      <pubDate>Fri, 19 Mar 2010 03:44:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fork-usage-in-a-multithreading-environment/m-p/4602475#M679789</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-03-19T03:44:58Z</dc:date>
    </item>
  </channel>
</rss>

