Nhập môn Công nghệ Thông tin: Chapter 9 - Operating Systems (Hệ điều hành)
Nhập môn Công nghệ Thông tin: Chapter 9 - Operating Systems (Hệ điều hành)
2
Roles of an Operating System
Operating system (Hệ điều hành)
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
3
Roles of an Operating System
What operating
systems have
you used?
4
Roles of an Operating System
The various roles of an operating system
generally revolve around the idea of “sharing
nicely”
An operating system manages resources, and
these resources are often shared in one way or
another among programs that want to use them
5
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
6
Resource Management
Process (tiến trình)
A program in execution
Process management (quản lý tiến trình)
The act of carefully tracking the progress of a process
and all of its intermediate states
CPU scheduling (lập lịch cho CPU)
Determining which process in memory is executed by
the CPU at any given point
7
Batch Processing
The first operating system was a human operator, who organized
various jobs from multiple users into batches of jobs that needed
the same resources
8
Timesharing
Timesharing system (hệ thống chia sẻ thời gian)
A system that allows multiple users to interact with a
computer at the same time
Virtual machine (máy ảo)
The illusion created by a time-sharing system that each
user has his/her own machine
9
Other Factors
Real-time System (hệ thống thời gian thực)
A system in which response time is crucial given the
nature of the application
Response time (thời gian đáp ứng)
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
10
Memory Management
Operating systems must employ techniques to
– Track where and how a program resides in memory
– Convert logical addresses into actual addresses
Logical address (địa chỉ luận lý)
Reference to a stored value relative to the program
making the reference
Physical address (địa chỉ vật lý)
Actual address in main memory
11
Single Contiguous MM
12
Process Management
Process management (quản lý tiến trình)
The act of managing the use of the CPU by
individual processes
Recall that a process is a program in execution
13
Process Management
The Process States
What can
cause a
process to
move to
the
Waiting
state?
14
Process Management
Process control block (PCB)
A data structure used by the OS to manage information
about a process, including
– current value of the program counter
– values of all CPU registers for the process
– base and bound register values (or page tables)
– accounting information
Each state is represented by a list of PCBs, one for each
process in that state
15
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
16
CPU Scheduling
CPU Scheduling (lập lịch CPU)
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
17
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
18
First-Come, First-Served
What is the
average turn-
around time?
19
Shortest Job Next
What is the
average turn-
around time?
20
Round Robin
Every process is treated the same!
Time slice (quantum)
The amount of time each process receives
before being preempted and returned to the
ready state to allow another process its turn
21
Round Robin
Suppose the time slice is 50