INTRODUCTION TO OPERATING SYSTEM
CHAPTER 1: INTRODUCTION
1. What is an Operating System?
2. Computer-System Organization
3. Computer-System Architecture
4. Operating-System Structure
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
EVOLUTION OF COMPUTER SYSTEMS
Users
Applications
Database System
Operating System
Hardware
2. COMPUTER-SYSTEM ORGANIZATION
MODERN COMPUTER SYSTEM
IO module interrupt CPU
2.1 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, that run the entire
time the kernel is running.
The occurrence of an event is usually signaled
by an interrupt.
COMPUTER-SYSTEM ORGANIZATION (cont..)
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).
Each device controller has a local buffer.
CPU moves data from/to main memory to/from local
buffers.
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.
COMPUTER STARTUP
Bootstrap program is loaded at power-up or reboot
A bootstrap is the program that initializes
the operating system (OS) during startup.
Typically stored in ROM or EPROM, generally
known as firmware
Initializes all aspects of system
Loads operating system kernel and starts execution
INTERRUPTS
There are two types of interrupts:
Hardware -- a device may trigger an interrupt by sending a
signal to the CPU, usually by way of the system bus.
Software -- a program may trigger an interrupt by executing a
special operation called a system call.
A software-generated interrupt (sometimes called trap or
exception) is caused either by an error (e.g.,
divide by zero) or a user request (e.g., an I/O request).
An operating system is interrupt driven.
In vectored interrupting, a special block of memory is
typically reserved to accommodate a data structure
called an interrupt vector table—a table with a
sequence of entries called interrupt vectors. Each
interrupt vector contains information that points the
processor to the start address of the corresponding
ISR.
Polling is a method where a device continuously
checks the status of another device to determine
if it needs attention. This involves sending
requests or queries to the device, waiting for a
response, and repeating this process in a loop
COMMON FUNCTIONS OF INTERRUPTS
When an interrupt occurs, the operating system preserves the
state of the CPU by storing the registers and the program counter
Determines which type of interrupt has occurred and transfers
control to the interrupt-service routine.
An interrupt-service routine is a collection of routines (modules),
each of which is responsible for handling one particular interrupt
(e.g., from a printer, from a disk)
The transfer is generally through the interrupt vector, which
contains the addresses of all the service routines
Interrupt architecture must save the address of
the interrupted instruction.
INTERRUPT TIMELINE
2.2 STORAGE STRUCTURE
o Main memory – only large storage media that the CPU can access
directly
• Random access
• Typically volatile(static)
Volatile memory refers to a computer storage that temporarily holds data being used
or processed. Unlike non-volatile memory, which retains data even when power is lost,
volatile memory requires a continuous power supply to maintain its stored
information.
oSecondary storage – extension of main memory that provides large non-
volatile(dynamic) storage capacity
oMagnetic 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
STORAGE STRUCTURE (cont..)
oStorage Hierarchy :
Storage systems organized in hierarchy
• Speed
• Cost
• Volatility
oCaching :
Copying information into faster storage system; main memory can be viewed as a cache for
secondary storage
•Important principle, performed at many levels in a computer (in hardware, operating system,
software)
•Information in use copied from slower to faster storage temporarily
•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
2.3 I/O Structure
2.3 I/O Structure
o After I/O starts, control returns to user program only upon I/O
completion
• Wait instruction idles the CPU until the next interrupt
• Wait loop (contention for memory access)
• At most one I/O request is outstanding at a time, no simultaneous
I/O processing
o After I/O starts, control returns to user program without waiting for I/O
completion
• System call – request to the operating system to allow user to wait
for I/O completion
• Device-status table contains entry for each I/O device indicating its
type, address, and state
• Operating system indexes into I/O device table to determine device
status and to modify table entry to include interrupt
Direct Memory Access Structure :
oUsed for high-speed I/O devices able to
transmit information at close to memory speeds
oDevice controller transfers blocks of data from
buffer storage directly to main memory without
CPU intervention
oOnly one interrupt is generated per block,
rather than the one interrupt per byte
3. COMPUTER-SYSTEM ARCHITECTURE
A multiprocessor is a computer that has many CPUs that share the main memory, a
computer bus, and peripherals to process programs simultaneously. These systems
are also known as strongly connected systems. Multiprocessors have the advantages
of higher throughput, increased dependability, and economies of scale. When
processing a big amount of data at a high speed, these processors are used.
3.1 Single general-purpose processor
Most systems have special-purpose processors as well
3.2 Multiprocessors systems growing in use and importance
Also known as parallel systems, tightly-coupled systems
Advantages include:
Increased throughput: more work done in less time
Economy of scale: cost less
Increased reliability – graceful-degradation/fault-tolerance
Two types:
Symmetric Multiprocessing – each processor performs all tasks
Asymmetric Multiprocessing – each processor is assigned
a specific task.
SYMMETRIC MULTIPROCESSING ARCHITECTURE
A dual-core with two cores placed on the same chip
3.3 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
CLUSTERED SYSTEMS
4. Operating System Structure
4. Operating System Structure
4.1 MULTIPROGRAMMING
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
Batch systems:
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS switches to
another job
Timesharing systems:
Logical extension of batch systems -- CPU switches jobs so
frequently that users can interact with each job while it is running,
creating interactive computing
4.2 TIMESHARING SYSTEMS
Timesharing is also referred to as multitasking.
Response time should be < 1 second
Each user has at least one program executing in memory.
Such a program is referred to as a process
If several processes are ready to run at the same time,
we need to have CPU scheduling.
If processes do not fit in memory, swapping moves them
in and out to run
Virtual memory allows execution of processes
not completely in memory