Docsity

Process Concept - Operating Systems, Distributed Computation - Lecture Slides, Slides of Operating Systems

Partial preview of the text

Download Process Concept - Operating Systems, Distributed Computation - Lecture Slides and more Slides Operating Systems in PDF only on Docsity!

PROCESSES

Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems

Process Concept

  • An OS executes a variety of programs:
    • Batch system – jobs
    • Time-shared systems – user programs or tasks
  • Terms job and process interchangeably.
  • Process : a program in execution;
  • A process includes:
    • Program counter
    • Stack
    • Data section
    • Code (“text”)
    • Registers
    • Heap

Diagram of Process State

Process Control Block (PCB)

  • Information associated with each process.
  • Process state
  • Program counter
  • CPU registers
  • CPU scheduling information
  • Memory-management information
  • Accounting information
  • I/O status information

PCB in Linux

struct task_struct {

pid_t pid; /* process identifier / long state; / state of the process / unsigned int time_slice; / scheduling info / struct task_struct * parent; / parent process / struct list_head children; / this process’s children */ struct files_struct files; / list of open files */ struct mm_struct mm; / address space of the process */

};

CPU Switch From Process to Process

Ready & Various I/O Device Queues

Process Scheduling

Addition of Medium Term Scheduling

Schedulers (Cont.)

  • Short-term scheduler is invoked frequently (~100 ms)  (must be fast).
  • Long-term scheduler is invoked infrequently (seconds, minutes)  (may be slow).

Context Switch

  • When CPU switches to another process:
    • must save the state of the old process
    • load the saved state for the new process.
  • Context-switch time is overhead ; the system does no useful work while switching.
  • Time dependent on hardware support.

Process Creation

  • Parent process create children processes, which, in turn create other processes, forming a tree of processes.
  • 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. Docsity.com

Processes Tree on UNIX

Process Termination

  • Process executes last statement and asks to end (exit). - Output data from child to parent (via wait). - Process’ resources are deallocated by operating system.