Operating System
Aim: To introduce an operation System and describe the functionalities of Operating System.
Objectives
•To Understand the services provided by an operating system.
UNIT – I
Introduction: What is an Operating System, Simple Batch Systems,
Multiprogrammed Batches systems, Time-Sharing Systems, Personal-computer systems,
Parallel systems, Distributed Systems, Real-Time Systems
Memory Management: Background, Logical versus Physical Address space, swapping,
Contiguous allocation, Paging, Segmentation
Virtual Memory: Demand Paging, Page Replacement, Page-replacement Algorithms,
Performance of Demand Paging, Allocation of Frames, Thrashing, Other Considerations
[No. of Hrs.: 12]
UNIT – II
Processes: Process Concept, Process Scheduling, Operation on Processes
CPU Scheduling: Basic Concepts, Scheduling Criteria, Scheduling Algorithms,
Multiple- Processor Scheduling,
Process Synchronization: Background, The Critical-Section Problem, Synchronization
Hardware, Semaphores, Classical Problems of Synchronization [No. of Hrs.: 10]
Operating System Concepts 1.1 Silberschatz and Galvin 1999
Operating System
UNIT – III
Deadlocks: System Model, Deadlock Characterization, Methods for Handling Deadlocks,
Deadlock Prevention, Deadlock Avoidance, Deadlock Detection, Recovery from Deadlock
Device Management: Techniques for Device Management, Dedicated Devices, Shared
Devices, Virtual Devices; Input or Output Devices, Storage Devices, Buffering,
Secondary- Storage Structure: Disk Structure, Disk Scheduling, Disk Management,
Swap-Space Management, Disk Reliability [No. of Hrs.: 10]
UNIT – IV
Information Management: Introduction, A Simple File System, General Model of a File
System, Types of File System File-System Interface: File Concept, Access Methods, Directory
Structure, Protection: Goals of protection, Domain of protection, Access rights, Consistency
Semantics Security: Authentication, Program threats, System threats, Encryption.
[No. of Hrs.: 12]
TEXT:
[T1] Silbersachatz and Galvin, “Operating System Concepts”, John Wiley & Sons, 7th Ed. 2005
[T2] Haldar/Aravind, “Operating System”, Pearson Edu.
REFERENCES:
[R1] Madnick E., Donovan J., “Operating Systems”, Tata McGraw Hill, 2001
[R2] Tannenbaum, “Operating Systems”, PHI, 4th Edition, 2000
[R3] An Introduction to Operating Systems: Concepts & Practice, Bhatt, PHI
Operating System Concepts 1.2 Silberschatz and Galvin 1999
Introduction
• What is an operating system?
• Simple Batch Systems
• Multiprogramming Batched Systems
• Time-Sharing Systems
• Personal-Computer Systems
• Parallel Systems
• Distributed Systems
• Real -Time Systems
Operating System Concepts 1.3 Silberschatz and Galvin 1999
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
(Resource Utilization).
Operating System Concepts 1.4 Silberschatz and Galvin 1999
Computer System Components
Computer system can be divided into four components:
1. Hardware – provides basic computing resources
CPU, memory, I/O devices
2. Operating system
Controls and coordinates use of hardware among various
applications and users
3. 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
4. Users
People, machines, other computers
Operating System Concepts 1.5 Silberschatz and Galvin 1999
Abstract View of System Components
Operating System Concepts 1.6 Silberschatz and Galvin 1999
What Operating Systems Do
Depends on the point of view
Users want convenience, ease of use and good performance
• 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 1.7 Silberschatz and Galvin 1999
Operating System Definitions
• Resource allocator – manages and allocates resources.
• Control program – controls the execution of user programs and
operations of I/O devices .
• Kernel – the one program running at all times (all else being
application programs).
Operating System Concepts 1.8 Silberschatz and Galvin 1999
Operating System Services
• Operating systems provide an environment for execution of
programs and services to programs and users
• One set of operating-system services provides functions that are
helpful to the user:
– User interface - Almost all operating systems have a user
interface (UI).
Varies between Command-Line (CLI), Graphics User
Interface (GUI), Batch
– Program execution - The system must be able to load a
program into memory and to run that program, end
execution, either normally or abnormally (indicating error)
– I/O operations - A running program may require I/O,
which may involve a file or an I/O device
1.9 Silberschatz and Galvin 1999
Operating System Services
(Cont.)
• One set of operating-system services provides functions that are helpful to the user
(Cont.):
– File-system manipulation - The file system is of particular interest.
Programs need to read and write files and directories, create and delete them,
search them, list file Information, permission management.
– Communications – Processes may exchange information, on the same
computer or between computers over a network
Communications may be via shared memory or through message passing
(packets moved by the OS)
– Error detection – OS needs to be constantly aware of possible errors
May occur in the CPU and memory hardware, in I/O devices, in user
program
For each type of error, OS should take the appropriate action to ensure
correct and consistent computing
Debugging facilities can greatly enhance the user’s and programmer’s
abilities to efficiently use the system
1.10 Silberschatz and Galvin 1999
Operating System Services (Cont.)
• Another set of OS functions exists for ensuring the efficient operation of the
system itself via resource sharing
– Resource allocation - When multiple users or multiple jobs running
concurrently, resources must be allocated to each of them
Many types of resources - CPU cycles, main memory, file storage, I/O
devices.
– Accounting - To keep track of which users use how much and what kinds
of computer resources
– Protection and security - The owners of information stored in a multiuser
or networked computer system may want to control use of that information,
concurrent processes should not interfere with each other
Protection involves ensuring that all access to system resources is
controlled
Security of the system from outsiders requires user authentication,
extends to defending external I/O devices from invalid access attempts
1.11 Silberschatz and Galvin 1999
A View of Operating System Services
1.12 Silberschatz and Galvin 1999
Simple Batch Systems
• User did not Interact directly rather prepare a Job and submitted to the
Computer Operator in the form of Punch cards.
• Reduce setup time by batching similar jobs
• Automatic job sequencing – automatically transfers control from one job to
another. First rudimentary operating system and always reside in memory.
• Common Input Devices
Card Reader
Tape Drives
• Common Output Devices
Line Printers
Card Punches
Tape Drives
Operating System Concepts 1.13 Silberschatz and Galvin 1999
Simple Batch Systems
• Resident monitor
– initial control in monitor
– control transfers to job
– when job completes control transfers back to monitor
• Parts of resident monitor
– Control card interpreter – responsible for reading and
carrying out instructions on the cards.
– Loader – loads systems programs and applications
programs into memory.
– Device drivers – know special characteristics and properties
for each of the system’s I/O devices.
Operating System Concepts 1.14 Silberschatz and Galvin 1999
Memory Layout for a Simple Batch System
Operating System Concepts 1.15 Silberschatz and Galvin 1999
Drawbacks of Simple Batch System
Lack of Interaction between User and the Job
Turnaround Time is very large
CPU is often Idle
Slow Performance – I/O and CPU could not
overlap ; card reader very slow.
Operating System Concepts 1.16 Silberschatz and Galvin 1999
Spooling
• Solution: Off-line operation – speed up computation by loading
jobs into memory from tapes and card reading and line printing
done off-line.
• Simultaneous Peripheral Operation On-line
• Overlap I/O of one job with computation of another job. While
executing one job, the OS.
– Reads next job from card reader into a storage area on the
disk (job queue).
– Outputs printout of previous job from disk to printer.
• Job pool – data structure that allows the OS to select which job to
run next in order to increase CPU utilization.
• Spooling improves the performance of the System with the cost
of a disk space.
Operating System Concepts 1.17 Silberschatz and Galvin 1999
Spooling
Operating System Concepts 1.18 Silberschatz and Galvin 1999
Spooling
Operating System Concepts 1.19 Silberschatz and Galvin 1999
Spooling
Operating System Concepts 1.20 Silberschatz and Galvin 1999
Multiprogrammed Batch Systems
Several jobs are kept in main memory at the same time, and the
CPU is multiplexed among them.
Multiprogramming (Batch system) 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.21 Silberschatz and Galvin 1999
OS Features Needed for Multiprogramming
• I/O routine supplied by the system.
• Memory management – the system must allocate the
memory to several jobs.
• CPU scheduling – the system must choose among
several jobs ready to run.
• Allocation of devices.
Operating System Concepts 1.22 Silberschatz and Galvin 1999
Time-Sharing Systems–Interactive Computing
• The CPU is multiplexed among several jobs that are kept in
memory and on disk (the CPU is allocated to a job only if the job
is in memory).
• When a job needs an I/O opeartion, the CPU switches between
jobs. Therefore, CPU is always busy.
• A job is swapped in and out of memory to the disk.
• On-line communication between the user and the system is
provided; when the operating system finishes the execution of
one command, it seeks the next “control statement” not from a
card reader, but rather from the user’s keyboard.
• On-line system must be available for users to access data and
code.
Operating System Concepts 1.23 Silberschatz and Galvin 1999
Personal-Computer Systems
• Personal computers – computer system dedicated to a single
user.
• I/O devices – keyboards, mice, display screens, small printers.
• User convenience and responsiveness.
• Can adopt technology developed for larger operating system’
often individuals have sole use of computer and do not need
advanced CPU utilization of protection features.
Operating System Concepts 1.24 Silberschatz and Galvin 1999
Migration of Operating-System Concepts and Features
Operating System Concepts 1.25 Silberschatz and Galvin 1999
Parallel Systems
• Multiprocessor systems with more than one CPU in close
communication.
• Tightly coupled system – processors share memory and a clock;
communication usually takes place through the shared memory.
• Advantages of parallel system:
– Increased throughput
– Economical
– Increased reliability
graceful degradation
fail-soft systems
Operating System Concepts 1.26 Silberschatz and Galvin 1999
Parallel Systems (Cont.)
• Symmetric multiprocessing (SMP)
– Each processor runs an identical copy of the operating
system.
– Many processes can run at once without performance
deterioration.
– Most modern operating systems support SMP
• Asymmetric multiprocessing
– Each processor is assigned a specific task; master
processor schedules and allocates work to slave processors.
– More common in extremely large systems
Operating System Concepts 1.27 Silberschatz and Galvin 1999
Symmetric Multiprocessing Architecture
Operating System Concepts 1.28 Silberschatz and Galvin 1999
Real-Time Systems
• Often used as a control device in a dedicated application such as
controlling scientific experiments, medical imaging systems,
industrial control systems, and some display systems.
• Well-defined fixed-time constraints.
• Hard real-time system.
– Secondary storage limited or absent, data stored in short-term
memory, or read-only memory (ROM)
– Conflicts with time-sharing systems, not supported by
general-purpose operating systems.
• Soft real-time system
– Limited utility in industrial control or robotics
– Useful in applications (multimedia, virtual reality) requiring
advanced operating-system features.
Operating System Concepts 1.29 Silberschatz and Galvin 1999
Distributed Systems
• Distribute the computation among several physical processors.
• Loosely coupled system – each processor has its own local
memory; processors communicate with one another through
various communications lines, such as high-speed buses or
telephone lines.
• Advantages of distributed systems.
– Resources Sharing
– Computation speed up – load sharing
– Reliability
– Communications
Operating System Concepts 1.30 Silberschatz and Galvin 1999
Distributed Systems (Cont.)
• Network Operating System
– provides file sharing
– provides communication scheme
– runs independently from other computers on the network
• Distributed Operating System
– less autonomy between computers
– gives the impression there is a single operating system
controlling the network.
Operating System Concepts 1.31 Silberschatz and Galvin 1999