Process Management Jerrod Howlett Sarah Sullivan
Processes Process- a program in execution Process Control Block (PCB)- how a process is represented in an OS process state program counter CPU registers CPU scheduling information memory management information accounting information I/O status information
Process States
Process Creation fork() defined by API Uses clone() system call -> do_fork() -> copy_process() If successful, then it will wake the new child being created. Child is run in the kernel, preventing copy_on_write overhead, if exec() is called immediately. vfork() Same as fork(), but does not copy parent page table entries. Parent is blocked until child calls exec() or exits.
Copy-On-Write fork() is implemented through the use of copy- on-write (COW) pages Technique to delay or altogether prevent copying of data So that data that isn't shared isn't copied, preventing unnecessary overhead If data is written to, a duplicate is made, and each process receives a unique copy. Duplication only occurs when something is written. Otherwise, data is shared as read-only.
Process Termination Done either voluntarily or by the exit() system call Work is done by do_exit() No longer runnable No address space TASK_ZOMBIE state Exists solely to provide information for the parent Exits TASK_ZOMBIE state when parent receives info from child, or is no longer interested in the child Need to re-parent if parent exits before child Won't be a zombie Either gets re-parented to another process or an init process
Acknowledgements Linux Kernel Development, 2 nd Edition (2005) Linux Cross-Reference kernel\fork.c include\linux\sched.h