Operating Systems Overview
(CS5433)
By
Dr. Muhammad Aleem,
Department of Computer Science,
Capital University of Science & Technology, Islamabad
Lecture Outline
– Operating System (Objectives/Functions)
– The Evolution of Operating Systems
– Major Achievements
– Modern Operating Systems
–Case-Studies:
• Microsoft Windows Overview
• UNIX Systems
• Linux
Operating System
• A program that controls the execution of
application programs
• An interface between applications and hardware
• Main objectives of an OS:
– Convenience
– Efficiency
– Ability to evolve
Layers and Views
Services Provided by Operating Systems
• Program development
– Editors, debuggers, and libraries
• Program execution
– OS handles scheduling of numerous tasks required to
execute a program
• Access I/O devices
– Each device will have unique interface
– OS presents standard interface to users
Services cont…
• Controlled access to files
– Accessing different media but presenting a common
interface to users
– Provides protection in multi-user systems
• System access
– System resources (CPU, Memory, etc)
• Facilitating Parallel Operations
Services cont…
• Error detection and response
– Internal and external hardware errors
– Software errors
• Accounting
– Collect usage statistics and monitoring
• Handling network communications
The Role of an OS
• A computer is a set of resources for the
movement, storage, and processing of data
• The OS is responsible for managing these
resources
Operating System as Software
• The OS functions in the same way as an ordinary
computer software
– It is a program that is executed by the CPU
• Operating system hand-over control to the
processor, and depends on CPU to regain the
control.
OS as Resource Manager
OS Kernel
Evolution of Operating Systems
• Operating systems will evolve over time:
– Hardware upgrades plus new types of hardware
e.g., Multi-/Many-core Processors
– New services and increasing application
demands
– Improved functionality and bug-free software
– Operating System (Objectives/Functions)
– The Evolution of Operating Systems
– Major Achievements
– Modern Operating Systems
– Microsoft Windows Overview
– UNIX Systems
– Linux
Evolution of Operating Systems
• Historical Milestones:
1. Serial Processing
2. Simple Batch Systems
3. Multiprogrammed batch systems
4. Time Sharing Systems
1. Serial Processing
• No Operating System (1940’s to mid 1950’s)
– Direct interaction to computer hardware (using
machine language)
• Machines run from a console with display lights,
toggle switches, input device, and printer
1. Serial Processing
Problems include:
– Setup time
• loading compilers, source code, compiling, loading-linking
binary,
• Each task needs mounting un-mounting specific disks etc.
– Scheduling (booking in multiple of 30 mins)
• Over-run jobs require re-submissions
• Under-run jobs results in time waste
2. Simple batch system
• Early computers were extremely expensive
– Important to maximize processor utilization
• Mid 1950’s first “OS” (limited scope) by General
Motors for IBM 701 computer
• Monitor (the controlling program!)
– Software that controls the sequence of events
– Batch Jobs (programs) together
– Program returns control to monitor when finished
2. Monitor’s perspective
• Monitor controls the sequence
of events
• Resident Monitor is software
always in memory
• Monitor reads in jobs and
gives control
• Job returns control to monitor
2. Job Control Language
• Special programming language to control jobs
(for batch processing OS)
• Interface between programmer and monitor
• Provides Instructions to the monitor
– What compiler to use?
– What data to use?
–…
2. Desirable Hardware Features
• Memory protection for monitor
– Jobs cannot overwrite or alter data/instructions
• Timer
– Prevent a job from monopolizing system
• Privileged instructions
– Only executed by the monitor
– E.g., IO (How a program does the IO?)
• Interrupts (no hardware support available earlier)
2. Modes of Operation
1. User Mode
– Execution of user program
– Protection of certain memory areas
– Restricted execution (some instructions may not
be executed)
2. Kernel Mode
– Monitor executes in kernel mode
– Privileged instructions may be executed,
– All memory accessible.
3. Multi-programmed Batch System
• CPU often idle (in early Batch OS)
– Even with automatic job sequencing.
• Because: I/O devices are slow compared to
• Processor
• Which results in Low processor utilization
3. Uniprogramming
• Processor must wait for I/O instruction to
complete before preceding
3. Multiprogramming
• When one job needs to wait for I/O, the processor
can switch to the other job
• Multiprogramming: process switching because of
wait involved in I/O of other program
3. Multiprogramming
Example (Comp. having 250 MB mem.)
Utilization Histograms
Uniprogramming (Concurrent, Multiprogramming
Time Sharing Systems
• Using multiprogramming to handle multiple
Interactive Jobs (also called Multitasking)
• Multitasking: process switching because of time
quantum expiration
• Processor’s time is shared among multiple users
• Multiple users simultaneously access the system
through terminals
Batch Multiprogramming vs. Time Sharing
Early Example System: CTSS
• Compatible Time-Sharing System (CTSS)
– Developed at MIT, under “Project MAC”
• Time Slicing:
– When control was passed to a user:
• User program and data loaded
• Clock generates interrupts about every 0.2 sec
• At each interrupt OS gained control and, may
assign processor to another user
CTSS Operation - Example
• Example:
– Four Jobs (and their size in memory words)
1. Job1: 15000
2. Job2: 20000
3. Job3: 5000
4. Job4: 10000
CTSS Operation - Example
Problems and Issues
• Multiple jobs in memory must be protected
from each other’s data
• File system must be protected so that only
authorised users can access
• Contention for resources must be handled
– Printers, storage etc
– Operating System (Objectives/Functions)
– The Evolution of Operating Systems
– Major Advances
– Modern Operating Systems
– Microsoft Windows Overview
– UNIX Systems
– Linux
Major Advances
• Operating Systems are among the most complex
pieces of software ever developed
Major Advances:
1. Processes Management
2. Memory Management
3. Information Protection and Security
4. Scheduling and Resource Management
Process
• Fundamental to the structure of OS’s
• A process is:
– A program in execution
– An instance of a running program
– The entity that can be assigned to and executed
on a processor
– A single sequential thread of execution, a
current state, and an associated set of system
resources.
Components of a Process
• A process consists of:
– An Executable program
– Associated data needed by the program
– Execution context of the program (or “process
state”)
• The execution context contains all information the
operating system needs to manage the process
Process
Management
Memory Management
• The OS has 5 main storage management
responsibilities:
1. Process Isolation
2. Automatic allocation and management
3. Support of modular programming
4. Protection and access control (sharing)
5. Long-term Storage
Virtual Memory
• File system implements long-term storage
• Virtual memory allows programs to address
memory from a logical point of view
– Without regard to the limits of physical memory
Paging
• Allows process to be comprised of a number of
fixed-size blocks, called pages
• Virtual address is a page number and an offset
within the page
• Each page may be located any where in main
memory
Virtual Memory
Virtual Memory Addressing
Information Protection and Security
• The problem involves controlling access to
computer systems and the information stored
in them.
Information Protection and Security
• Main issues:
– Availability: protecting the system against
interruption
– Confidentiality: cannot read data for which
access is unauthorized
– Data Integrity: protection of data from
unauthorized modification
– Authenticity: proper verification of the identity
of users
Scheduling and Resource Management
• Key responsibility of an OS is Managing
Resources
• Resource allocation policies must consider:
–Fairness
–Differential Responsiveness
–Efficiency
Key elements of an Operating System in
Scheduling and Resource Management
Multi-programming environment
System Interaction
System Interaction
System Structure (Hierarchal View)
• View system as a series of levels
• Each level performs a related subset of functions
• Each level relies on the next lower level to
perform more primitive functions
• This decomposes a problem into a number of
more manageable subproblems
OS Design Hierarchy
Multi-
programming
Single
Process
Hardware
Level
– Operating System (Objectives/Functions)
– The Evolution of Operating Systems
– Major Advances
– Modern Operating Systems
– Microsoft Windows Overview
– UNIX Systems
– Linux
Different Architectural Approaches
Design elements of a modern Operating System:
1. Microkernel Architecture
2. Multithreading
3. Symmetric Multiprocessing
4. Distributed Operating Systems
5. Object-Oriented Design
1. Microkernel Architecture
1. Most early OS are a monolithic kernel
– Most OS functionality resides in the kernel.
2. Microkernel assigns only a few Essential Functions
to the kernel:
– Address space management
– Interprocess communication (IPC)
– Basic scheduling
• Microkernel Approach suited to Distributed Systems
2. Multithreading
• Process is divided into threads that can run
concurrently
• Thread
– Dispatchable unit of work
– Executes sequentially, and is interruptible
• Process is a collection of one or more threads
3. Symmetric Multiprocessing (SMP)
• A SMP system has:
– Multiple processors
– Processors share same memory and I/O
– All processors can perform the same functions
• The OS of an SMP schedules Processes or
threads across all of the Processors
SMP Advantages
• Performance
– Allowing parallel processing
• Availability
– Failure of a single processor does not halt the
system
• Incremental growth
– Additional processors can be added
• Scaling of hardware (customizable)
Multiprogramming and Multiprocessing
4. Distributed Operating Systems
• Provides the illusion of:
– A single main memory space and
– Single secondary memory space
– Unified File-system
5. Object-Oriented design
• Used for adding modular extensions to a small
kernel
• Enables programmers to customize an operating
system without disrupting system integrity
– Operating System (Objectives/Functions)
– The Evolution of Operating Systems
– Major Advances
– Modern Operating Systems
– Microsoft Windows (2000) Overview
– UNIX Systems
– Linux
Single-User Multitasking
• From Windows-2000 on , Windows OS developed
to exploit modern 32-bit and 64-bit
microprocessors
• Designed for single users who run multiple
programs
• Main drivers (multi-tasking):
– Increased memory, and speed of
microprocessors
– Support for Virtual Memory
Customized
login
Windows Architecture
• Kernel Mode Components
1. Hardware Abstraction Layer
2. Executive
3. Kernel
4. Device Drivers
5. Windowing and graphics system
1. Hardware Abstraction Layer (HAL)
Windows 2000/VISTA Kernel, …
Hardware Abstraction Layer (HAL)
-System Bus -System Bus -System Bus
-DMA controller -DMA controller -DMA controller
-Interrupt Controllers -Interrupt Controllers -Interrupt Controllers
-System Timers -System Timers -System Timers
-Memory Modules -Memory Modules -Memory Modules
System Architecture - 1 System Architecture - 2 System Architecture - 3
2. Executive
• Core OS Functionalities:
– Local Procedure Call mechanism
– Memory management
– Processes and thread management
– Security
– I/O mechanisms
– Inter-process communication
– Power management
3. Kernel (Windows 2000)
• Single module (no threads)
• Never paged out of memory
• Never preempted (non-preemptive)
• Compact and efficient: written in C/Assembly
• Processor related functionality
– Processor allocation, and switching
– Processor scheduling
– Processor synchronization (in SMP environment)
4. Device Drivers and File-System
• Loadable Kernel Modules (communication via HAL)
• Implementing: File-systems, Network Protocols, ...
User’s I/O requests
Device Drivers Stack
Device controller Device controller Device controller
5. Windowing and graphics system
• Implements Graphical User Interface (GUI)
• Handles user interface controls, etc.
Client/Server Model
• Windows OS, and all subsystem uses a
client/server model
– Just like distributed systems (used internal to a
single system)
• Processes communicate via Remote Procedure
Call (RPC)
-Client Service
Executive Target Service
-User Program
Windows Objects
• Windows draws heavily on the concepts of
object-oriented design.
• Key Object Oriented concepts used:
– Encapsulation
– Object class and Instance
– Inheritance
– Operating System (Objectives/Functions)
– The Evolution of Operating Systems
– Major Advances
– Modern Operating Systems
– Microsoft Windows Overview
– UNIX System
– Linux
General Unix Architecture
Unix Kernel
– Kernel loaded into memory and runs until the
system crashes/ turned off.
– Mostly written in C, some Assembly language
code for efficiency reasons.
– User programs make use of kernel services via
the system call interface.
– Several subsystems:
– File system, process management, I/O, and inter-
process communication
User and kernel Mode
User
Interface
Traditional UNIX
Kernel
Modern UNIX Kernel
Real-time processing support
Process scheduling classes
Dynamically allocated data structures
Pre-emptive kernel
– Operating System (Objectives/Functions)
– The Evolution of Operating Systems
– Major Advances
– Modern Operating Systems
– Microsoft Windows Overview
– UNIX Systems
– Linux
Modular (Monolithic Kernel)
• Although monolithic, the kernel is structured as
a collection of modules
– Loadable modules
– Dynamic linking (link and unlink at run time)
• Characteristics (of Linux’s Loadable Modules):
– Dynamic Linking
– Stackable Modules
Linux Kernel Modules
Modules Advantages
• If new kernel options required, can be done
without re-building OS
• Problematic functionality can be off-loaded
from system (un-loading the module)
• Modules save memory (dynamic linking)
• Easy system maintenance, and debugging
Linux Kernel Components
Acknowledgements
– Lecture material based on:
“Operating Systems: Internals and Design Principals” by William
Stallings 6th Edition