tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

process_forking_in_nspr.rst (1124B)


      1 Process forking in NSPR
      2 =======================
      3 
      4 The threads provided in NetScape Portable Runtime (NSPR) are implemented
      5 using different mechanisms on the various platforms. On some platforms,
      6 NSPR threads directly map one-to-one to the threads provided by the
      7 platform vendor, on other platforms NSPR threads are basically
      8 user-level threads within a single process (with no kernel threads) and
      9 on still others NSPR threads are user-level threads implemented on top
     10 of one or more kernel threads within single address space.
     11 
     12 NSPR does not override the fork function and so, when fork is called
     13 from the NSPR thread the results are different on the various platforms.
     14 All the threads present in the parent process may be replicated in the
     15 child process, only the calling thread may be replicated in the child
     16 process or only the calling kernel thread may be replicated.
     17 
     18 So, to be consistent across all platforms, it is suggested that when
     19 using fork in a NSPR thread;
     20 
     21 #. The exec function should be called in the child process.
     22 #. No NSPR functions should be called in the child process before the
     23   exec call is made.