How is the implementation of threads done in a system?
I know that child processes are created using the fork() call
and a thread is a light weight. How does the creation of a thread differ from that of a child process?
How is the implementation of threads done in a system? I know that child
Share
Threads are created using the
clone()system call that can make a new process that shares memory space and some of the kernel control structures with its parent. These processes are called LWPs (light-weight processes) and are also known as kernel-level threads.fork()creates a new process that initially shares memory with its parent but pages are copy-on-write, which means that separate memory pages are created when the content of the original one is altered. Thus both parent and child processes can no longer change each other’s memory and effectively they run as separate processes. Also the newely forked child is a full-blown processes with its separate kernel control structures.