Documente Academic
Documente Profesional
Documente Cultură
Operating Systems
Lecturer: Ngoc Tu Le
Faculty of IT – Hanoi University of Education
Objectives
Provides students with:
Basic Concepts and Principles of OSs
Windows,…
Prerequisites
Computer Architecture and Organization
Data Structures and Algorithms
Programming Languages: Pascal, C,…
…
References
A. Silberschatz, G. Gagne, and P.B. Galvin, “Operating
System Concepts”, Addison Wesley
Lecture 1
A.S. Tanenbaum, “Modern Operating Systems”, Prentice
Hall, 1992
Bill McCarty, “Learning Redhat Linux 3rd Edition”, O’Reilly,
2003
D.P. Bovet, M. Cesati, “Understanding Linux Kernel”,
O’Reilly,2000
J.S. Gray,
“Interprocess Communications in Linux: The Nooks and Cran
, Prentice Hall, 2003
A. Rubini, J. Corbet, “Linux Device Drivers 2nd Edition”,
O’Reilly
N.T.N. Hương, “Hệ điều hành”, NXB Bưu điện, 2004
…
Schedule, Exam and Score
Schedule
~67% of time for lectures
Exam
1 written exam at the end of this course
Score
Project: 40%
Exam: 60%
Requirements
Attend all lectures
Take notes
Project’s score must be greater than 5 to
have a right to take the final exam (Project’s
required format will be given more detail in
attached papers)
Contents
Chapter 1: Introduction
Chapter 2: Process Management
Chapter 3: Memory Management
Chapter 4: File System Management
Chapter 1 Introduction
Concept and Definitions
OS history
Computer System Oganization
OS Components
OS Services
OS Structures
Concept
A program that acts as an intermediary between a
user of a computer and the computer hardware.
Operating system goals:
Execute user programs and make solving user
problems easier.
Make the computer system convenient to use.
manner.
Concept (cont.)
Computer system can be divided into four components
Hardware – provides basic computing resources
Operating system
to monitor
Memory Layout for a Simple Batch System
Multiprogramming Systems
Multiprogramming needed for efficiency
Single user cannot keep CPU and I/O devices
memory
One job selected and run via job scheduling
process
If several jobs ready to run at the same time CPU
scheduling
If processes don’t fit in memory, swapping moves them
completely in memory
Desktop Systems
Personal computers – computer system
dedicated to a single user.
I/O devices – keyboards, mice, display
screens, small printers.
User convenience and responsiveness.
Can adopt technology developed for larger
operating system’ often individuals have sole
use of computer and do not need advanced
CPU utilization of protection features.
May run several different types of operating
systems (Windows, MacOS, UNIX, Linux)
Parallel Systems
Multiprocessor systems with more than on CPU in
close communication.
Tightly coupled system – processors share memory
and a clock; communication usually takes place
through the shared memory.
Advantages of parallel system:
Increased throughput
Economical
Increased reliability
graceful degradation
fail-soft systems
Parallel Systems (Cont.)
Symmetric multiprocessing (SMP)
Each processor runs and identical copy of
performance deterioration.
Most modern operating systems support
SMP
Asymmetric multiprocessing
Each processor is assigned a specific task;
Reliability
Communications
Distributed Systems (cont)
Requires networking infrastructure.
Local area networks (LAN) or Wide
area networks (WAN)
May be either client-server or peer-to-
peer systems.
General Structure of Client-Server
Clustered Systems
Clustering allows two or more systems to
share storage.
Provides high reliability.
Asymmetric clustering: one server runs the
application while other servers standby.
Symmetric clustering: all N hosts are
running the application.
Real-Time Systems
Often used as a control device in a dedicated
application such as controlling scientific
experiments, medical imaging systems,
industrial control systems, and some display
systems.
Well-defined fixed-time constraints.
Real-Time systems may be either hard or soft
real-time.
Real-Time Systems (Cont.)
Hard real-time:
Secondary storage limited or absent, data
robotics
Useful in applications (multimedia, virtual
Slow processors
Office environment
service on network, or
Broadcast request for service and respond to
as firmware
I/O devices and the CPU can execute concurrently.
Each device controller is in charge of a particular device
type.
Each device controller has a local buffer.
CPU moves data from/to main memory to/from local
buffers
I/O is from the device to local buffer of controller.
Device controller informs CPU that it has finished its
operation by causing an interrupt.
Interrupt Timeline
Common Functions of Interrupts
Interrupt transfers control to the interrupt service
routine generally, through the interrupt vector,
which contains the addresses of all the service
routines.
Interrupt architecture must save the address of the
interrupted instruction.
Incoming interrupts are disabled while another
interrupt is being processed to prevent a lost
interrupt.
A trap is a software-generated interrupt caused
either by an error or a user request.
An operating system is interrupt driven.
Interrupt Handling
Determines which type of interrupt has occurred:
polling
Cost
Volatility
occurs.
Timer commonly used to implement time sharing.
Time also used to compute the current time.
Load-timer is a privileged instruction.
Dual-Mode Operation
Sharing system resources requires operating
system to ensure that an incorrect program cannot
cause other programs to execute incorrectly.
Provide hardware support to differentiate between
at least two modes of operations.
1. User mode – execution done on behalf of a
user.
2. Monitor mode (also kernel mode or system
mode) – execution done on behalf of operating
system.
Dual-Mode Operation (Cont.)
Mode bit added to computer hardware to indicate
the current mode: monitor (0) or user (1).
When an interrupt or fault occurs hardware
switches to monitor mode.
Interrupt/fault
monitor user
set user mode
Privileged instructions can be issued only in monitor mode.
I/O Protection
All I/O instructions are privileged
instructions.
Must ensure that a user program could
never gain control of the computer in
monitor mode (I.e., a user program that, as
part of its execution, stores a new address in
the interrupt vector).
Use of A System Call to Perform I/O
System Calls
System calls provide the interface between a running
program and the operating system.
Generally available as assembly-language instructions.
process synchronization
process communication
Main-Memory Management
Memory is a large array of words or bytes, each with
its own address. It is a repository of quickly
accessible data shared by the CPU and I/O devices.
Main memory is a volatile storage device. It loses
its contents in the case of system failure.
The operating system is responsible for the
following activities in connections with memory
management:
Keep track of which parts of memory are
directories.
Mapping files onto secondary storage.
media.
I/O System Management
The I/O system consists of:
A buffer-caching system
Storage allocation
Disk scheduling
Networking (Distributed Systems)
A distributed system is a collection processors that
do not share memory or a clock. Each processor
has its own local memory.
The processors in the system are connected
through a communication network.
Communication takes place using a protocol.
A distributed system provides user access to
various system resources.
Access to a shared resource allows:
Computation speed-up
Enhanced reliability
Protection and Security
Protection – any mechanism for controlling access of processes or users
to resources defined by the OS
Security – defense of the system against internal and external attacks
Huge range, including denial-of-service, worms, viruses, identity
rights
Command-Interpreter System
Many commands are given to the operating
system by control statements which deal with:
process creation and management
I/O handling
secondary-storage management
main-memory management
file-system access
protection
networking
Command-Interpreter System
(Cont.)
The program that reads and interprets
control statements is called variously:
command-line interpreter
shell (in UNIX)
The kernel
Nonvirtual Machine Virtual Machine
Advantages/Disadvantages of Virtual
Machines
The virtual-machine concept provides complete
protection of system resources since each virtual
machine is isolated from all other virtual machines.
This isolation, however, permits no direct sharing of
resources.
A virtual-machine system is a perfect vehicle for
operating-systems research and development.
System development is done on the virtual machine,
instead of on a physical machine and so does not
disrupt normal system operation.
The virtual machine concept is difficult to
implement due to the effort required to provide an
exact duplicate to the underlying machine.