An overview of process management and interprocess communication in operating systems. Topics include process description, process states, context switching, process scheduling, and various interprocess communication mechanisms such as shared memory and message passing. The document also discusses the advantages and disadvantages of each mechanism.
Download Operating Systems: Process Management and Interprocess Communication and more Study notes Computer Science in PDF only on Docsity!
Operating SystemsOperating Systems
CMPSC 473 CMPSC 473
Process Management Process Management
January 31, 2008 - Lecture January 31, 2008 - Lecture 55
Instructor: Trent Jaeger Instructor: Trent Jaeger
Last class:
Process Creation
Today:
Process Management
Process State
What do we need to track about a process?
Process Control Block
State of running process
Linked list of process control information Process id Program Counter … Other registers Process state Ptr to linked list Main Memory (RAM) OS Processes
/proc File System
Linux and Solaris
ls /proc
A directory for each process
Various process information or ways to write to the
process
/proc//io -- I/O statistics
/proc//environ -- Environment variables (in binary)
/proc//stat -- process status and info
Context Switch
OS switches from one execution context to another
One process to another process
Interrupt handling
Process to kernel ( mode transition , not context switch)
Current Process to New Process
Save the state of the current process
Process control block which describes the state of the process in the CPU
Load the saved context for the new process
Load the new process’s process control block into OS and registers
Start the new process
Does this differ if we are running an interrupt handler?
Context Switch
No useful work is being done during a context
switch
Speed it up
Hardware support
Multiple register sets (Sun UltraSPARC)
However, hardware optimization may conflict
TLB flush is necessary
Different virtual to physical mappings on different processes
Process Description Summary
Serves two purposes
Track per process resources
Save process state on context switch
Process control block
Represents both aspects
CPU state
Progam counter, registers
Resources
Linked lists of pages, child processes, files, etc.
Process Scheduling
What do we need to know about processes to
choose the next one to run?
Actual scheduling details/algorithms will be discussed later
Scheduling Processes
• Processes transition among execution states
State Transitions
New Process ==> Ready
Allocate resources
End of process queue
Ready ==> Running
Head of process queue
Scheduled
Running ==> Ready
Interrupt (Timer)
Back to end of process queue
State Transitions:
Page Fault Handling
Running ==> Waiting
Page fault exception (similar for syscall or I/O interrupt)