Download presentation
Presentation is loading. Please wait.
Published byChristal O’Connor’ Modified over 9 years ago
1
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
2
Multiprogramming goals: Maximize CPU utilization Maximize number of processes in memory Timesharing goals: Switch CPU among processes such that users interact with each program simultaneously Maximize fairness almost!
3
Processes are created by the operating system Processes initially added to a job queue, which contains all processes waiting to enter the system From the job queue, processes that are ready for execution are added to the ready queue
4
A long-term scheduler (i.e. job scheduler) selects processes from the job queue, adding those processes to the ready queue A short-term scheduler (i.e. CPU scheduler) selects processes from the ready queue and allocates time with the CPU More on this later....
5
The long-term scheduler is invoked infrequently
6
The degree of multiprogramming of an operating system is defined as the number of processes in memory In a stable operating system, the average process arrival rate equals the average process departure rate
7
Processes are either I/O bound or CPU bound A CPU-bound process does little I/O and instead makes heavy use of the CPU An I/O-bound process spends a majority of its time performing (i.e. waiting for) I/O The long-term scheduler should select a good process mix of CPU-bound and I/O- bound processes
8
Most modern operating systems have no long-term scheduler (e.g. Windows, UNIX) All processes are admitted to the ready queue, regardless of whether the operating system can handle the load Often results in users changing their usage habits....
9
Modern operating systems implement a medium-term scheduler to swap processes to/from memory and disk
10
A process is an active program in execution Requires CPU time, memory, file access, network access, other I/O access Operating system is responsible for: Creating/deleting processes Scheduling processes Allocating resources to processes Synchronizing communication between processes
11
For each process, the operating system manages and executes processes by recording: Program counter (PC) Registers Data section (global data) Stack (temporary data) Heap (dynamically allocated memory) heap stack data text/code
12
As a process executes, it changes its state
13
Operating system represents each process via a process control block (PCB) Process state Process ID or number Program counter (PC) CPU registers CPU-scheduling and memory management information List of open file/resource handles
14
context switch takes a few milliseconds
16
The short-term scheduler frequently decides which process the CPU executes next Typical time slice (t) a process has with the CPU is 100 milliseconds How much CPU time is wasted if t is 100ms and it takes 10ms to schedule the next process and perform the context switch?
17
Processes are created from other processes A parent process creates a child process, which in turn creates child processes of its own, etc. A tree of processes is the result:
18
Operating system resources are sometimes shared amongst processes Possibilities: Parent and child processes share all resources Child shares a subset of its parent’s resources Parent and child processes share no resources
19
Each process has its own unique process identifier (pid)
20
When a new process is created, the parent has two options: Parent process continues to execute concurrently with its children Parent process waits for its children to terminate their execution The child process decides what it will do: Duplicate the parent or load a new program
21
In Unix, a new child process is forked via the fork() system call Child optionally calls the exec() system call to load a new program
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.