Chapter 3: Processes: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edition
Chapter 3: Processes: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edition
Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013
Chapter 3: Processes
Process Concept
To introduce the notion of a process -- a program
in execution, which forms the basis of all
computation
Process Scheduling
To describe the various features of process
scheduling
Operating System Concepts – 9th Edition 3.2 Silberschatz, Galvin and Gagne ©2013
Process Concept
Operating System Concepts – 9th Edition 3.3 Silberschatz, Galvin and Gagne ©2013
Process Structure
Operating System Concepts – 9th Edition 3.4 Silberschatz, Galvin and Gagne ©2013
Process in Memory
Operating System Concepts – 9th Edition 3.5 Silberschatz, Galvin and Gagne ©2013
Process State
Operating System Concepts – 9th Edition 3.6 Silberschatz, Galvin and Gagne ©2013
Process Control Block (PCB)
Operating System Concepts – 9th Edition 3.7 Silberschatz, Galvin and Gagne ©2013
Threads
So far, process has a single thread of execution
Consider having multiple program counters per process
Multiple locations can execute at once
Multiple threads of control -> threads
Need storage for thread details, multiple program counters
in PCB
Covered in the next chapter
Operating System Concepts – 9th Edition 3.8 Silberschatz, Galvin and Gagne ©2013
Process Representation in Linux
Operating System Concepts – 9th Edition 3.9 Silberschatz, Galvin and Gagne ©2013
Process Scheduling
Operating System Concepts – 9th Edition 3.10 Silberschatz, Galvin and Gagne ©2013
Ready Queue And Various I/O Device Queues
Operating System Concepts – 9th Edition 3.11 Silberschatz, Galvin and Gagne ©2013
Representation of Process Scheduling
Operating System Concepts – 9th Edition 3.12 Silberschatz, Galvin and Gagne ©2013
CPU Switch From Process to Process
Operating System Concepts – 9th Edition 3.13 Silberschatz, Galvin and Gagne ©2013
Schedulers
Short-term scheduler (or CPU scheduler) – selects which process
should be executed next and allocates a CPU
Sometimes the only scheduler in a system
Short-term scheduler is invoked frequently (milliseconds) (must
be fast)
Long-term scheduler (or job scheduler) – selects which processes
should be brought into the ready queue
Long-term scheduler is invoked 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
Long-term scheduler strives for good process mix
Operating System Concepts – 9th Edition 3.14 Silberschatz, Galvin and Gagne ©2013
Multitasking in Mobile Systems
Some mobile systems (e.g., early version of iOS) allow only one
process to run, others suspended
Starting with iOS 4, it provides for a
Single foreground process – controlled via user interface
Multiple background processes – in memory, running, but
not on the display, and with limits
Limits include single, short task, receiving notification of
events, specific long-running tasks like audio playback
Android runs foreground and background, with fewer limits
Background process uses a service to perform tasks
Service can keep running even if background process is
suspended
Service has no user interface, small memory use
Operating System Concepts – 9th Edition 3.15 Silberschatz, Galvin and Gagne ©2013
Context Switch
When CPU switches to another process, the system must
save the state of the old process and load the saved state
for the new process via a context switch
Context of a process represented in the PCB
Context-switch time is pure overhead; the system does no
useful work while switching
The more complex the OS and the PCB the longer the
context switch
Time dependent on hardware support
Some hardware provides multiple sets of registers per
CPU multiple contexts loaded at once
Operating System Concepts – 9th Edition 3.16 Silberschatz, Galvin and Gagne ©2013