Chapter 1 Introduction
Chapter 1 Introduction
Operating System Concepts – 8th Edition, Silberschatz, Galvin and Gagne ©2009
Chapter 1: Introduction
Operating System Concepts – 8th Edition 1.2 Silberschatz, Galvin and Gagne ©2009
Objectives
Operating System Concepts – 8th Edition 1.3 Silberschatz, Galvin and Gagne ©2009
What is an Operating System?
An operating system is a program that
manages the computer hardware. It also
provides a basis for application
programs and acts as an intermediary
between the computer user and the
computer hardware.
Operating System Concepts – 8th Edition 1.4 Silberschatz, Galvin and Gagne ©2009
Operating System Goals
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 – 8th Edition 1.5 Silberschatz, Galvin and Gagne ©2009
Computer System Structure
Computer system can be divided into four
components
Hardware – provides the basic
computing resources for the system
CPU, memory, I/O devices
Operating system
Controls the hardware and
coordinates its use among the various
application programs for the various
users.
Operating System Concepts – 8th Edition 1.6 Silberschatz, Galvin and Gagne ©2009
Computer System Structure
Application programs – define the
ways in which the system resources
are used to solve the computing
problems of the users
Word processors, spreadsheets,
compilers, web browsers, database
systems, video games
Users
People, machines, other computers
Operating System Concepts – 8th Edition 1.7 Silberschatz, Galvin and Gagne ©2009
Four Components of a Computer System
Operating System Concepts – 8th Edition 1.8 Silberschatz, Galvin and Gagne ©2009
User View of Operating Systems
The user’s view of the computer varies according
to the interface being used. Most computer users
sit in front of a PC, consisting of a monitor,
keyboard, mouse, and system unit.
Such a system is designed for one user to
monopolize its resources. The goal is to maximize
the work that the user is performing.
In this case, the operating system is designed
mostly for ease of use, with some attention paid to
performance and none paid to resource
utilization—how various hardware and software
resources are shared.
Operating System Concepts – 8th Edition 1.9 Silberschatz, Galvin and Gagne ©2009
User View (cont…)
In other cases, a user sits at a terminal
connected to a mainframe or a minicomputer.
Other users are accessing the same computer
through other terminals.
These users share resources and may exchange
information. The operating system in such cases
is designed to maximize resource utilization—to
assure that all available CPU time, memory, and
I/O are used efficiently, and that no individual user
takes more than her fair share.
Operating System Concepts – 8th Edition 1.10 Silberschatz, Galvin and Gagne ©2009
System View of Operating Systems
From the computer’s point of view, the
operating system is the program
involved with the hardware. In this
context, we can view an operating system
as a resource allocator.
A computer system has many resources
that may be required to solve a problem:
CPU time, memory space, file-storage
space, I/O devices, and so on.
Operating System Concepts – 8th Edition 1.11 Silberschatz, Galvin and Gagne ©2009
System View (cont…)
The operating system acts as the
manager of these resources. Facing
numerous and possibly conflicting
requests for resources, the operating
system must decide how to allocate them
to specific programs and users so that it
can operate the computer system
efficiently and fairly
Operating System Concepts – 8th Edition 1.12 Silberschatz, Galvin and Gagne ©2009
System View (cont…)
Resource allocation is especially important
where many users access the same mainframe
or minicomputer.
A slightly different view of an operating system
emphasizes the need to control the various I/O
devices and user programs. An operating
system is a control program.
A control program manages the execution of
user programs to prevent errors and improper
use of the computer. It is especially concerned
with the operation and control of I/O devices.
Operating System Concepts – 8th Edition 1.13 Silberschatz, Galvin and Gagne ©2009
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 – 8th Edition 1.14 Silberschatz, Galvin and Gagne ©2009
Operating System Definition (Cont)
OS is the one program running at all
times on the computer (the kernel).
Everything else is either a system
programs (ships with the operating
system) or an application programs.
Operating System Concepts – 8th Edition 1.15 Silberschatz, Galvin and Gagne ©2009
Computer Startup
bootstrap program initial program that is
loaded at power-up or reboot
Typically stored in ROM or EPROM,
generally known as firmware
Initializes all aspects of the system from
CPU registers to device controllers to
memory contents.
Locates and loads operating system
kernel and starts execution
Operating System Concepts – 8th Edition 1.16 Silberschatz, Galvin and Gagne ©2009
Computer System Organization
One or more CPUs, device controllers connect through
common bus providing access to shared memory.
Concurrent execution of CPUs and devices competing
for memory cycles.
Operating System Concepts – 8th Edition 1.17 Silberschatz, Galvin and Gagne ©2009
Computer-System Operation
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
Operating System Concepts – 8th Edition 1.18 Silberschatz, Galvin and Gagne ©2009
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 must be disabled if there is an
interrupt currently being processed. This is to prevent
interrupts from being lost or overwritten by newly arriving
interrupts.
An operating system is interrupt driven. This means
that if there are no interrupts, then the system will be
idle.
Operating System Concepts – 8th Edition 1.19 Silberschatz, Galvin and Gagne ©2009
Storage Structure
Main memory is a large volatile (temporary)
storage media that the CPU can access directly.
Secondary storage – extension of main memory
that provides larger nonvolatile (permanent)
storage capacity.
The most common secondary-storage device is
a magnetic disk, which provides storage for both
programs and data. Most programs (system and
application) are stored on a disk until they are
loaded into memory. Many programs then use
the disk as both the source and the destination
of their processing.
Operating System Concepts – 8th Edition 1.20 Silberschatz, Galvin and Gagne ©2009
Storage Structure (cont…)
Magnetic disks is a rigid metal or glass platters
covered with magnetic recording material.
Disk surface is logically divided into tracks,
which are subdivided into sectors
The disk controller determines the logical
interaction between the device and the
computer
The main differences among the various storage
systems lie in speed, cost, size, and volatility.
Operating System Concepts – 8th Edition 1.21 Silberschatz, Galvin and Gagne ©2009
Storage-Device Hierarchy
Operating System Concepts – 8th Edition 1.22 Silberschatz, Galvin and Gagne ©2009
Storage Structure (cont…)
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 – 8th Edition 1.23 Silberschatz, Galvin and Gagne ©2009
Storage Structure (cont…)
The design of a complete memory
system must balance all the factors just
discussed: it must use only as much
expensive memory as necessary while
providing as much inexpensive,
nonvolatile memory as possible.
Operating System Concepts – 8th Edition 1.24 Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
Most systems use a single general-purpose
processor (PDAs through mainframes).
Most systems have special-purpose
processors as well.
Multiprocessors systems growing in use and
importance
Also known as parallel systems, tightly-
coupled systems
Have two or more processors in close
communication, sharing the computer bus,
memory, and peripheral devices.
Operating System Concepts – 8th Edition 1.25 Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
Multiprocessor system advantages:
1. Increased throughput: By increasing the
number of processors, we expect to get more
work done in less time.
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.
3. Increased reliability –fault tolerance: If functions
can be distributed properly among several
processors, then the failure of one processor will
not halt the system, only slow it down.
Operating System Concepts – 8th Edition 1.26 Silberschatz, Galvin and Gagne ©2009
Computer-System Architecture
Two types of multiple-processor systems:
1. Asymmetric Multiprocessing: each processor
is assigned a specific task. A master
processor controls the system; the other
processors either look to the master for
instruction or have predefined tasks. This
scheme defines a master–slave relationship.
2. Symmetric Multiprocessing: each processor
performs all tasks within the operating
system, all processors are peers; no
master–slave relationship exists between
processors.
Operating System Concepts – 8th Edition 1.27 Silberschatz, Galvin and Gagne ©2009
Symmetric Multiprocessing Architecture
Operating System Concepts – 8th Edition 1.28 Silberschatz, Galvin and Gagne ©2009
A Dual-Core Design
Operating System Concepts – 8th Edition 1.29 Silberschatz, Galvin and Gagne ©2009
Operating System Structure
Multiprogramming needed for efficiency
Single program cannot keep CPU and I/O
devices busy at all times. Single users
frequently have multiple programs running.
Multiprogramming increases CPU utilization
by organizing jobs (code and data) so CPU
always has one to execute.
The operating system keeps several jobs in
memory simultaneously.
Since main memory is too small to
accommodate all jobs, the jobs are kept
initially on the disk in the job pool.
Operating System Concepts – 8th Edition 1.30 Silberschatz, Galvin and Gagne ©2009
Operating System Structure (cont…)
This pool consists of all
processes residing on disk
awaiting allocation of main
memory.
One job selected and run job
scheduling
When it has to wait (for I/O for
example), OS switches to
another job.
As long as at least one job needs
to execute, the CPU is never
idle.
Operating System Concepts – 8th Edition 1.31 Silberschatz, Galvin and Gagne ©2009
Operating System Structure (cont…)
Time sharing (multitasking) is logical extension of
multiprogramming 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 of main memory to the disk to run.
swapping is a technique that allows the execution of
a process that is not completely in memory.
Operating System Concepts – 8th Edition 1.32 Silberschatz, Galvin and Gagne ©2009
Operating System Structure (cont…)
A time-shared operating system allows many
users to share the computer simultaneously.
Since each action or command in a time-shared
system tends to be short, only a little CPU time
is needed for each user.
As the system switches rapidly from one user to
the next, each user is given the impression that
the entire computer system is dedicated to his
use, even though it is being shared among many
users.
Multitasking is Multiprogramming with time-
sharing.
Operating System Concepts – 8th Edition 1.33 Silberschatz, Galvin and Gagne ©2009
Operating System Operations
Modern operating systems are interrupt driven. If
there are no processes to execute, no I/O
devices to service, and no users to whom to
respond, an operating system will sit quietly,
waiting for something to happen.
Events are almost always signaled by the
occurrence of an interrupt or a trap. A trap (or an
exception) is a software-generated interrupt
caused by an error.
Division by zero, invalid memory access.
Operating System Concepts – 8th Edition 1.34 Silberschatz, Galvin and Gagne ©2009
Operating System Operations (cont…)
Other process problems include infinite loop,
processes modifying each other or the operating
system.
In order to ensure the proper execution of the
operating system, we must be able to distinguish
between the execution of operating-system code
and user defined code.
Operating System Concepts – 8th Edition 1.35 Silberschatz, Galvin and Gagne ©2009
Operating System Operations (cont…)
Dual-mode operation allows OS to protect itself and
other system components.
User mode and kernel mode (supervisor mode,
system mode, or privileged mode).
Mode bit: a bit is added to the hardware of the
computer to indicate the current mode: kernel (0)
or user (1).
Provides ability to distinguish when system is
running user code or kernel code.
Some instructions designated as privileged,
only executable in kernel mode.
System call changes mode to kernel, return
from call resets it to user.
Operating System Concepts – 8th Edition 1.36 Silberschatz, Galvin and Gagne ©2009
Transition from User to Kernel Mode
The dual mode of operation provides us with the means
for protecting the operating system from errant users—
and errant users from one another.
We must ensure that the operating system maintains
control over the CPU. A timer can be set to interrupt the
computer after a specified period to prevent infinite loop /
process hogging resources.
Operating System Concepts – 8th Edition 1.37 Silberschatz, Galvin and Gagne ©2009
Operating System Operations
Process Management
Memory Management
File Management
Mass-Storage Management
I/O Subsystem Management
Protection and Security
Operating System Concepts – 8th Edition 1.38 Silberschatz, Galvin and Gagne ©2009
Process Management
A program does nothing unless its instructions
are executed by a CPU.
A process is a program in execution. It is a unit
of work within the system. Program is a passive
entity; process is an active entity.
Process needs resources to accomplish its task
CPU, memory, I/O, files
Initialization data
Process termination requires reclaim of any
reusable resources
Operating System Concepts – 8th Edition 1.39 Silberschatz, Galvin and Gagne ©2009
Process Management (cont…)
Single-threaded process has one program
counter specifying location of next instruction to
execute.
Process executes instructions sequentially,
one at a time, until completion.
Multi-threaded process has one program
counter per thread.
Typically, system has many processes, some
user, some operating system running
concurrently on one or more CPUs.
Concurrency by multiplexing the CPUs among
the processes / threads.
Operating System Concepts – 8th Edition 1.40 Silberschatz, Galvin and Gagne ©2009
Process Management Activities
The operating system is responsible for the following
activities in connection with process management:
Creating and deleting both user and system
processes
Suspending and resuming processes
Providing mechanisms for process
synchronization
Providing mechanisms for process
communication
Providing mechanisms for deadlock handling
Operating System Concepts – 8th Edition 1.41 Silberschatz, Galvin and Gagne ©2009
Memory Management
A program does nothing unless its instructions are executed
by a CPU. All data in memory before and after processing
All instructions in memory in order to be executed
Memory management determines what is in memory when
Optimizing CPU utilization and computer response to
users.
OS Memory management activities
Keeping track of which parts of memory are currently being
used and by whom.
Deciding which processes and data to move into and out
of memory.
Allocating and deallocating memory space as needed.
Operating System Concepts – 8th Edition 1.42 Silberschatz, Galvin and Gagne ©2009
File Management
To make the computer system convenient for users,
the operating system provides a uniform, logical
view of information storage. The operating system
abstracts from the physical properties of its storage
devices to define a logical storage unit, the file.
File management is one of the most visible
components of an operating system. Computers
can store information on several different types of
physical media.
Each medium is controlled by device that has its
own unique characteristics such as access
speed, capacity, data-transfer rate, access
method (sequential or random).
Operating System Concepts – 8th Edition 1.43 Silberschatz, Galvin and Gagne ©2009
File Management (cont…)
A file is a collection of related information defined
by its creator. Commonly, files represent programs
(both source and object forms) and data.
When multiple users have access to files, it may be
desirable to control by whom and in what ways (for
example, read, write, append) files may be
accessed.
File-System management
Files usually organized into directories
Access control on most systems to determine
who can access what
Operating System Concepts – 8th Edition 1.44 Silberschatz, Galvin and Gagne ©2009
File Management (cont…)
OS File management activities include:
Creating and deleting files and directors
Supporting primitives to manipulate files
and directors
Mapping files onto secondary storage
Backup files onto stable (non-volatile)
storage media
Operating System Concepts – 8th Edition 1.45 Silberschatz, Galvin and Gagne ©2009
Mass-Storage Management
Usually, disks used to store data that does not
fit in main memory or data that must be kept for
a “long” period of time.
Proper management is of central importance to
a computer system.
OS mass storage management activities:
Free-space management
Storage allocation
Disk scheduling
Operating System Concepts – 8th Edition 1.46 Silberschatz, Galvin and Gagne ©2009
Mass-Storage Management (cont…)
Because secondary storage is used frequently, it
must be used efficiently. The entire speed of
operation of a computer may hinge on the
speeds of the disk subsystem and the
algorithms that manipulate that subsystem.
Some storage need not be fast
Tertiary storage includes optical storage,
magnetic tape
Still must be managed
Varies between WORM (write-once, read-
many-times) and RW (read-write).
Operating System Concepts – 8th Edition 1.47 Silberschatz, Galvin and Gagne ©2009
Caching
Caching – copying information into faster
storage system; main memory can be viewed as
a fast cache for secondary storage, since data in
secondary storage must be copied into main
memory for use, and data must be in main
memory before being moved to secondary
storage for safekeeping.
Information in use copied from slower to faster
storage temporarily.
Operating System Concepts – 8th Edition 1.48 Silberschatz, Galvin and Gagne ©2009
Caching (cont…)
Faster storage (cache) checked first to
determine if information is there.
If it is, information used directly from the
cache (fast).
If not, data copied to cache and used there.
Cache smaller than storage being cached
Cache management important design
problem.
Cache size and replacement policy.
Operating System Concepts – 8th Edition 1.49 Silberschatz, Galvin and Gagne ©2009
Caching (cont…)
Careful selection of the cache size and of a
replacement policy can result in greatly
increased performance.
Movement between levels of storage hierarchy
can be explicit or implicit depending on the
hardware design and the controlling operating-
system software. For instance, data transfer
from cache to CPU and registers is usually a
hardware function, with no operating system
intervention. In contrast, transfer of data from
disk to memory is usually controlled by the
operating system.
Operating System Concepts – 8th Edition 1.50 Silberschatz, Galvin and Gagne ©2009
Performance of Various Levels of Storage
Operating System Concepts – 8th Edition 1.51 Silberschatz, Galvin and Gagne ©2009
I/O Subsystem Management
One purpose of OS is to hide peculiarities of
hardware devices from the user.
The I/O subsystem consists of several
components:
Memory management of I/O including
buffering (storing data temporarily while it is
being transferred), caching (storing parts of
data in faster storage for performance),
spooling (the overlapping of output of one job
with input of other jobs).
A general device-driver interface
Operating System Concepts – 8th Edition 1.52 Silberschatz, Galvin and Gagne ©2009
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
attacks (use all system’s resources and so
keep legitimate users out of the system),
worms, viruses, identity theft (someone
steals your personal information to commit
fraud), theft of service (unauthorized use of a
system).
Operating System Concepts – 8th Edition 1.53 Silberschatz, Galvin and Gagne ©2009
Protection and Security (cont…)
Systems generally first distinguish among users,
to determine who can do what
User identities (user IDs) include name and
associated number, one per user
User ID then associated with all files,
processes of that user to determine access
control
Group identifier (group ID) allows set of users
to be defined and controls managed, then
also associated with each process, file
Privilege escalation allows user to change to
effective ID with more rights
Operating System Concepts – 8th Edition 1.54 Silberschatz, Galvin and Gagne ©2009
Computing Environments
Office environment
Home networks
Client-Server Computing
Peer-to-Peer Computing
Web-Based Computing
Operating System Concepts – 8th Edition 1.55 Silberschatz, Galvin and Gagne ©2009
Computing Environments
Traditional computer
Office environment
PCs connected to a network, terminals
attached to mainframe or minicomputers
providing timesharing
Now portals allowing networked and remote
systems access to same resources
Home networks
Used to be single system, then modems
Now firewalled, networked
Operating System Concepts – 8th Edition 1.56 Silberschatz, Galvin and Gagne ©2009
Computing Environments (Cont)
Client-Server Computing
Dumb terminals supplanted by smart PCs
Many systems now servers, responding to requests
generated by clients
Compute-server provides an interface to client to
request services (i.e. database)
File-server provides interface for clients to store
and retrieve files
Operating System Concepts – 8th Edition 1.57 Silberschatz, Galvin and Gagne ©2009
Peer-to-Peer Computing
Another model of distributed system
P2P does not distinguish clients and
servers
Instead, all nodes are considered peers
May each act as client, server or both
Node must join P2P network
Operating System Concepts – 8th Edition 1.58 Silberschatz, Galvin and Gagne ©2009
Web-Based Computing
Web has become global
PCs most prevalent devices
More devices becoming networked to allow web
access
New category of devices to manage web traffic
among similar servers: load balancers
Use of operating systems like Windows 95,
client-side, have evolved into Linux and
Windows 10, which can be clients and servers
Operating System Concepts – 8th Edition 1.59 Silberschatz, Galvin and Gagne ©2009
Open-Source Operating Systems
Operating systems made available in
source-code format rather than just binary
closed-source
Counter to the copy protection and Digital
Rights Management (DRM) movement
Started by Free Software Foundation
(FSF), which has “copyleft”
Operating System Concepts – 8th Edition 1.60 Silberschatz, Galvin and Gagne ©2009
End of Chapter 1
Operating System Concepts – 8th Edition, Silberschatz, Galvin and Gagne ©2009