Introduction
Operating System Concepts – 9th Edit9on Silberschatz, Galvin and Gagne ©2013
What is an Operating System?
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
Use the computer hardware in an efficient manner
Operating System Concepts – 9th Edition 1.2 Silberschatz, Galvin and Gagne ©2013
Computer System Structure
Computer system can be divided into four components:
Hardware – provides basic computing resources
CPU, memory, I/O devices
Operating system
Controls and coordinates use of hardware among various
applications and users
Application programs – define the ways in which the system
resources are used to solve the computing problems of the
users
Word processors, compilers, web browsers, database
systems, video games
Users
People, machines, other computers
Operating System Concepts – 9th Edition 1.3 Silberschatz, Galvin and Gagne ©2013
Four Components of a Computer System
Operating System Concepts – 9th Edition 1.4 Silberschatz, Galvin and Gagne ©2013
What Operating Systems Do
Depends on the point of view
Users want convenience, ease of use and good performance
Don’t care about resource utilization
But shared computer such as mainframe or minicomputer must
keep all users happy
Users of dedicate systems such as workstations have dedicated
resources but frequently use shared resources from servers
Handheld computers are resource poor, optimized for usability
and battery life
Some computers have little or no user interface, such as
embedded computers in devices and automobiles
Operating System Concepts – 9th Edition 1.5 Silberschatz, Galvin and Gagne ©2013
Operating System Definition
OS is a resource allocator
Manages all resources
Decides between conflicting requests for efficient and
fair resource use
OS is a control program
Controls execution of programs to prevent errors and
improper use of the computer
Operating System Concepts – 9th Edition 1.6 Silberschatz, Galvin and Gagne ©2013
Operating System Definition (Cont.)
No universally accepted definition
“Everything a vendor ships when you order an operating
system” is a good approximation
But varies wildly
“The one program running at all times on the computer” is the
kernel.
Everything else is either
a system program (ships with the operating system) , or
an application program.
Operating System Concepts – 9th Edition 1.7 Silberschatz, Galvin and Gagne ©2013
Computer Startup
bootstrap program is loaded at power-up or reboot
Typically stored in ROM or EPROM, generally known
as firmware
Initializes all aspects of system
Loads operating system kernel and starts execution
Operating System Concepts – 9th Edition 1.8 Silberschatz, Galvin and Gagne ©2013
Computer System Operation
Computer-system operation
A modern general-purpose computer system consists of one or
more CPUs and a number of device controllers connected
through a common bus that provides access to shared memory
Each device controller is in charge of a specific type of device (for
example, disk drives, audio devices, or video displays).
The CPU and the device controllers can execute in parallel,
competing for memory cycles.
To ensure orderly access to the shared memory, a memory
controller synchronizes access to the memory.
Operating System Concepts – 9th Edition 1.9 Silberschatz, Galvin and Gagne ©2013
Computer System Organization
Computer-system operation
Operating System Concepts – 9th Edition 1.10 Silberschatz, Galvin and Gagne ©2013
Computer-System Operation
When computer is powered up or rebooted—it needs to
have an initial program to run.
This initial program, or bootstrap program, is stored within
the computer hardware in read-only memory (ROM) or
electrically erasable programmable read-only memory
(EEPROM), known by the general term firmware.
It initializes all aspects of the system, from CPU registers to
device controllers to memory contents.
The bootstrap program must know how to load the operating
system and how to start executing that system.
To accomplish this goal, the bootstrap program must locate
the operating-system kernel and load it into memory
Operating System Concepts – 9th Edition 1.11 Silberschatz, Galvin and Gagne ©2013
Computer-System Operation
Once the kernel is loaded and executing, it can start
providing services to the system and its users.
Some services are provided outside of the kernel, by
system programs that are loaded into memory at boot time
to become system processes, or system daemons that run
the entire time the kernel is running.
Operating System Concepts – 9th Edition 1.12 Silberschatz, Galvin and Gagne ©2013
Services Provided by Operating Systems
Program development: services and utilities
Editors, compilers, linkers, debuggers, etc.
Program execution
Loading in memory, I/O and file initialization.
Access to I/O and files
Deals with the specifics of I/O and file formats.
System access
Resolves conflicts for resource conflict.
Protection in access to resources and data.
Error detection and response
Variety of errors may occur in computer system
Response may range from program termination, retrial of some
operation or reporting error to the application
Operating System Concepts – 9th Edition 1.13 Silberschatz, Galvin and Gagne ©2013
Services Provided by Operating Systems
Accounting
Collecting usage statistics
monitor performance
CPU usage
Operating System Concepts – 9th Edition 1.14 Silberschatz, Galvin and Gagne ©2013
Views of an Operating System
There are three classical views (in literature):
Resource Manager – manages and allocates resources.
Control program – controls the execution of user programs and
operations of I/O devices.
Command Executer – Provides an environment for running user
commands.
Operating System Concepts – 9th Edition 1.15 Silberschatz, Galvin and Gagne ©2013
OS as a resource manager
Process Management
A process is only ONE instant of a program in
execution.
There are many processes can be running the same
program.
The five major activities of an operating system in regard
to process management are:
Creation and deletion of user and system processes.
Suspension and resumption of processes.
A mechanism for process synchronization/organization.
A mechanism for process communication.
A mechanism for deadlock handling.
Operating System Concepts – 9th Edition 1.16 Silberschatz, Galvin and Gagne ©2013
Main-Memory Management
Main memory provides storage that can be accessed directly by the
CPU
(ie program to be executed it must be in the main memory)
The major activities of an operating system in regard to memory-
management are:
Keep track of which part of memory are currently being used and
by whom.
Decide which processes are loaded into memory when memory
space becomes available.
Allocate and de-allocate memory space as needed.
Operating System Concepts – 9th Edition 1.17 Silberschatz, Galvin and Gagne ©2013
File Management
A file is a collected of related information defined by its creator.
Computer can store files on the disk (secondary storage), which
provide long term storage.
Major activities of OS in regards to file management
The creation and deletion of files.
The creation and deletion of directions.
The support of primitives for manipulating files and directions.
The backup of files on stable storage media.
Operating System Concepts – 9th Edition 1.18 Silberschatz, Galvin and Gagne ©2013
I/O System Management
Operating system is to hide the peculiarity of specific hardware devices from
the user
Only the device drivers knows the peculiarities of the specific device driver
to whom it is assigned
Operating System Concepts – 9th Edition 1.19 Silberschatz, Galvin and Gagne ©2013
OS as a Control Program
Manages all the components of a complex computer system in an
integrated manner.
Controls the execution of user programs and I/O devices to prevent errors
and improper use of computer resources.
Looks over and protects the computer: Monitor, Supervisor, Executive,
Controller, Master, Coordinator ….
Operating System Concepts – 9th Edition 1.20 Silberschatz, Galvin and Gagne ©2013
Command Executer
Interfaces between the users and machine.
Supplies services/utilities to users.
Provides the users with a convenient CLI (Command
Language Interface), also called a Shell (in UNIX), for
entering the user commands.
Operating System Concepts – 9th Edition 1.21 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.22 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.23 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.24 Silberschatz, Galvin and Gagne ©2013
Operating System Concepts – 9th Edition 1.25 Silberschatz, Galvin and Gagne ©2013
Storage Structure
For a computer to do its job of executing programs, the programs must be in
main memory.
Main memory is the only large storage area that the processor can access
directly.
It is an array of bytes, ranging in size from millions to billions. Each byte in
memory has its own address.
The main memory is usually a volatile storage device that loses its contents
when power is turned off or lost.
Most computer systems provide secondary storage as an extension of main
memory.
Secondary storage provides a form of nonvolatile storage that is capable of
holding large quantities of data permanently.
Operating System Concepts – 9th Edition 1.26 Silberschatz, Galvin and Gagne ©2013
Storage Structure
The most common secondary-storage device is a magnetic disk, which
provides storage of both programs and data.
The wide variety of storage systems in a computer system can be organized
in a hierarchy according to speed and cost.
The higher levels are expensive, but they are fast.
As we move down the hierarchy, the cost per bit generally decreases,
whereas the access time generally increases.
Operating System Concepts – 9th Edition 1.27 Silberschatz, Galvin and Gagne ©2013
Storage-Device Hierarchy
Operating System Concepts – 9th Edition 1.28 Silberschatz, Galvin and Gagne ©2013
Computer-System Architecture
Most systems use a single general-purpose processor
Most systems have special-purpose processors as well
Multiprocessors systems growing in use and importance
Also known as parallel systems, tightly-coupled systems
Advantages include:
1. Increased throughput
2. Economy of scale
3. Increased reliability – graceful degradation or fault tolerance
Two types:
1. Asymmetric Multiprocessing – each processor is assigned a
specie task.
2. Symmetric Multiprocessing – each processor performs all tasks
Operating System Concepts – 9th Edition 1.29 Silberschatz, Galvin and Gagne ©2013
Computer-System Architecture
There are several different strategies for designing a computer system.
Single-processor systems have only one processor,
while multiprocessor systems contain two or more processors that share
physical memory and peripheral devices.
Multiprocessors systems growing in use and importance
Also known as parallel systems, tightly-coupled systems
Advantages include:
1. Increased throughput
By increasing the number of processors, we expect to get more work
done in less time.
Similarly, N programmers working closely together do not produce N
times the amount of work a single programmer would produce.
Operating System Concepts – 9th Edition 1.30 Silberschatz, Galvin and Gagne ©2013
Computer-System Architecture
2. Economy of scale
Multiprocessor systems can cost less than equivalent multiple single-
processor systems, because they can share peripherals, mass storage,
and power supplies.
If several programs operate on the same set of data, it is cheaper to
store those data on one disk and to have all the processors share them
than to have many computers with local disks and many copies of the
data.
3. Increased reliability
If functions can be distributed properly among several processors, then
the failure of one processor will not halt the system, only slow it down.
If we have ten processors and one fails, then each of the remaining
nine processors can pick up a share of the work of the failed processor.
Thus, the entire system runs only 10 percent slower, rather than failing
altogether.
Operating System Concepts – 9th Edition 1.31 Silberschatz, Galvin and Gagne ©2013
Computer-System Architecture
The multiple-processor systems in use today are of two types
1. Asymmetric Multiprocessing – each processor is assigned a specific
task.
2. Symmetric Multiprocessing – each processor performs all tasks
Operating System Concepts – 9th Edition 1.32 Silberschatz, Galvin and Gagne ©2013
Symmetric Multiprocessing Architecture
Operating System Concepts – 9th Edition 1.33 Silberschatz, Galvin and Gagne ©2013
Operating-System Structure
To best utilize the CPU, modern operating systems employ
multiprogramming, which allows several jobs to be in memory at the same
time, thus ensuring that the CPU always has a job to execute.
Time-sharing systems are an extension of multiprogramming where in CPU
scheduling algorithms rapidly switch between jobs, thus providing the
illusion that each job is running concurrently.
Operating System Concepts – 9th Edition 1.34 Silberschatz, Galvin and Gagne ©2013
Operating System Structure
Multiprogramming (Batch system) needed for efficiency
Single user cannot keep CPU and I/O devices busy at all times
Multiprogramming organizes jobs (code and data) so CPU always has one to
execute
A subset of total jobs in system is kept in memory
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS switches to another job
Timesharing (multitasking) is logical extension in which CPU switches jobs
so frequently that users can interact with each job while it is running, creating
interactive computing
Response time should be < 1 second
Each user has at least one program executing in memory process
If several jobs ready to run at the same time CPU scheduling
If processes don’t fit in memory, swapping moves them in and out to run
Virtual memory allows execution of processes not completely in memory
Operating System Concepts – 9th Edition 1.35 Silberschatz, Galvin and Gagne ©2013
Memory Layout for Multiprogrammed System
Operating System Concepts – 9th Edition 1.36 Silberschatz, Galvin and Gagne ©2013