[OS]Process management

Job vs Process

  • Job / Program
    • Programs + Data to run
    • Status before the execution request to the computer system
  • Process
    • Jobs registered on the system for execution

Resource

  • Passive entity
  • H/W resources
    • Processor, memory, disk, monitor, keyboard, Etc.
  • S/W resources
    • Message, signal, files, installed SWs, Etc.
  • Process
    • Jobs registered on the system for execution

Process Control Block (PCB)

  • OS stores information needed to manage processes
  • Create at process creation

Process States

Created State

  • Ready or Suspended ready

Ready State

  • Waiting for processor assignment
  • Dispatch(or Schedule)
    • Ready state -> running state

Running State

  • Allocated processors and all the resources
  • Preemption
    • Running state -> ready states
  • Block / sleep
    • Running state -> asleep state

Blocked / Asleep State

  • Wake-up
    • Asleep state -> ready state

Suspended State

  • Memory not allocated (stolen) state
  • Swap-out(suspended), Swap-in(resume)

Terminated / Zombie State

  • Process execution completed
  • After returning all resources,
  • Only some PCB information remains in the kernel

Interrupt

  • Unexpected, external events
  • Types of Interrupts
    • I/O interrupt
    • Clock interrupt
    • Console interrupt
    • Program check interrupt
    • Machine check interrupt
    • Inter-process interrupt
    • System call interrupt

Context Switching

  • Context
    • CPU register context => in CPU
    • Code & data, Stack, PCB => memory
  • Context saving
    • Save register context for the current process
  • Context restoring
    • Restore register context to process
  • Context switching
    • Context saving + Context restoring

Reference

Process management