Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>when thread is implemented in his own stack that time it is the same stack which used by process or any other?</p> </blockquote> <p>Can't quite parse this but I get the gist I think.</p> <p>In most cases, under Linux in a multithreaded application, all of the threads share the same address space. Each thread if it is running on a separate processor may have local cached memory but the overall address space is shared by all threads. Even per-thread stack space is shared by all threads -- just that each thread gets a different contiguous memory area.</p> <blockquote> <p>But how it's share all these parameters within same address?</p> </blockquote> <p>This is also true of the global variables, file descriptors, etc.. They are all shared.</p> <p>Most thread implementations running under Linux use the clone(2) syscall to create new thread processes. To quote from the <a href="http://linux.die.net/man/2/clone" rel="nofollow">clone man page</a>:</p> <blockquote> <p>clone() creates a new process, in a manner similar to fork(2). It is actually a library function layered on top of the underlying clone() system call, hereinafter referred to as sys_clone. A description of sys_clone is given toward the end of this page.</p> <p>Unlike fork(2), these calls allow the child process to share parts of its execution context with the calling process, such as the memory space, the table of file descriptors, and the table of signal handlers.</p> </blockquote> <p>You can see the cloned processes by using <code>ps -eLf</code> under Linux.</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