Docsity

Understanding Processes and Interprocess Communication: A Comprehensive Guide, Slides of Operating Systems

Partial preview of the text

Download Understanding Processes and Interprocess Communication: A Comprehensive Guide and more Slides Operating Systems in PDF only on Docsity!

Lecture 5

Chapter 3: Processes (cont)

Chapter 3: Processes

  • Process Concept
  • Process Scheduling
  • Operations on Processes
  • Interprocess Communication
  • Examples of IPC Systems
  • Communication in Client-Server Systems

Process State

  • As a process executes, it changes state
    • new : The process is being created
    • running : Instructions are being executed
    • waiting : The process is waiting for some event to occur
    • ready : The process is waiting to be assigned to a processor
    • terminated : The process has finished execution

Process Control Block (PCB)

Information associated with each process

  • Process state
  • Program counter
  • CPU registers (accumulators, index registers, stack pointers, general purpose registers, etc.)
  • CPU scheduling information (priority, pointers to scheduling queues, etc.)
  • Memory-management information (base and limit registers, page/segment tables, etc.)
  • Accounting information (account numbers, job/process number, time limits, etc.)
  • I/O status information (allocated I/O devices, open files, etc.)

Process Scheduling Queues

  • Multiprogramming : Have some process running at all times to maximize CPU utilization
  • Time-sharing : Switch CPU among processes so frequently that users can interact with each program
  • Process scheduler selects an available process
  • Processes migrate among the various queues
  • Job queue – set of all processes in the system
  • Ready queue – set of all processes residing in main memory, ready and waiting to execute
  • Device queues – set of processes waiting for an I/O device

Ready Queue And Various I/O Device Queues

Schedulers

  • Long-term scheduler (or job scheduler) – selects

which processes should be brought into the ready queue

  • Short-term scheduler (or CPU scheduler) – selects

which process should be executed next and allocates CPU

Medium Term Scheduling

Schedulers (Cont)

  • Short-term scheduler is invoked very frequently (milliseconds) ⇒ (must be fast)
  • Long-term scheduler is invoked very infrequently (seconds, minutes) ⇒ (may be slow)
  • The long-term scheduler controls the degree of multiprogramming
  • Processes can be described as either:
    • I/O-bound process – spends more time doing I/O than computations, many short CPU bursts
    • CPU-bound process – spends more time doing computations; few very long CPU bursts

Process Creation

• Parent process create children processes,

which, in turn create other processes, forming

a tree of processes

• Generally, process identified and managed via

a process identifier ( pid )

• Resource sharing

– Parent and children share all resources

– Children share subset of parent’s resources

– Parent and child share no resources Docsity.com

Process Creation (Cont)

• Address space

– Child duplicate of parent

– Child has a program loaded into it

• UNIX examples

– fork system call creates new process

– exec system call used after a fork to replace the

process’ memory space with a new program

A tree of processes on a typical

Solaris

Chapter 3: Processes

• Process Concept

• Process Scheduling

• Operations on Processes

• Interprocess Communication

• Examples of IPC Systems

Interprocess Communication

• Processes within a system may be

independent or cooperating

• Independent process cannot affect or be

affected by the execution of another

process

• Cooperating process can affect or be

affected by other processes, including

sharing data

• Reasons for cooperating processes:

– Information sharing

Communications Models