Chapter 1: Introduction
Shatabdi Roy Moon
Lecturer
East West University
Introduction
What Operating Systems Do:
Computer-System Organization
Computer-System Architecture
Operating-System Structure
Operating-System Operations
Process Management
Memory Management
Storage Management
Protection and Security
Kernel Data Structures
Computing Environments
Operating System Concepts 1.2 Silberschatz, Galvin and Gagne ©2005
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
Operating System Concepts 1.3 Silberschatz, Galvin and Gagne ©2005
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 1.4 Silberschatz, Galvin and Gagne ©2005
Software
The two most common types of software are :
•System software
•Application software.
What is System Software?
System Software refers to the operating system and all
utility programs that manage computer resources at a low
level. Systems software includes compilers, loaders,
linkers, and debuggers.
What is Application Software?
Applications software comprises programs designed for an
end user, such as word processors, database systems,
and spreadsheet programs.
Operating System Concepts 1.5 Silberschatz, Galvin and Gagne ©2005
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 1.6 Silberschatz, Galvin and Gagne ©2005
Four Components of a Computer System
Operating System Concepts 1.7 Silberschatz, Galvin and Gagne ©2005
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 1.8 Silberschatz, Galvin and Gagne ©2005
Operating System Definition (Cont.)
No universally accepted definition
“Everything a vendor ships when you order an
operating system” is 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 1.9 Silberschatz, Galvin and Gagne ©2005
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 1.10 Silberschatz, Galvin and Gagne ©2005
Computer System Organization
Computer-system operation
One or more CPUs, Memory, device controllers connect
through a common bus which is called system bus.
Operating System Concepts 1.11 Silberschatz, Galvin and Gagne ©2005
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
Device controller informs CPU that it has finished its
operation by causing an interrupt.
Operating System Concepts 1.12 Silberschatz, Galvin and Gagne ©2005
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
A trap or exception is a software-generated interrupt
caused either by an error or a user request
An operating system is interrupt driven
Operating System Concepts 1.13 Silberschatz, Galvin and Gagne ©2005
Interrupt Handling
The operating system preserves the state of the
CPU by storing registers and the program counter
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
Operating System Concepts 1.14 Silberschatz, Galvin and Gagne ©2005
Storage Structure
Main memory – only large storage media that the CPU can access
directly.
Secondary storage – extension of main memory that provides
large nonvolatile storage capacity.
Magnetic disks – 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.
Magnetic Tapes
Operating System Concepts 1.15 Silberschatz, Galvin and Gagne ©2005
Storage Hierarchy
Storage systems organized in hierarchy.
Speed
Cost
Volatility
Size
Caching – Information in use copied from slower to faster
storage temporarily
Operating System Concepts 1.16 Silberschatz, Galvin and Gagne ©2005
Storage-Device Hierarchy
Operating System Concepts 1.17 Silberschatz, Galvin and Gagne ©2005
Performance of Various Levels of Storage
Movement between levels of storage hierarchy can be explicit or
implicit
Operating System Concepts 1.18 Silberschatz, Galvin and Gagne ©2005
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 1.19 Silberschatz, Galvin and Gagne ©2005
How a Modern Computer Works
Operating System Concepts 1.20 Silberschatz, Galvin and Gagne ©2005
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
specific task.
2. Symmetric Multiprocessing – each processor performs all
tasks
Operating System Concepts 1.21 Silberschatz, Galvin and Gagne ©2005
Symmetric Multiprocessing Architecture
Operating System Concepts 1.22 Silberschatz, Galvin and Gagne ©2005
A Dual-Core Design
Multi-chip and multicore
Systems containing all chips
Chassis containing multiple separate systems
Operating System Concepts 1.23 Silberschatz, Galvin and Gagne ©2005
Clustered Systems
Like multiprocessor systems, but multiple systems working
together
Usually sharing storage via a storage-area network (SAN)
Provides a high-availability service which survives failures
Asymmetric clustering has one machine in hot-standby
mode
Symmetric clustering has multiple nodes running
applications, monitoring each other
Some clusters are for high-performance computing (HPC)
Applications must be written to use parallelization
Some have distributed lock manager (DLM) to avoid
conflicting operations
Operating System Concepts 1.24 Silberschatz, Galvin and Gagne ©2005
Clustered Systems
Operating System Concepts 1.25 Silberschatz, Galvin and Gagne ©2005
Operating System Structure
Multiprogramming 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
Operating System Concepts 1.26 Silberschatz, Galvin and Gagne ©2005
Operating System Structure (cont)
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 1.27 Silberschatz, Galvin and Gagne ©2005
Memory Layout for Multiprogrammed System
Operating System Concepts 1.28 Silberschatz, Galvin and Gagne ©2005
Operating-System Operations
With sharing many processes could be adversely
affected by a bug in one program. So, a properly
designed OS must ensure that an incorrect program
can not run and also can not cause other programs to
execute incorrectly.
Many errors detected by hardware can be handled by
OS.
Hardware generates interrupt.
Software error handled by exception or trap.
Operating System Concepts 1.29 Silberschatz, Galvin and Gagne ©2005
Operating-System Operations
Dual-mode operation allows OS to protect itself and
other system components
User mode (1) and Monitor/System mode/
Kernel mode (0)
Mode bit provided by hardware
Provides ability to distinguish when system is
running user code or system code
Some instructions designated as privileged, only
executable in system mode
Operating System Concepts 1.30 Silberschatz, Galvin and Gagne ©2005
Transition from User to Kernel Mode
Operating System Concepts 1.31 Silberschatz, Galvin and Gagne ©2005
Process Management
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 1.32 Silberschatz, Galvin and Gagne ©2005
Memory Management
To execute a program all (or part) of the instructions must be in
memory
All (or part) of the data that is needed by the program must be in
memory.
Memory management determines what is in memory and when
Optimizing CPU utilization and computer response to users
Memory management activities
Keeping track of which parts of memory are currently being used
and by whom
Deciding which processes (or parts thereof) and data to move into
and out of memory
Allocating and de-allocating memory space as needed
Operating System Concepts 1.33 Silberschatz, Galvin and Gagne ©2005
Storage Management
File-System management
Files usually organized into directories
Access control on most systems to determine who
can access what
OS activities include
Creating and deleting files and directories
Primitives to manipulate files and directories
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage
media
Operating System Concepts 1.34 Silberschatz, Galvin and Gagne ©2005
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
theft, theft of service
Systems generally first distinguish among users, to determine who can
do what
User identities (user IDs, security 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 1.35 Silberschatz, Galvin and Gagne ©2005