Week 10
Week 10
Operating Systems
Chapter Goals
3
Software Categories
Application software
Software written to address specific needs
—to solve problems in the real world
System software
Software that manages a computer system
at a fundamental level
Can you name examples of each?
4
Software Examples
Application software
Example: Ms. Office, Chrome, and?
System software
Example: BIOS, Device driver, Operating
System (i.e.: Windows, LINUX)
5
Roles of an Operating System
Operating system
System software that
– manages computer resources, such as
memory and input/output devices
– provides an interface through which a human
can interact with the computer
– allows an application program to interact with
these other system resources
6
Roles of an Operating System
What operating
systems have
you used?
Figure 10.1
An operating system
interacts with many
aspects of a computer
system.
7
Roles of an Operating System
8
Resource Management
Multiprogramming
The technique of keeping multiple programs that
compete for access to the CPU in main memory at
the same time so that they can execute
Memory management
The process of keeping track of what programs are
in memory and where in memory they reside
9
Resource Management
Process
A program in execution
Process management
The act of carefully tracking the progress of a
process and all of its intermediate states
CPU scheduling
Determining which process in memory is executed
by the CPU at any given point
10
Batch Processing
11
12
Timesharing
Timesharing system
A system that allows multiple users to interact with
a computer at the same time
Virtual machine
The illusion created by a time-sharing system that
each user has his/her own machine
(i.e.: Virtual Machine, VMWare, Oracle VM
VirtualBox)
13
Other Factors
Real-time System
A system in which response time is crucial given
the nature of the application
Response time
The time delay between receiving a stimulus and
producing a response
Device driver
A small program that “knows” the way a particular
device expects to receive and deliver information
14
Memory Management
Logical address
Reference to a stored value relative to the program
making the reference
Physical address
Actual address in main memory
15
Memory Management
Program 1:
sum is assigned memory
location 23, a location
relative to Program 1
17
Single Contiguous MM
In concrete terms:
A logical address is simply an integer value
relative to the starting point of the program
A physical address is a logical address
added to the starting location of the program
in main memory
18
Single Contiguous MM
19
Partition Memory Management
21
Partition Memory Management
Why check?
Figure 10.6
Address resolution
in partition memory
management
22
Partition Selection Algorithms
23
Partition Selection Algorithms
24
Paged Memory Management
Prog. 2, Page 2
Prog. 1, Page 3
And???
27
Paged Memory Management
This new logical
address is mapped to a
physical address with
the help of a page-map
table (PMT)
Every program has a
PMT that shows into
which frame each page
of the program is
stored
What is the physical
address of <2, 518>?
28
Paged Memory Management
Demand paging
An extension of paged memory management in
which pages are brought into memory on demand
Page swap
The act of bringing in a page from secondary
memory, which often causes another page to be
written back to secondary memory
29
Paged Memory Management
Virtual memory
The illusion that there are no restrictions on the
size of a program because an entire process
doesn't have to be in memory at the same time
Thrashing
Inefficient processing caused by constant page
swaps
30
Process Management
Process management
The act of managing the use of the CPU by
individual processes
Recall that a process is a program in
execution
31
Process Management
There is only one CPU and therefore only one set of CPU
registers, which contain the values for the currently
executing process
Each time a process is moved to the running state:
– Register values for the currently running process
are stored into its PCB
– Its PCB is moved to the list of the state into which it goes
– Register values of the new process moving into the running
state are loaded into the CPU
– This exchange of register information is called a context
switch
34
CPU Scheduling
CPU Scheduling
The act of determining which process in the ready
state should be moved to the running state
– Many processes may be in the ready state
– Only one process can be in the running state, making
progress at any one time
35
CPU Scheduling
Nonpreemptive scheduling
The currently executing process gives up the CPU
voluntarily
Preemptive scheduling
The operating system decides to favor another process,
preempting the currently executing process
Turnaround time
The amount of time between when a process arrives in the
ready state the first time and when it exits the running state
for the last time
36
CPU Scheduling Algorithms
First-Come, First-Served
Processes are moved to the CPU in the order in which they
arrive in the running state
Shortest Job Next
Process with shortest estimated running time in the ready
state is moved into the running state first
Round Robin
Each process runs for a specified time slice and moves
from the running state to the ready state to await its next
turn if not finished
37
First-Come, First-Served
What is the
average turn-
around time?
38
Shortest Job Next
What is the
average turn-
around time?
39
Round Robin
40
Round Robin
First-Come, First-Served?
Round Robin?
42
• 1. non preemptive – once CPU given to
the process it cannot be preempted until
completes its CPU burst.
• 2. preemptive – if a new process arrives
with CPU burst length less than remaining
time of current executing process,
preempt.
43