7
Process Management Jerrod Howlett Sarah Sullivan

Process Management Jerrod Howlett Sarah Sullivan

Embed Size (px)

Citation preview

Page 1: Process Management Jerrod Howlett Sarah Sullivan

Process Management

Jerrod Howlett

Sarah Sullivan

Page 2: 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

Page 3: Process Management Jerrod Howlett Sarah Sullivan

Process States

Page 4: Process Management Jerrod Howlett Sarah Sullivan

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.

Page 5: Process Management Jerrod Howlett Sarah Sullivan

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.

Page 6: Process Management Jerrod Howlett Sarah Sullivan

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

Page 7: Process Management Jerrod Howlett Sarah Sullivan

Acknowledgements

Linux Kernel Development, 2nd Edition (2005) Linux Cross-Reference

http://lxr.linux.no/ kernel\fork.c include\linux\sched.h