OS_Module1_Unit1 (1)
OS_Module1_Unit1 (1)
Department of AIML
Semester /
Course Code : BCS303 III / II
Year :
Academic
Course Title : Operating Systems 2024-25
Year :
Important
Unit 1
Introduction to operating systems, System structures: 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; Distributed
system; Special-purpose systems; Computing environments.
3
Introduction to Operating System
5
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
6
Four Components of Computer System
7
What operating System Do?
USER’S VIEW :
Single User :
want convenience, ease of use and good performance
Don’t care about resource utilization
Optimized for Single User
Multi User :
Users Uses computer/terminal such as mainframe or minicomputer
satisfying its request
Same computer/terminal accessed by other users through other
terminals sharing resources and exchanging information.
8
What operating System Do?
USER’S VIEW :
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.poor performance due to power , speed and interface limitations
Some computers have little or no user interface, such as embedded
computers in devices and automobiles
9
What operating System Do?
SYSTEM VIEW
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
10
Operating System Definition (Contd…)
11
Computer Startup
12
Computer System Organization
Computer-system operation
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
13
Computer System Operations
14
Common Functions of Interrupts
OS starts executing first process init and wait for an event signaled by an
interrupt from hardware /software.
Hardware trigger an interrupt any time sending a signal to CPU through system
bus
15
An operating system is interrupt driven
Common Functions of Interrupts
When CPU is interrupted ,it stop its operation & immediately transfer execution
to fixed
Fixed Location contain starting address where service routine for interrupt is
located
16
Interrupt Timeline
17
Common Functions of Interrupts
Straight forward method for handling this transfer would be to invoke a general
routine to examine interrupt information i.e routine inturn it calls interrupt specific
handler to handle interrupt quickly.
18
Common Functions of Interrupts
The interrupt routine is called indirectly through the table with no intermediate
routine needed.
Table of pointers stored in low memory .These location hold address of interrupt
service routine for various devices called Interrupt vector
Interrupt vector is indexed by unique device number given with interrupt request
to provide address of interrupt service routine for interrupting device
19
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
20
Interrupt Timeline
21
Storage Definition and Notations
Given enough bits, it is amazing how many things a computer can represent:
numbers, letters, images, movies, sounds, documents, and programs.
A byte is 8 bits, and on most computers it is the smallest convenient chunk of storage.
For example, most computers don’t have an instruction to move a bit but do have one
to move a byte.
22
Storage Definition and Notations
A less common term is word, which is a given computer architecture’s native unit of
data.
For example, a computer that has 64-bit registers and 64-bit memory addressing
typically has 64-bit (8-byte) words.
A computer executes many operations in its native word size rather than a byte at a
time.
23
Storage Definition and Notations
Computer storage, along with most computer throughput, is generally measured and
manipulated in bytes and collections of bytes.
Computer manufacturers often round off these numbers and say that a megabyte is 1
million bytes and a gigabyte is 1 billion bytes. Networking measurements are an
exception to this general rule; they are given in bits (because networks move data a bit
at a time).
24
Storage Structure
Main memory – only large storage media that the CPU can access directly
Random access (RAM)-General purpose computers run their programs from
rewritable memory
Typically volatile,
Implemented in a semiconductor technology called Dynamic Random Access
memory
25
Storage Structure
EEPROM– Electrically Erasable Programmable Read only Memory
Non-Volatile ROM enables individual bytes of data to be erased and
reprogrammed
Contains Static Programs
Smartphones have EEPROM to store their factory –installed programs
Memory – Array of words which has its own address
Load and Store instruction is used to specify memory addresses
Load – moves word from main memory- internal registers within CPU
Store – moves word from internal registers- main memory
CPU automatically loads instruction from main memory for execution
26
Storage Structure
27
Storage Structure
Main memory –
Typically volatile,it loses its content when power is turned off
Main Memory is smaller to store all needed programs data permanently
Secondary storage – extension of main memory that provides large nonvolatile
storage capacity
Hold Large quantities of data
Magnetic Disk :
Provide storage for both programs and data
Most programs (system & application) are stored in disk untill
they are loaded in memory
Used both as programs and desination of processing
28
Storage Structure
Hard 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
Solid-state disks – faster than hard disks, nonvolatile
Various technologies
Becoming more popular
29
Storage Device - Hierarchy
30
Storage Hierarchy
31
Caching
32
I/O Structure
General Purpose Computer System consist of one or more CPUs and multiple
device controllers connect through common bus
Each device controller is incharge of specific type of device
33
I/O Structure
34
I/O Structure
Depend on controller ,more than one device can be attached (seven or more
devices can be attached to small computer system interface(SCSI) controller
A device controller maintain local buffer storage and special purpose registers
The device controller is responsible for moving data between peripheral devices
that it controls and its local buffer storage
Operating system have device driver for each device controller
Device driver understands device controller and it provide interface to the device
and OS
35
I/O Structure
For I/O operations ,device driver loads the appropriate registers within device
controller
A device controller examines content of registers to determine which actions to
take (Read a character from keyboard)
Controller transfer data from device to its local buffer
Once transfer of data complete ,device controller inform device driver via
interrupt about completion of operation
Device driver then return control to OS
Interrupt driven I/O is suitable for moving small amount of data but produces high
overhead for bulk data movement.
36
Direct Memory Access Structure
After setting up buffers, pointers , and counters for I/O device, the device
controller transfers entire block of data directly to and from its own buffer
storage to without CPU intervention
Only one interrupt is generated per block, rather than the one interrupt per byte
37
How a Modern Computer Works
38
Computer –System Architecture
Single processor Syatems If systems contain only one single general-purpose
processor (CPU).
Ex PDA ,Mainframe
40
Computer –System Architecture
Advantages include:
1. Increased throughput
2. Economy of scale
3. Increased reliability – graceful degradation or fault tolerance
41
Computer –System Architecture
Two types:
1. Asymmetric Multiprocessing – each processor is assigned a specific task.
• Master –slave relationship
• Master controls the system
• Other processor look to master for instruction or predefined task
43
A Dual – Core Design
Core : A small Processor built into big CPU or CPU Socket
Multiple computing cores on a single chip – Multiprocessor chip
Efficient than multiple chips with single core , on chip communication is faster
than between chip communication
Uses less power than multiple single core chips
Well suited for Database and Web Server
44
A Dual – Core Design
45
Clustered Systems
46
Clustered Systems
47
Operating System Structure
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
48
Operating System Structure
49
Memory Layout for Multiprogrammed System
50
Operating System Operations
51
Operating System Operations(Contd…)
52
Transition from User to Kernel Mode
53
Timer
Timer is set to interrupt the computer after some time period.It can be fixed
time period (1/60 seconds )or variable(1 millisecond to 1 second)
Variable timer is implemented by a fixed rate clock and a counter )Keep a
counter that is decremented by the physical clock.
Operating system set the counter and every time the clock ticks counter is
decremented
When counter zero generate an interrupt
54
Timer
Before returning control to user , operating system ensures that timer is set
interrupt
If timer interrupts ,control transfers automatically to the operating system.
55
Process Management
56
Process Management
Single-threaded process has one program counter specifying location of next
instruction to execute
Process executes instructions sequentially, one at a time, until completion
Typically system has many processes, some user, some operating system running
concurrently on one or more CPUs
57
Process Management Activities
The operating system is responsible for the following activities in connection with
process management:
58
Memory Management
The OS Abstracts from the physical properties of its storage devices to define a
logical storage unit - file
The OS maps files onto physical media and access these files Via the Storage
device (i.e., disk drive, tape drive)
60
Storage Management
File-System management
storage media such as tapes and disks and devices that control them
61
Storage Management
Files usually organized into directories
OS activities include
Creating and deleting files
Creating and deleting directories to organize files
Supporting Primitives for manipulating files and directories
Mapping files onto secondary storage
Backing up files onto stable (non-volatile) storage media
62
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
Entire speed of computer operation hinges on disk subsystem and its algorithms
OS activities
Free-space management
Storage allocation
Disk scheduling
63
Mass Storage Management
Some storage need not be fast
Tertiary storage includes optical storage, magnetic tape
Still must be managed – by OS or applications
Varies between WORM (write-once, read-many-times) and RW (read-write)
64
Movement between levels of storage hierarchy can be explicit or implicit
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 65
Distributed System
Distributed computing
Collection of separate, possibly heterogeneous, systems networked together to
provide users access to various resources that the system maintains
Access to a shared resources increases computation speed ,functionality
,data availability and reliability.
Network is a communications path, TCP/IP most common
– Local Area Network (LAN)
– Wide Area Network (WAN)
– Metropolitan Area Network (MAN)
– Personal Area Network (PAN)
Network Operating System provides features between systems across
network
Communication scheme allows systems to exchange messages
66
Illusion of a single system
Special Purpose System
Real Time Embedded System
67
Special Purpose System
Real Time Embedded System
68
Special Purpose System
Multimedia System
Multimedia describes a wide range of applications
It includes audio files such as MP3,DVD movies, video conferencing and short
video clips of movie preview or news stories downloaded over the internet.
Multimedia applications include live webcasts (broadcasting over www) of
speeches or supporting events and even live webcam
Multimedia applications need not be either audio or video ,rather combination of
both ( movie consist of separate audio and video tracks)
Multimedia applications be delivered only to desktop personal computer
Increasingly ,they are being directed toward smaller devices
69
Special Purpose System
Handheld Systems:
Handheld systems include personal digital assistants (PDA’s) such as Palm and
Pocket-PC’s and cellular phones –uses special purpose embedding operating
systems
Developers of handheld systems and application face many challenges ,due to the
limited size of such devices
PDA is about 5 inches in height and 3 inches in width and its weight less than
one-half pound
Handheld devices have small amounts of memory ,slow processors and small
display screens
70
Special Purpose System
Handheld Systems:
Limitations of Handheld systems
The amount of physical memory depends on the device ,typically between 1MB
to 1GB
Speed of processor – runs at a fraction of the speed of processor .Faster
processor requires a larger battery
Lack of physical space limits input methods to small keyboards, handwriting
recognition, or small screen-based keyboards.
71
Computing Environments - Traditional