Processes

From DikapediaV2
Jump to: navigation, search

Related topics:



Processes: program in execution.

  • Address space (memory) the program can use
  • State (registers, including program counter and stack pointer)
  • OS keeps track of all processes in a process table.
  • Processes can create other processes.

A program is a passive entity stored on a disk (executable file), the process is active.

A program becomes a process when the executable file is loaded into memory.

One program can be several processes.

  • Consider multiple users executing the same program.


OS provides mechanisms for:

  • process creation
  • process termination
  • forking of process
  • prioritizing and scheduling processes


Process Creation


Generally, processes are identified and managed via a process identifier (PID).

Resource sharing options:

  • Parent and children share all resources
  • Children share subset of parent's resources
  • Parent and child share no resources

Execution options:

  • Parent and children execute concurrently
  • Parent waits until children terminate


Process Termination


Process terminates = all children terminated.

  • Cascading termination - All children, grandchildren, etc. are terminated.
  • Termination initiated by OS.

May wait for termination of child by using the wait() system call. Call returns status information and the pid of the terminated process

pid = wait(&status);

Zombie process: if no parent waiting (did not invoke wait()), then the process is a zombie.

Orphan process: if parent is terminated without invoking wait(), process is an orphan.