Check out the new USENIX Web site. next up previous
Next: Files, file descriptors, and Up: Linux process internal environment Previous: Exec


Clone

The clone system call creates a new process like fork does, but it offers more control of which elements in the execution context (memory space, table of file descriptors, table of signal handlers, file system information, process id, etc) are intended to be shared between the child and parent processes. The main use of clone is to implement LinuxThreads[19], which are multiple threads of control in a program that run concurrently in a shared memory space.

The implementation of clone is carried out completely in the application address space, i.e, no interactions with the kernel or servers are necessary. clone builds on K42's user-level thread model[7]. Even though the kernel does not allocate these thread PIDs we still need a mechanism to guarantee unique PIDs across the system. We do this by reserving a bit range in the PID space for cline PIDs. PIDs are 32 bit in Linux. K42 uses 20 bits to identify the target K42 process and 12 bits to identify the clone within the process. This allows clone PIDs to be assigned locally by each process and still ensure that clone PIDs are globally unique.


next up previous
Next: Files, file descriptors, and Up: Linux process internal environment Previous: Exec
2003-04-08