OS UNIT-1 Introduction
OS UNIT-1 Introduction
OPERATING SYSTEMS
L C HRS
3 3 45
Course Objectives
To grasp a fundamental understanding of operating systems
and processes
To learn the concepts of CPU scheduling and Inter-Process
Communication
To learn the concepts of Deadlock and Concurrent
Programming
To understand memory management concepts in OS
To understand the concepts of I/O, file and disk management
To learn the features of UNIX operating systems
Course Outcomes
CO1 - Define the concepts of operating systems operations,
processes, and threads. (K2)
CO2 - Apply the concepts of CPU scheduling and Inter-Process
Communication (K3)
CO3 - Describe the concepts of Deadlock and Concurrent
Programming. (K2)
CO4 - Simulate the principles of memory management (K3)
CO5 - Identify appropriate I/O, file system, and disk
organizations for a variety of computing scenarios (K2)
Syllabus
UNIT I INTRODUCTION AND PROCESS MANAGEMENT (9
Hrs)
Introduction: Concept of Operating Systems - Generations of OS- Types
of OS-OS Services- Interrupt handling and System Calls-Basic
architectural concepts of an OS - Concept of Virtual Machine- Resource
Manager view- process view and hierarchical view of an OS.
Processes: Definition-Process Relationship- Different states of Process-
Process State transitions- Process Control Block (PCB) - Context
switching.
Thread: Definition- Various states- Benefits of threads- Types of
threads- Concept of multithreads.
UNIT II CPU SCHEDULINGAND INTER PROCESS
COMMUNICATION (9 Hrs)
Process Scheduling: Foundation and Scheduling objectives - Types of
Schedulers- Scheduling criteria. Scheduling algorithms: Pre-emptive and non-
pre-emptive- FCFS- SJF- RR-Multiprocessor scheduling- Real Time
scheduling.
Inter-process Communication: Concurrent processes, precedence graphs,
Critical Section, Race Conditions, Mutual Exclusion, Hardware Solution,
Semaphores, Strict Alternation, Peterson’s Solution, The Producer / Consumer
Problem, Event Counters, Monitors, Message Passing, Classical IPC Problems:
Reader’s & Writer Problem, Dinning Philosopher Problem, Barber’s shop
problem.
UNIT III DEAD LOCK AND I/O (9 Hrs)
Deadlocks: Definition - Necessary and sufficient conditions for
Deadlock - Deadlock Prevention, Deadlock Avoidance: Banker’s
algorithm - Deadlock detection and Recovery.
Concurrent Programming: Critical region, conditional critical
region, monitors, concurrent languages, communicating sequential
process (CSP)
UNIT IV MEMORY MANAGEMENT (9 Hrs)
Memory Management: Basic concept - Logical and Physical address
maps - Memory allocation: Contiguous Memory allocation – Fixed
and variable partition– Internal and External fragmentation and
Compaction.
Virtual Memory: Basics of Virtual Memory – Hardware and
control structures – Locality of reference- Page allocation-
Partitioning, Paging- Page fault-Working Set-Segmentation-
Demand paging- Page Replacement algorithms: Optimal, FIFO –
SC –NRU-LRU.
UNIT V I/O AND FILE MANAGEMENT (9 Hrs)
I/O Hardware: I/O devices- Device controllers-Direct Memory
Access- Principles of I/O
File Management: Concept of File- Access methods- File types-
File operation- Directory structure-File System structure-
Allocation methods -Free-space management - directory
implementation- efficiency and performance.
Disk Management: Disk structure- Disk scheduling – FCFS-
SSTF- SCAN- C-SCAN- Disk reliability, Disk formatting, Boot-
block, Bad blocks.
Case study: UNIX OS file system
Text Books
1. Abraham Silberschatz, Peter Baer Galvin and Greg
Gagne, “Operating System Concepts”, John Wiley & Sons
(Asia) Pvt. Ltd, Ninth Edition,2017.
2. Gary Nutt, “Operating Systems- A Modern Perspective”,
Pearson Education Pvt. Ltd, Second Edition, 2013.
3. Andrew S. Tanenbaum, “Modern Operating Systems”, 3rd
edition Prentice Hall of India Pvt. Ltd,2015.
Reference Books
1. William Stallings, “Operating System”, Prentice Hall of
India, 6th Edition, 2009
2. Charles Patrick Crowley, “Operating System: A Design-
oriented Approach”Tata McGraw - Hill Edition 1998 21st
reprint,2009 .
3. Maurice J. Bach , “Design of the Unix Operating
Systems”Prentice-Hall2 nd edition ,1986
4. Daniel Pierre Bovet, Marco Cesati , “Understanding the
Linux Kernel”O'Reilly Media, Incorporated publications,2
nd edition ,2005
Web References
1. https://nptel.ac.in/courses/106108101/
2. http://www.tcyonline.com/tests/operating-system-
concepts
3. http://www.galvin.info/history-of-operating-system-
concepts-textbook
4. http://www.ittestpapers.com/operating-system-
concepts
UNIT I
INTRODUCTION AND
PROCESS MANAGEMENT
INTRODUCTION
Concept of Operating Systems
Generations of OS
Types of OS
OS Services
Interrupt handling and System Calls
Basic architectural concepts of an OS
Concept of Virtual Machine
Resource Manager view
Process view and hierarchical view of an OS
1. Concept of Operating
Systems
What is an Operating
System?
A program(system software) that acts as an
intermediatory(interface) 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
Computer System Structure
Computer system can be divided into four components(layers):
Hardware
◦ Provides the basic computing resources such as CPU, memory, I/O
devices
Operating system
◦ Controls and coordinates the use of the hardware among various
applications and users
Application programs
◦ Defines 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, etc.,
Users
◦ People, machines, other computers
Four Components of a Computer System
Operating System Mode
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
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
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
Storage Hierarchy
Storage systems organized in hierarchy
◦ Speed
◦ Cost
◦ Volatility
Caching – copying information into faster
storage system; main memory can be viewed as
a last cache for secondary storage
Storage-Device
Hierarchy
Caching
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
Server Class
Windows Server
Mac OS X Server
Unix/Linux
Mobile Class
Android
iOS
Windows Phone
4. OS Services
Operating System Services
A View of Operating System Services
Process Management
A process is a program in execution. It is a unit of work
within the system.
Program is a passive entity,
Process is an active entity.
Process needs resources to accomplish its task
◦ CPU, memory, I/O, files
◦ Initialization data
Process Management
Process termination requires reclaim of any reusable resources
Single-threaded process has one program counter specifying
location of next instruction to execute
◦ Process executes instructions sequentially, one at a time, until
completion
Multi-threaded process has one program counter per thread
Typically system has many processes, some user, some operating
system running concurrently on one or more CPUs
◦ Concurrency by multiplexing the CPUs among the processes /
threads
Process Management Activities
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
Memory Management
All data in memory before and after processing
All instructions in memory in order to execute
Memory management determines what is in memory 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 deallocating memory space as needed
Storage Management
OS provides uniform, logical view of information
storage
◦ Abstracts physical properties to logical storage
unit - file
◦ Each medium is controlled by device (i.e., disk
drive, tape drive)
◦ Varying properties include access speed,
capacity, data-transfer rate, access method
(sequential or random)
File management
◦ Files usually organized into directories
◦ Access control on most systems to determine
who can access what
◦ File management 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
Device Management or
I/O Management
Device controllers are components on the
motherboard (or on expansion cards) that act
as an interface between the CPU and the
actual device.
Device drivers, which are the operating
system software components that interact
with the devices controllers.
Device Management or
I/O Management
A special device (inside CPU) called the
Interrupt Controller handles the task of
receiving interrupt requests and prioritizes
them to be forwarded to the processor.
Deadlocks can occur when two (or more)
processes have control of different I/O resources
that are needed by the other processes, and they
are unwilling to give up control of the device.
Device management activities
Keeps tracks of all devices connected to system.
Designates a program responsible for every device
known as Input/output controller.
Decides which process gets access to a certain
device and for how long.
Allocates devices in an effective and efficient way.
Deallocates devices when they are no longer
required.
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
Mass-Storage Management
OS activities
Free-space management
Storage allocation
Disk scheduling
Some storage need not be fast
Tertiary storage includes optical storage, magnetic tape
Still must be managed
Varies between WORM (write-once, read-many-times)
and RW (read-write)
Performance of Various Levels of Storage
Users are free to modify the code, improve it, and redistribute it,
Developers are not allowed to charge money for the Linux kernel
itself (the main part of the operating system), but they can charge
money for distributions (distros for short).
Google Chrome OS
Chrome OS. Is a popular thin client operating system.
Thin client A computer with minimal hardware, designed for a
specific task. For example, a thin web client is designed for using
the Internet.
Server Operating Systems
Windows Server
◦ Familiar GUI interface for those experienced with Windows
UNIX
◦ Very mature server capabilities, time-tested, large user community,
stable
Linux
◦ Free, customizable, many free services and utilities available
Windows Server
UNIX
Tablet and Phone Operating
Systems
System-on-chip (SoC): An operating system that comes preinstalled
on a chip on a portable device such as a smartphone.
Popular SoC operating systems:
iOS: for iPad, iPhone
Android: for a variety of tablets and phones