Check out the new USENIX Web site. next up previous
Next: System Initialization Up: RCLinux Kernel Modifications and Previous: Changes to schedule()

Changes to fork() and exit()

Linux supports a clone system call that an user can use to create a clone of a process. A flag is passed as an argument to the clone call that specifies the type of the objects (eg virtual memory, signal mask etc) that are to be shared. Both fork and clone system call make use of the same function but use different flags. A new flag CLONE_RC has been added to the clone flags. If CLONE_RC is set then this function allocates a new resource container for the child process and makes it the child of the resource container of the parent process. Otherwise the resource container of child process is set to that of the parent process. When the child process is made runnable, it is added to the scheduler bindings of the resource container to which it is bound to.

When a process exits, Linux frees most of the resources (eg. virtual memory, file tables etc). This cannot free the complete task structure since some of the information is required later (eg. exit code for the parent, fields in task structure used by the scheduler, and the kernel stack since the process is still the ``currently running'' process). These fields are freed when the parent calls wait. A resource container which is bound to the exiting task cannot be freed during exit as it is needed by the scheduler. It is freed when parent calls the wait.


next up previous
Next: System Initialization Up: RCLinux Kernel Modifications and Previous: Changes to schedule()
Mansoor Alicherry 2001-05-01