Chapter 1: Introduction
•Operating System Concepts – 9th •Silberschatz, Galvin and Gagne ©2013
Contents
● What Operating Systems Do
● Computer-System Organization
● Computer-System Architecture
● Operating-System Structure
● Operating-System Operations
● Computing Environments
● Open-Source Operating Systems
•Operating System Concepts – 9th •1.2 •Silberschatz, Galvin and Gagne ©2013
Objectives
● To describe the basic organization of computer systems
● To provide a grand tour of the major components of
operating systems
● To give an overview of the many types of computing
environments
● To explore several open-source operating systems
•Operating System Concepts – 9th •1.3 •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 •1.4 •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 •1.5 •Silberschatz, Galvin and Gagne ©2013
Von Neumann Architecture
•Operating System Concepts – 9th •1.6 •Silberschatz, Galvin and Gagne ©2013
Four Components of a Computer System
•Operating System Concepts – 9th •1.7 •Silberschatz, Galvin and Gagne ©2013
What Operating Systems Do
Depends on the point of view
●Users want convenience, ease of use
●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 •1.8 •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 •1.9 •Silberschatz, Galvin and Gagne ©2013
Operating System Definition (Cont.)
No universally accepted definition
●“The one program running at all times on the
computer” is the kernel such as, disk driver, command
prompt.
●Everything else is either a system program (ships
with the operating system) or an application program.
•Operating System Concepts – 9th •1.10 •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
● EEPROM -> Electrically Erasable Programmable Read-
only Memory
● EROM -> Erasable Programmable Read-only Memory
●Initializes all aspects of system
●Loads operating system kernel and starts execution
•Operating System Concepts – 9th •1.11 •Silberschatz, Galvin and Gagne ©2013
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 – 9th •1.12 •Silberschatz, Galvin and Gagne ©2013
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 – 9th •1.13 •Silberschatz, Galvin and Gagne ©2013
What is Interrupt?
● An interrupt is a signal to the processor emitted by
hardware or software indicating an event that needs
immediate attention.
● It temporarily halts the CPU’s current execution flow to
address the event, ensuring the operating system can handle
critical tasks in real-time.
•Operating System Concepts – 9th •1.14 •Silberschatz, Galvin and Gagne ©2013
Interrupt Handling
● The CPU saves the state of the current task (the task it was
executing before the interrupt) in a special place, like a stack. This
includes:
Program Counter (PC): The address of the next instruction to
execute.
Registers: The values in the CPU’s working registers
(temporary data).
● Determines which type of interrupt has occurred:
polling, vectored interrupt system
● Separate segments of code determine what action should be taken
for each type of interrupt and this is called Interrupt Service
Routine (ISR)
•Operating System Concepts – 9th •1.15 •Silberschatz, Galvin and Gagne ©2013
Interrupt Handling
Polling and vectored interrupts are two mechanisms for handling hardware events in an operating
system.
Polling is a process where the CPU repeatedly checks a device to see if it needs attention (e.g., if it
has data to process).
How It Works:
1. The CPU periodically queries the status of each device to check if it needs servicing.
2. If a device signals it has work (e.g., data ready to be read), the CPU handles it; otherwise, the
CPU continues checking other devices.
Characteristics:
● Efficiency: Inefficient, as the CPU wastes time checking devices even when no device needs
service.
● Predictability: Easy to implement and predictable but not suitable for time-sensitive tasks.
● Use Case: Suitable for systems with low hardware demands or when predictability is more
critical than efficiency.
•Operating System Concepts – 9th •1.16 •Silberschatz, Galvin and Gagne ©2013
Interrupt Handling
Vectored interrupts are a method where a device signals the CPU when it needs attention, and the
CPU jumps to a specific "interrupt service routine" (ISR) associated with that device.
How It Works:
1. A device generates an interrupt signal to the CPU when it needs attention.
2. The CPU identifies the source of the interrupt (using a unique vector for each device).
3. The CPU executes the ISR specific to the interrupting device.
4. After servicing, the CPU resumes its previous tasks.
Characteristics:
● Efficiency: More efficient than polling, as the CPU doesn't waste time checking devices
unnecessarily.
● Speed: Faster response to events because the interrupt directs the CPU immediately to the
device.
● Use Case: Common in modern systems for handling multiple devices.
•Operating System Concepts – 9th •1.17 •Silberschatz, Galvin and Gagne ©2013
Common Functions of Interrupts
●Interrupt transfers control to the interrupt service routine
generally, through the interrupt vector table, which contains the
addresses of all the service routines
●Interrupt architecture must save the address of the
interrupted instruction
Once the interrupt is serviced, the CPU resumes its prior
operations.
●A trap or exception is a software-generated interrupt caused
either by an error or a user request
•Operating System Concepts – 9th •1.18 •Silberschatz, Galvin and Gagne ©2013
Common Functions of Interrupts
An operating system is interrupt driven which means the system
responds to events (like input from devices or software requests)
via interrupts instead of continuously checking (polling) for
them.
Example:
When you press a key on the keyboard, the operating system gets
interrupted, processes the key press, and then returns to its
previous work, rather than constantly checking if a key was
pressed.
•Operating System Concepts – 9th •1.19 •Silberschatz, Galvin and Gagne ©2013
Direct Memory Access Structure
●Used for high-speed I/O devices able to transmit
information at close to memory speeds
●Device controller transfers blocks of data from buffer
storage directly to main memory without CPU intervention
●Only one interrupt is generated per block, rather than the
one interrupt per byte
•Operating System Concepts – 9th •1.20 •Silberschatz, Galvin and Gagne ©2013
How a Modern Computer Works
A von Neumann architecture
•Operating System Concepts – 9th •1.21 •Silberschatz, Galvin and Gagne ©2013
Batch Operating System
The users of batch operating system do not interact with the computer
directly. Each user prepares his job on an offline device like punch cards
and submits it to the computer operator.
To speed up processing, jobs with similar needs are batched together and
run as a group.
The programmers leave their programs with the operator and the operator
sorts programs into batches with similar requirements.
The problems with Batch Systems are following,
● Lack of interaction between the user and job.
● CPU is often idle, because the speeds of the mechanical I/O devices
are slower than CPU.
● Difficult to provide the desired priority.
•Operating System Concepts – 9th •1.22 •Silberschatz, Galvin and Gagne ©2013
Operating System Structure
Multiprogramming is 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 the total jobs in system is kept in memory
●One job is 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
Processor's time which is shared among multiple users simultaneously is
termed as time-sharing.
•Operating System Concepts – 9th •1.23 •Silberschatz, Galvin and Gagne ©2013
Time Sharing or Multitasking
Time-sharing (also known as multitasking) is a method where multiple programs or processes share
CPU time in such a way that they appear to be running simultaneously. The operating system
switches between tasks rapidly, giving each process a small time slice or quantum to execute, making
it seem like all tasks are running at the same time.
How Time-sharing Works:
Multiple Processes: Several programs (or processes) are loaded into memory at once, such as a web
browser, text editor, and media player.
CPU Time Slice: Each process gets a time slice, a small unit of CPU time (e.g., a few milliseconds)
to execute.
Context Switching: When the time slice for one process ends, the CPU switches to another
process. This process of saving the state of one process and loading the state of the next is called
context switching.
Fair CPU Allocation: The operating system schedules tasks efficiently, ensuring that all processes get
a fair share of CPU time. This happens so fast that it gives the illusion that all programs are running
simultaneously.
•Operating System Concepts – 9th •1.24 •Silberschatz, Galvin and Gagne ©2013
Memory Layout for Multiprogrammed System
•Operating System Concepts – 9th •1.25 •Silberschatz, Galvin and Gagne ©2013
Difference
Objective:
● Time-sharing: Aims to provide a responsive user experience by rapidly
switching between tasks.
● Multiprogramming: Aims to maximize CPU utilization by keeping the CPU
busy with multiple programs.
Scheduling:
● Time-sharing: Uses preemptive scheduling to ensure fair access to the CPU.
● Multiprogramming: May use non-preemptive scheduling, focusing on process
completion or I/O operations.
Self Study
Differences between Time sharing and Multiprogramming.
•Operating System Concepts – 9th •1.26 •Silberschatz, Galvin and Gagne ©2013
Additional Information
● 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 •1.27 •Silberschatz, Galvin and Gagne ©2013
Operating-System Operations
Interrupt driven by hardware
When?
Software error or request creates exception or trap
A trap is a synchronous interrupt triggered by an exception in a user process
What kind of errors?
Division by zero, request for operating system service
Other process problems include infinite loop, invalid memory access,
processes modifying each other or the operating system
●Dual-mode operation allows OS to protect itself and other system
components
User mode and kernel mode
Mode bit provided by hardware
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 and return from call resets it
to the user mode
•Operating System Concepts – 9th •1.28 •Silberschatz, Galvin and Gagne ©2013
Transition from User to Kernel Mode
Timer to prevent infinite loop / process hogging resources
● Set interrupt after specific period
● Operating system decrements counter
● When counter zero generate an interrupt
● Set up before scheduling process to regain control or
terminate program that exceeds allotted time
•Operating System Concepts – 9th •1.29 •Silberschatz, Galvin and Gagne ©2013
Computing Environments – Cloud Computing
● Delivers computing, storage, even apps as a service across a network
● Logical extension of virtualization as based on virtualization
●Amazon EC2 has thousands of servers, millions of VMs, PBs of
storage available across the Internet, pay based on usage
●Many types
●Public Cloud – available via Internet to anyone willing to pay
●Private Cloud – run by a company for the company’s own use
●Hybrid Cloud – includes both public and private cloud components
●Software as a Service (SaaS) – one or more applications available
via the Internet (i.e. word processor)
●Platform as a Service (PaaS) – software stack ready for application
use via the Internet (i.e a database server)
●Infrastructure as a Service (IaaS) – servers or storage available over
Internet (i.e. storage available for backup use)
•Operating System Concepts – 9th •1.30 •Silberschatz, Galvin and Gagne ©2013
Computing Environments – Cloud Computing
●Cloud compute environments composed of traditional OSes, plus VMMs,
plus cloud management tools
●Internet connectivity requires security like firewalls
●Load balancers spread traffic across multiple applications
•Operating System Concepts – 9th •1.31 •Silberschatz, Galvin and Gagne ©2013
Computing Environments – Real-Time Systems
● Real-time embedded systems most prevalent form of computers
●Vary considerable, special purpose, limited purpose OS, real-time OS
●Use expanding
● Many other special computing environments as well
● Some have OSes, some perform tasks without an OS
● Real-time OS has well-defined fixed time constraints
● Processing must be done within constraint
● Correct operation only if constraints met
For example Scientific experiments, medical imaging systems, industrial control
systems, weapon systems, robots, and home-appliance controllers, Air traffic
control system etc.
•Operating System Concepts – 9th •1.32 •Silberschatz, Galvin and Gagne ©2013
Computing Environments – Real-Time Systems
There are two types of real-time operating systems.
Hard real-time systems
Hard real-time systems guarantee that critical tasks complete on time. In hard
real-time systems secondary storage is limited or missing with data stored in ROM.
In these systems virtual memory is almost never found.
Soft real-time systems
Soft real time systems are less restrictive. Critical real-time task gets priority over
other tasks and retains the priority until it completes. Soft real-time systems have
limited utility than hard real-time systems.
For example, Multimedia, virtual reality, Advanced Scientific Projects like
undersea exploration and planetary rovers etc.
•Operating System Concepts – 9th •1.33 •Silberschatz, Galvin and Gagne ©2013
Distributed Operating System
Distributed systems use multiple central
processors to serve multiple real time application
and multiple users.
Data processing jobs are distributed among the
processors accordingly to which one can perform
each job most efficiently.
•Operating System Concepts – 9th •1.34 •Silberschatz, Galvin and Gagne ©2013
Distributed Operating System
The advantages of distributed systems are following:
1. With resource sharing facility user at one site may be
able to use the resources available at another.
2. Speedup the exchange of data with one another via
electronic mail.
3. If one site fails in a distributed system, the remaining sites can
potentially continue operating.
4. Better service to the customers.
5. Reduction of the load on the host computer.
6. Reduction of delays in data processing.
•Operating System Concepts – 9th •1.35 •Silberschatz, Galvin and Gagne ©2013
Network operating System
Network Operating System runs on a server and and provides server the
capability to manage data, users, groups, security, applications, and other
networking functions.
The primary purpose of the network operating system is to allow shared file
and printer access among multiple computers in a network, typically a local area
network (LAN), a private network or to other networks.
Examples of network operating systems are Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and
BSD.
•Operating System Concepts – 9th •1.36 •Silberschatz, Galvin and Gagne ©2013
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” GNU
Public License (GPL)
Examples include GNU/Linux and BSD UNIX (including core of Mac OS
X), and many more
Can use VMM like VMware Player (Free on Windows), Virtualbox (open
source and free on many platforms - [Link]
Use to run guest operating systems for exploration
•Operating System Concepts – 9th •1.37 •Silberschatz, Galvin and Gagne ©2013
End of Chapter 1
•Operating System Concepts – 9th •Silberschatz, Galvin and Gagne ©2013