Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Maybe you should first read <a href="https://stackoverflow.com/questions/2483041/what-is-the-difference-between-fork-and-thread">What is the difference between fork and thread?</a></p> <p>To elaborate more</p> <p><strong>Daemon Thread</strong></p> <p>Typically in C/C++ (Linux Environment) one would create a daemon using <strong>fork()</strong>. <strong>fork()</strong> creates a new process by duplicating the calling process. Here the parent process would exit leaving the the child process behind. This child process detaches from the controlling terminal, reopens all of {stdin, stdout, stderr} to /dev/null, and changes the working directory to the root directory. (based on flags, of course). Under Linux, fork() is implemented using copy-on-write pages, so the only penalty that it incurs is the time and memory required to duplicate the parent's page tables, and to create a unique task structure for the child.</p> <p><strong>Detached Thread</strong></p> <p>While Pthread detached behavior is different (1) The detached thread cannot be joined back once detached (2) The detached attribute merely determines the behavior of the system when the thread terminates; it does not prevent the thread from being terminated if the process terminates using exit (or equivalently, if the main thread returns). The <strong>pthread_detach()</strong> function marks the thread identified by thread as detached. When a detached thread terminates, its resources are automatically released back to the system without the need for another thread to join with the terminated thread.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload