0% found this document useful (0 votes)
0 views

Operating Systems-1

OS

Uploaded by

ashfaqshafeek
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Operating Systems-1

OS

Uploaded by

ashfaqshafeek
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 164

Operating Systems

Bridge Course
Syllabus
• Module III – Operating Systems
• Introduction to Operating Systems: Basic Hardware & Memory- Ram, Rom, CPU,
Hard disk, Mother Board, SMPS, Cache Memory, Virtual Memory, Registers, Buffers,
GUI & CUI, Application S/W, System S/W, Booting Process, BIOS, POST, Bootstrap
loader, Kernel.
• Functions of Operating System: Types of operating system- Batch,
Multiprogramming, Multi-Tasking, Multi-Processing, Real-Time.
• Concept of a Process: Process States, Process Control Block, Context Switch, Thread,
Multi-Thread. CPU Scheduling criteria- CPU scheduling algorithms-FCFS, SJFS, SRTF,
Round Robin, Priority Scheduling.
• References
• Silberschatz, Galvin, Gagne "Operating System Principles”, Wiley, Seventh Edition
(2006)
• Tanenbaum, Andrew S, "Modern Operating Systems”, Prentice Hall India Learning
Private Limited, Third Edition (2009)
Applications of Computer
• Word Processing: Used in offices and homes for creating documents, letters, and reports.
• Email Communication: Facilitates sending and receiving messages quickly across the globe.
• Online Shopping: Enables purchasing products and services through websites like Amazon or
eBay.
• Digital Banking: Allows people to manage their bank accounts, transfer money, and pay bills
online.
• Social Networking: Platforms like Facebook, Instagram, and Twitter enable people to connect and
share updates.
• Media Streaming: Computers stream music, movies, and TV shows through services like Netflix,
Spotify, or YouTube.
• Home Security Systems: Used to monitor and control security cameras, alarms, and smart locks.
• Education and E-learning: Supports virtual classrooms, online courses, and digital textbooks.
• Gaming: Provides a platform for playing video games, ranging from simple mobile games to
complex PC or console games.
• Weather Forecasting: Computers analyze data to predict weather patterns and provide accurate
forecasts.
• ETC
Introduction
• What is a Computer?
• A computer is an electronic device that processes data according to a set of
instructions, called a program, to perform tasks, solve problems, or provide
information. It can input, store, process, and output data, making it a
powerful tool for a wide range of activities.
Introduction
• Computer can be divided into two:-
• Hardware
• Tangible functions
• Software
• Instructions working over hardware.
Block Diagram
Parts of a Computer

• Input Devices (Keyboard, Mouse, etc.)

• Output Devices (Monitor, Speakers, etc.)

• Central Processing Unit (CPU) and memory


CPU(central processing unit)
• Box-like case containing electronic components used to process data
• It is the brain of the computer.
• The ALU and the Control Unit (CU) of a computer system are jointly
known as the central processing unit.
• CPU performs actual processing of data, according to instructions
from programs.
Memory
• Types of Memory
• Registers
• RAM(Random Access Memory)
• ROM(Read Only Memory)
• Secondary Storage Devices(considered as input/output device)
Registers
• Introduction to Registers
• Registers are small, fast storage locations within the CPU.
• Used for storing data temporarily during instruction execution.
• Types of Registers
• Data Registers: Store operands for arithmetic and logical operations.
• Address Registers: Hold memory addresses for data access.
• Status Registers: Contain flags that indicate the result of operations (e.g., zero
flag, carry flag).
• Instruction Register (IR): Holds the current instruction being executed.
• Program Counter (PC): Keeps track of the address of the next instruction.
• Accumulator (ACC): Commonly used for arithmetic operations.
Registers
• Role in CPU Operations
• Registers facilitate quick data processing and temporary storage.
• Crucial for the fetch-decode-execute cycle.
• Enhance overall system performance by reducing the need to access slower
memory types.
How Registers Work?
Registers
• Flow of Operation:
• The Program Counter (PC) points to the next instruction to be executed.
• The instruction is fetched from memory and placed in the Instruction Register
(IR).
• The Control Unit decodes the instruction and signals the ALU or other
components to perform the necessary operation.
• Data is temporarily stored and manipulated in the Registers.
• The Accumulator (ACC) often holds the results of operations.
• The process repeats for the next instruction.
Primary Memory
• Definition:
• Primary memory, also known as main memory, is the computer's memory
that is directly accessible by the CPU.
• It stores data and instructions currently in use for quick access.
• Types:
• RAM (Random Access Memory)
• ROM (Read-Only Memory)
ROM (Read-Only Memory)
• Definition:
• ROM is non-volatile memory used to store firmware or software that is rarely
changed.
• Characteristics:
• Non-volatile: Retains data even when the computer is turned off.
• Pre-programmed: Contains data or instructions installed during the manufacturing
process.
• Types of ROM:
• PROM (Programmable ROM): Can be programmed once.
• EPROM (Erasable PROM): Can be erased and reprogrammed using UV light.
• EEPROM (Electrically Erasable PROM): Can be erased and reprogrammed using an
electrical charge.
ROM
RAM (Random Access Memory)
• Definition:
• RAM is volatile memory used by the CPU to store data that is actively being
worked on.
• Characteristics:
• Volatile: Loses data when the power is off.
• Fast Access: Enables quick read and write operations, essential for running
applications and processes.
• Types of RAM:
• SRAM (Static RAM): Faster, used for cache memory.
• DRAM (Dynamic RAM): Slower, used for main memory.
Difference between ROM and RAM
SRAM (Static RAM)
• Definition:
• SRAM is a type of RAM that retains data as long as power is supplied.
• Characteristics:
• Speed: Very fast access times, used for cache memory.
• Structure: Uses flip-flops to store each bit, leading to lower density.
• Power Consumption: Lower power consumption than DRAM when idle but
higher during operations.
• Applications:
• Commonly used in CPU cache memory due to its speed.
DRAM (Dynamic RAM)
• Definition:
• DRAM is a type of RAM that stores each bit of data in a separate capacitor.
• Characteristics:
• Speed: Slower than SRAM, but faster than secondary storage.
• Structure: Requires periodic refreshing to maintain data.
• Density: Higher density than SRAM, allowing more data storage per chip.
• Power Consumption: Higher due to constant refresh cycles.
• Applications:
• Used for main system memory in most computers due to its cost-
effectiveness.
Difference between SRAM and DRAM
Advanced SRAM and DRAM
• Advanced SRAM:
• Low-Power SRAM (LP-SRAM): Designed for mobile and embedded systems to
reduce power consumption.
• Multi-Port SRAM: Allows multiple read/write operations simultaneously for
high-performance applications.
• Advanced DRAM:
• DDR (Double Data Rate) DRAM: Transfers data on both the rising and falling
edges of the clock signal, effectively doubling the data rate.
• GDDR (Graphics DDR): Optimized for rendering graphics in gaming consoles
and GPUs.
• HBM (High Bandwidth Memory): Stacks multiple DRAM dies to achieve high
data throughput.
Secondary Storage Devices
• Definition:
• Secondary storage refers to storage devices and media that are not constantly
accessible by a computer system. It's used to store data long-term.
• Key Features:
• Non-volatile storage
• Used for data backup, retrieval, and storage
• Slower than primary storage, but with larger capacity
Importance
• Why It's Important:
• Provides data persistence after power is off
• Offers larger storage capacity
• Vital for data recovery and backup
• Allows storage of multimedia files, software, and applications
Types of Secondary Storage Devices
• Secondary storage devices can be categorized into different types based on
technology and usage.
• Types of Secondary Storage Devices
• Magnetic Storage Devices
• Optical Storage Devices
• Solid-State Storage Devices
• Magnetic Storage Devices
• Examples:
• Hard Disk Drives (HDD)
• Magnetic Tapes
• Features:
• Utilizes magnetic fields to store data
• Typically offers large storage capacity at a low cost
Continues..
• Optical Storage Devices
• Examples:
• CDs, DVDs, Blu-ray Discs
• Features:
• Uses laser light to read and write data
• Commonly used for media storage and distribution
• Solid-State Storage Devices
• Examples:
• Solid-State Drives (SSD)
• USB Flash Drives
• Memory Cards
• Features:
• No moving parts, faster access speed
• More durable and reliable
Continues..
• Cloud Storage
• Definition: Data is stored on remote servers accessed from the internet.
• Examples: Google Drive, Dropbox, Amazon S3
• Features:
• Accessibility from anywhere with an internet connection
• Scalable storage options
Hard disk
Components of a Hard disk
1. Disk platter
2. Read/Write head
3. Head arm/Head slider
4. Head actuator mechanism
5. Spindle motor
6. Logic board
7. Air filter
8. Cables & Connectors
9. Bezel/Front Face Plate
Geography of Hard disk
track

sector

head
Continues..

• Numbering starts from 0. if there is


2 platters first side is numbered as
0 and last side is numbered as 3
Continues..

• Each side is divided into


concentric circles called
Tracks.
• Numbering starts from 0.
Continues..
• Single track can store more than
5000 bytes.
• So it is further divided into
sectors.
Continues..
• Data is stored in the
cylinder by cylinder
Mother Board
• The motherboard is the main printed circuit board (PCB) in a computer,
housing the central components and providing connectors for other
peripherals.
• Acts as the backbone, connecting and enabling communication between all
parts of the computer.
• Functions of Motherboard:
• Data Pathways: How data travels through the motherboard.
• Peripheral Connectivity: Ports for USB, audio, and network connections.
• BIOS/UEFI: Firmware that initializes hardware during the boot process.
• Cooling Solutions: Built-in features like fan headers to maintain optimal
temperature.
• Motherboard form factor - Determines the size of the board
Components of Motherboard
1. Clock Generator
2. CPU socket
3. Memory Socket Memory error checking
4. ROM Bios
5. CMOS Ram
6. Battery
7. Chipset
8. Expansion Slot
9. AGP Port
10. IDE Ports
11. Floppy Disk port
12. IO Connectors/USB ports USB port add more printer ports
13. Main Power Connector1
14. Front Panel Connecting Pin
Motherboard
Continues

• Chip set is a set of IC.


• The combination of
the North and South
bridge in a computer is
called the chipset.
Memory Socket(DIMM)
• There are 3 types of
memory that currently
popular used in the PC
1. RD RAM
2. DDR RAM
3. SD RAM
Physical organization of Memory
• DIP
• SIPP
• SIMM
• DIMM
CPU Socket
• A CPU socket or slot is an electrical
component that attaches to a printed
circuit board (PCB) and is designed
to house a CPU (also called a
microprocessor).
• It is a special type of integrated
circuit socket designed for very high
pin counts.
• CPU sockets on the motherboard can
most often be found in most desktop
and server computers (laptops
typically use surface mount CPUs),
particularly those based on
the Intelx86 architecture.
ROM BIOS
Read-Only Memory can be read but not
changed. It is non-volatile storage: it
remembers its contents even when the
power is turned off.
ROM chips are used to store the
instructions a computer needs during
start-up, called firmware.
Some kinds of ROM are PROM,
EPROM, EEPROM, and CD-ROM.
CMOS Battery
• This is a 3 volt battery, this
battery supplies the power to
CMOS ROM for CMOS ROM
to retain the information during
system powered off, the battery
may be last for 5 or 6 years
Expansion Slots
• Expansion slot or Expansion bus is the slot
that enable the user to add the adapter card
for additional function to the system

Eg.
-Sound card or Multimedia
- LAN card.
-SCSI controller card.
- Internal Modem card.
-TV tuner card.
-Additional hard disc controller card.
AGP Port
• AGP ( Accelerated
Graphic Port ) port is a
high speed data transfer
port, this port is used by
the display adapter card
that demands so much data
with in short period of
time.
IO Connector/USB ports
Others
• Co processors
• Buses
• Expansion Slots
• ISA(Industry Standard Architecture)
• MCA(Micro Channel Architecture)
• EISA(Extended….)
• VESA Local Bus(Video Electronics Standard Association)
• PCI Local bus(peripheral Connect Interconnect)
SMPS – Switched-Mode Power Supply
Continues..
• A Switch-Mode Power Supply (SMPS) is an electronic power supply
that converts electrical power efficiently using switching regulators.
• Key Features:
• High efficiency
• Compact size
• Wide input voltage range
Continues..
• Basic Operation:
• Converts AC (alternating current) to DC (direct current).
• Uses high-frequency switching to regulate output voltage.
• Components:
• Rectifier: Converts AC to DC.
• Filter: Smoothens the DC signal.
• Switching Regulator: Maintains desired output voltage by switching on and
off.
SMPS
• +5 V
• -5 V
• +12V
• -12V
Cache Memory
• Cache memory is a small, high-speed storage located close to the
CPU.
• It stores frequently accessed data and instructions to speed up
processing.
• Primarily categorized into L1, L2, and L3 caches.
• Reduces CPU access time to the main memory, enhancing overall
system performance.
Continues..
• Levels: L1 (closest to CPU), L2, and L3.
• Size: L1 is smallest but fastest; L3 is largest but slower.
• Mapping Techniques:
• Direct Mapping
• Fully Associative Mapping
• Set-Associative Mapping
Continues..
• Cache Hit: Data found in cache, leading to faster access.
• Cache Miss: Data not found in cache, requiring access from main
memory.
• Types of Misses:
• Compulsory Miss
• Capacity Miss
• Conflict Miss
• Cache misses increase access time and slow down processing.
Continues..
• Cache Coherence: Ensures that all caches in a multi-core system have
the most recent copy of data.
• Problems: Cache coherence problems arise in multi-core systems
when caches hold different copies of the same data.
• Solutions: Protocols like MESI (Modified, Exclusive, Shared, Invalid)
maintain consistency.
• Importance: Crucial for accurate and efficient multi-core processing.
Virtual memory
• In modern computers, physical main memory is not enough for the large
address space of the processor.
• When a program does not completely fit into the main memory, the parts
of it not currently being executed are stored on secondary storage devices.
• Techniques that automatically move program and data blocks into the
physical main memory when they are required for execution are called
virtual-memory techniques.
• When a new segment of a program is to be moved into the full memory, it
must replace another segment already in the memory.
• So the segments have to be transferred between main memory and the
secondary memory automatically by the OS.
• Virtual addresses will be translated into physical addresses.
• Technique that automatically move program and data block into main
memory when they are required for execution are called virtual memory.
• So the processor can address instruction and data space much more the
actual size.
• The binary addresses that the processor issues is called virtual or logical
address.
• This virtual addresses are translated to physical addresses by the
combination of hardware and software components.
• A unit called memory management unit(MMU) translates virtual address to
physical address.
Address Translation
• All programs and data are composed of fixed-length units called pages,
each of which consists of a block of words that occupy contiguous locations
in the main memory.
• Pages commonly ranges from 2K to 16K in length.
• Page cannot be too small or too large.
• The virtual memory mechanism bridges the size and speed gaps between
the main memory and secondary storage – similar to cache.
• The cache and virtual memory bridges the speed gap between the
processor and the main memory – but cache uses hardware and virtual
memory uses software.
• A virtual-memory address translation method based on fixed length pages.
Continues..
• Each virtual address has 2 parts :-
• virtual page number(high-order)
• offset(low-order)
• which specifies the location with in the page.
• Information about the main memory location of each page is kept in a page table.
• The contents of the page table are where the page is stored and current status of the
page.
• An area in the main memory that can hold one page is called page frame.
• The starting address of the page table is kept in a page table base register.
• By adding the virtual page number to content of page table base register, the address of
the corresponding entry in the page table is obtained.
• The content of this location gives the starting address of the page if that page currently
resides in the main memory.
PTBR holds
the address of
the page table. Page table address Virtual page number Offset

Virtual address is
interpreted as page
+ number and offset.

PAGE TABLE
PTBR + virtual
page number provide
the entry of the page
in the page table. This entry has the starting location
of the page.

Page table holds information


about each page. This includes
the starting address of the page
in the main memory.
Control Page frame
bits in memory Page frame Offset

Physical address in main memory


Continues..
• Control bits describes the one bit status of the page whether it is the main memory or
not.
• Another bit indicates whether the page has been modified during its residency in the
memory.
• By using this bit the memory determines whether the modified page has been updated.
• Other control bits indicate various restrictions that may be imposed on accessing the
page.
• Example: read and write permission, read only permission, etc.
• Other page table information is used by MMU for read and write access.
• The page table is situated inside MMU.
• MMU is normally a part of the processor, it is impossible to include a complete page
table on the processor.
• So page table is kept in main memory.
• And a copy of a small portion of the page table can be accommodated within the MMU.
Buffers
• A buffer is a temporary storage area used to hold data while it is
being transferred from one place to another.
• Commonly used in various computing processes to manage data
streams.
• Purpose of Buffers
• To handle differences in data processing speeds between devices or
processes.
• To prevent data loss during transfer.
• To ensure smooth and efficient data processing.
Continues..
• Types of Buffers
• Input Buffer: Holds data coming into a system before processing.
• Output Buffer: Holds data waiting to be sent out of a system.
• Double Buffering: Uses two buffers to overlap I/O operations with processing,
enhancing performance.
• Applications of Buffers
• Memory Buffers: Used in RAM to hold data temporarily during processing.
• Network Buffers: Manage data packets in network communications.
• File System Buffers: Temporary storage during file read/write operations.
What is UI?
• A User Interface (UI) allows interaction between a user and a
computer system.
• Two primary types: Graphical User Interface (GUI) and Character User
Interface (CUI).
GUI
• What is GUI?
• Graphical User Interface (GUI)
• A type of user interface that allows users to interact with electronic devices through
graphical icons and visual indicators.
• Examples include windows, icons, menus, and pointers (WIMP).
• Examples: Microsoft Windows, macOS, Android, iOS.
• Features of GUI
• Ease of Use: Intuitive(based on once understanding), user-friendly, no need to
memorize commands.
• Visual Interaction: Utilizes icons, buttons, and menus for navigation.
• Multitasking: Allows multiple applications to run simultaneously in different
windows.
• Rich Media Integration: Supports images, videos, and animations.
CUI
• What is CUI?
• Character User Interface (CUI)
• A type of user interface where users interact with the computer by typing
commands into a terminal or console.
• Relies on text-based input and output.
• Examples: MS-DOS, Unix Shell, Command Prompt.
• Features of CUI
• Efficiency: Faster for expert users who know the commands.
• Resource Light: Requires less system resources compared to GUI.
• Control: Provides greater control over the operating system and applications.
• Learning Curve: Requires memorization of commands; not as intuitive as GUI.
Difference between GUI and CUI
• GUI:
• User-friendly, suitable for beginners.
• Requires more system resources.
• Visual and interactive.
• CUI:
• Efficient for advanced users.
• Lower resource consumption.
• Command-based interaction.
• Applications and Use Cases
Comparison
• GUI:
• Common in modern operating systems, software applications, mobile devices.
• Ideal for tasks requiring ease of use and visual interaction.
• CUI:
• Preferred in server management, scripting, and when resources are limited.
• Ideal for automation, batch processing, and programming.
Software
• Software is a collection of instructions and data that tells a computer
how to perform specific tasks.
• It acts as a bridge between the user and the computer hardware.
• Types of Software
• System Software
• Application Software
• Middleware
System Software
• Definition:
• System Software is a type of software designed to manage and control the
hardware components of a computer.
• Primary Function:
• Acts as an intermediary between the user and the hardware.
• Examples:
• Operating Systems (e.g., Windows, macOS, Linux)
• Device Drivers
• Utility Programs (e.g., antivirus, disk management tools)
Continues..
• Features of System Software
• Hardware Management: Controls and coordinates hardware components like
CPU, memory, and I/O devices.
• Platform for Applications: Provides a platform for running application
software.
• Efficiency: Optimizes hardware usage and system performance.
• Background Operation: Runs in the background, often starting when the
computer is booted.
Application Software
• Definition:
• Application Software is designed to help users perform specific tasks or
activities.
• Primary Function:
• Provides functionality directly to the user for particular applications.
• Examples:
• Word Processors (e.g., Microsoft Word)
• Web Browsers (e.g., Google Chrome, Firefox)
• Media Players (e.g., VLC, Windows Media Player)
• Graphic Design Software (e.g., Adobe Photoshop)
Continues..
• Features of Application Software
• Task-Oriented: Designed to perform specific tasks such as word processing,
web browsing, or gaming.
• User Interaction: Directly interacts with users through GUIs.
• Customization: Often customizable to meet user preferences and needs.
• Resource Usage: Requires system software and hardware resources to
function.
System Software vs. Application Software

• System Software:
• Manages hardware and runs background processes.
• Essential for system functionality.
• Not directly used by end-users.
• Application Software:
• Performs specific user tasks.
• Not necessary for system operation but crucial for user productivity.
• Directly interacts with users.
Examples in Everyday Use
• System Software:
• Booting up a computer, managing files and directories.
• Application Software:
• Writing a document, creating a presentation, browsing the web.
Booting
• Booting is the process of starting a computer and loading the
operating system.
• Two types of booting:
• Cold Boot (from power off)
• Warm Boot (restarting without turning off).
Types of Booting
• Cold Boot:
• Initiating the computer from a completely powered-off state.
• Warm Boot:
• Restarting the computer without switching off the power, often done using
the "Restart" option.
Steps in the Booting Process
1. Power On:
The computer is powered on, and the power supply sends a signal to the CPU.
2. POST (Power-On Self Test):
The system checks the hardware components to ensure they are working correctly.
3. BIOS/UEFI(Unified Extensible Firmware Interface Execution:
BIOS/UEFI firmware initializes the hardware and loads the bootloader.
4. Bootloader Execution:
The bootloader loads the operating system into memory.
5. Operating System Loads:
The OS kernel is loaded into memory, and system processes start.
BIOS
• What is BIOS?
• Basic Input/Output System.
• It is firmware embedded on a computer's motherboard.
• Acts as an interface between the computer's hardware and operating system.
Functions of BIOS
• Power-On Self-Test (POST):
• Performs hardware diagnostics during startup.
• Boot Loader:
• Locates and launches the operating system.
• BIOS Setup Utility:
• Allows configuration of hardware settings.
• Hardware Abstraction:
• Provides a basic set of drivers for hardware communication.
BIOS Components
• BIOS ROM Chip:
• Non-volatile memory storing the BIOS firmware.
• CMOS (Complementary Metal-Oxide-Semiconductor):
• Stores system configuration settings.
• Powered by a small battery to retain settings when powered off.
• BIOS Setup Utility Interface:
• User-accessible interface for configuring system settings.
POST
• Power-On Self-Test (POST) Begins:
• When the PC is turned on, an electrical signal follows a programmed path to
the CPU, clearing leftover data from memory registers.
• The CPU's program counter is reset to a specific address (F000) where the
boot program is stored in the ROM BIOS.
• Boot Program Execution:
• The CPU finds and starts the ROM BIOS boot program.
• The boot program initiates a series of system checks to ensure proper
functioning.
• System Bus and Component Check:
• The CPU sends signals across the system bus to check the functionality of
connected components.
Continues..
• System Timer Verification:
• The CPU verifies that the system’s clock or timer is functioning properly to
ensure synchronized operations.
• Display Adapter and Video Signal Check:
• The POST checks the memory on the display adapter and video signals.
• The adapter's BIOS is integrated into the system's overall BIOS and memory
configuration, displaying the first output on the monitor.
• RAM Testing:
• The POST tests the RAM by writing and reading data to ensure the chips are
functioning correctly.
• On some systems, the monitor displays a running count of the tested
memory.
Continues..
• Keyboard Verification:
• The CPU checks if the keyboard is connected and if any keys have been
pressed.
• Drive Check:
• The POST sends signals to the floppy and hard disk drives to determine their
availability.
• POST Results Comparison:
• The POST results are compared with the data in the CMOS chip, which records
the system configuration.
• If new hardware is detected, the user can update the CMOS configuration.
Continues..
• Component BIOS Integration:
• Components like SCSI controllers may have their own BIOS, which is
incorporated into the system's BIOS.
• These BIOS codes may be copied from the CMOS chip to faster RAM.
• Plug and Play operations may also distribute resources among components.
• Loading the Operating System:
• The PC is now ready to load the operating system from disk, completing the
boot process.
Bootstrap Loader
• What is a Bootstrap Loader?
• A small program that resides in the computer's non-volatile memory (usually
ROM).
• It is the first code that executes when the computer is powered on or reset.
• Purpose: To load the operating system into the computer's main
memory (RAM).
Continues..
• Role in Booting Process
• Initial Step in Booting:
• When the computer is turned on, the CPU initializes and starts executing
instructions from a predefined location, usually the address of the bootstrap
loader.
• The bootstrap loader then loads the OS or a more complex bootloader from
storage (HDD, SSD).
Continues..
• Steps:
• Power-On Self Test (POST): Verifies the hardware integrity.
• Bootstrap Loader Execution: The CPU fetches the bootstrap loader from ROM.
• Loading the OS: The bootstrap loader locates and loads the OS kernel into
RAM.
• Transfer Control to OS: The control is handed over to the OS, initiating the
user environment.
Continues..
• Types of Bootstrap Loaders
• Simple Loader:
• Loads the OS directly from a predefined location.
• Complex Loader:
• Involves multiple stages, often loading an intermediate bootloader that then loads the
OS.
• Roles of Bootstrap Loader
• Ensures that the computer is in a known state before the OS is loaded.
• Provides the basic infrastructure for the OS to be loaded and start its
operation.
Kernel
• What is a Kernel?
• The kernel is the central component of an operating system.
• Acts as a bridge between hardware and software.
• Manages system resources and allows software to communicate with
hardware.
Continues..
• Functions of the Kernel
• Process Management:
• Controls and schedules processes for efficient execution.
• Memory Management:
• Allocates and deallocates memory to processes.
• Device Management:
• Manages device input/output requests and interfaces with device drivers.
• File System Management:
• Manages files and directories, handling data storage and retrieval.
• System Calls:
• Provides an interface for user applications to request services from the OS.
Continues..
• Types of Kernels
• Monolithic Kernel:
• All OS services run in kernel space.
• Examples: Linux, UNIX.
• Microkernel:
• Minimal kernel with only essential services in kernel space; others run in user space.
• Examples: Minix, QNX.
• Hybrid Kernel:
• Combines elements of both monolithic and microkernels.
• Examples: Windows NT, macOS.
Monolithic Kernel Vs Microkernel
• Monolithic Kernel:
• Pros: High performance, efficient system calls.
• Cons: Larger size, less modular, harder to maintain.
• Microkernel:
• Pros: Modular, easier to maintain and extend.
• Cons: Potentially slower due to more context switches.
Popular Kernels in Use
• Linux Kernel:
• Widely used in servers, desktops, and embedded systems.
• Windows NT Kernel:
• Used in all modern versions of Windows.
• XNU Kernel:
• Used in macOS and iOS.
Part II
Operating Systems
• Types of Operating Systems
• Batch Processing
• Multiprogramming
• Multitasking
• Multiprocessing
• Real-time system
Introduction
• Operating system is a system software that works as an interface
between computer hardware and user.
• An operating system is a well-organized collection of programs that
manages the computer hardware.
• An operating system (OS) is system software that manages computer
hardware and software resources, and provides common services for
computer programs.
• Operating systems manage and organize the resources and processes
of a computer.
Types of Operating Systems
• Batch Operating System
• Multi-Programming System
• Multi-Processing System
• Multi-Tasking Operating System
• Time-Sharing Operating System
• Distributed Operating System
• Network Operating System
• Real-Time Operating System
• Etc.
Batch Operating System
• Definition
• An operating system that executes jobs in batches without user interaction.
• Used primarily in early computing environments.
• History
• Introduced in the 1950s and 1960s.
• Designed to manage the execution of jobs automatically in sequence.
• Reduced idle time of computing systems by grouping similar jobs.
Continues..
Continues..
• Working Mechanism
• Users submit jobs to the operator.
• Jobs are grouped and executed in a queue.
• Output is delivered after the entire batch is processed.
• The operator is a person responsible for managing and controlling the execution
of jobs within the system. The operator plays a key role in the workflow of batch
processing.
• Duties of Operator
• Job Collection
• Job Scheduling
• Initiating Batch Execution
• Monitoring Execution
• Job Output Handling
• Error Handling
Continues..
• Key Characteristics of Batch OS
• Sequential Execution: Jobs are executed one after the other.
• No User Interaction: Once submitted, jobs run without further input.
• Efficient Resource Utilization: Minimizes CPU idle time by processing jobs
back-to-back.
• Job Scheduling: Automatically schedules jobs based on priorities.
• Examples of Batch OS
• Payroll processing.
• Bank statement generation.
• Large-scale data processing tasks like billing systems.
Advantages and Disadvantages
• Advantages
• Efficient handling of large volumes of data.
• Automation reduces manual intervention.
• Optimizes CPU usage and reduces downtime.
• Suitable for repetitive, time-consuming tasks.
• Disadvantages
• No real-time interaction with the system.
• Debugging is difficult as errors are detected after the entire batch is
processed.
• Not suitable for tasks requiring immediate results.
Continues..
• Is Batch Processing Still Relevant?
• Yes, especially in environments where high volumes of data are processed
periodically.
• Modern systems use batch processing alongside interactive systems for
efficiency.
Multiprogramming
• Definition:
• Multiprogramming is a method of running multiple programs simultaneously on a
single processor.
• Purpose:
• Maximize CPU utilization by overlapping the execution of multiple programs.
• Key Benefit:
• Minimizes CPU idle time.
• Process Overview:
• Multiple jobs are loaded into memory.
• CPU switches between jobs to keep multiple jobs progressing.
• Jobs in waiting (e.g., for I/O operations) do not block the CPU.
State diagram
Continues..
• Advantages of Multiprogramming
• Increased Throughput:
• More jobs are processed in less time.
• Efficient Resource Utilization:
• Better use of CPU, memory, and I/O devices.
• Reduced Idle Time:
• CPU remains active by switching to another job if one is waiting.
• Challenges of Multiprogramming
• Complexity in Job Scheduling:
• Requires sophisticated algorithms to optimize CPU usage.
• Memory Management:
• Needs advanced techniques like paging and segmentation.
• Context Switching Overhead:
• Time and resources spent in switching between jobs.
Multitasking
• Definition:
• Multitasking is the ability of an operating system to execute more than one
task simultaneously.
• Types of Multitasking:
• Preemptive Multitasking
• Cooperative Multitasking
Preemptive Multitasking
• The operating system allocates CPU time slices to each task.
• The OS can interrupt tasks to switch between them.
• Advantages:
• Improved responsiveness
• Fair CPU allocation
• Examples: Windows, Linux
Cooperative Multitasking
• Tasks voluntarily yield control to the OS to allow other tasks to run.
• Advantages:
• Simplicity
• Lower overhead
• Disadvantages:
• A misbehaving task can monopolize the CPU.
• Examples: Early versions of Mac OS, Windows 3.x
Multitasking -Diagram
Continues..
• Benefits of Multitasking
• Increased Efficiency.
• Tasks can run concurrently, reducing idle CPU time.
• Improved User Experience.
• Multiple applications can run simultaneously, improving productivity.
• Resource Sharing:
• Efficient use of CPU and memory resources.
Continues..
• Multitasking in Modern OS
• Explanation:
• Most modern operating systems use preemptive multitasking.
• Examples:
• Windows: Uses time slicing and priority levels.
• Linux: Utilizes the Completely Fair Scheduler (CFS).
• macOS: Based on Unix, supports robust multitasking
Multiprocessing
• Multiprocessing is the use of two or more CPUs (processors) within a
single computer system to execute multiple processes simultaneously.
• Two types of Multiprocessing Operating systems
• Symmetric Multiprocessing (SMP)
• Asymmetric Multiprocessing (AMP)
Symmetric Multiprocessing (SMP)
• All processors share a common memory and are treated equally by
the operating system.
• Advantages:
• Improved performance and load balancing.
• High availability and fault tolerance.
• Example:
• Modern multi-core processors.
Asymmetric Multiprocessing (AMP)
• Processors are assigned specific tasks; one is the master, and others
are slaves.
• Advantages:
• Simpler design and control.
• More predictable performance.
• Disadvantages:
• Limited scalability.
• Single point of failure in the master processor.
• Example:
• Older systems and specialized hardware.
Multiprocessing OS
Continues..
• : Benefits of Multiprocessing
• Increased Throughput:
• Multiple processes can be executed in parallel, improving overall system performance.
• Fault Tolerance:
• Failure of one processor does not halt the entire system.
• Scalability:
• Systems can be expanded by adding more processors.
Continues..
• : Challenges of Multiprocessing
• Complexity in Design:
• Managing multiple processors requires sophisticated algorithms.
• Synchronization Issues:
• Ensuring data consistency across processors.
• Cost:
• Higher hardware costs due to multiple processors.
Continues..
• Examples of Multiprocessing Systems:
• Linux: Supports SMP and NUMA (Non-Uniform Memory Access).
• Windows: Uses SMP for handling multiple processors.
• Unix: Historically, a strong foundation for multiprocessing.
Real-time system
• A real-time operating system is designed to process data and events
within a guaranteed time frame.
• Key Characteristics:
• Predictability
• How well the state of the system can be predicted, either quantitatively or qualitatively.
• Determinism:
• The ability to ensure that tasks are completed within a predetermined time frame, and
that the results are consistent and predictable.
• Low Latency
• The ability to process data quickly with minimal delay.
Continues..
• Types of Real-Time Systems
• Hard Real-Time Systems:
• Tasks must be completed within strict deadlines; failure to do so can lead to catastrophic
consequences.
• Examples:
• Airbag systems in cars, pacemakers.

• Soft Real-Time Systems:


• Deadlines are important but not absolutely critical. Some delay is acceptable.
• Examples:
• Video streaming, online transaction processing.
Continues..
Continues..
• Advantages of RTOS
• Deterministic Response:
• Predictable response times, crucial for time-sensitive applications.
• Efficient Resource Utilization:
• Optimizes the use of system resources like CPU and memory.
• High Reliability:
• Ensures system stability, essential for mission-critical applications.
Continues..
• Examples of RTOS
• VxWorks:
• Widely used in embedded systems and aerospace.
• FreeRTOS:
• Open-source RTOS for small embedded systems.
• RTLinux:
• Real-time variant of Linux for time-critical applications
Continues..
• Challenges in RTOS
• Complexity:
• Requires careful design and testing to ensure real-time guarantees.
• Resource Constraints:
• Must operate efficiently with limited CPU and memory resources.
• Cost:
• High development and maintenance costs, especially in safety-critical systems.
Part III
Syllabus
• Concept of a Process: Process States, Process Control Block, Context
Switch, Thread, Multi-Thread. CPU Scheduling criteria- CPU
scheduling algorithms-FCFS, SJFS, SRTF, Round Robin, Priority
Scheduling.
Process
• Process
• It is a program in execution.
• A process is the unit of work in a modern time-sharing system.
• More than just the program code; includes current activity like the program counter
and processor registers.
• CPU Activities in Operating Systems:
• Batch Systems:
• Activities referred to as jobs.
• Time-Shared Systems:
• Activities called tasks or user programs.
• Single-User Systems:
• Multiple programs can run simultaneously.
• Includes internal activities like memory management.
Process
• Components of a Process:
• Program Code: Also known as the text section.
• Current Activity: Program counter and register contents.
• Process Stack: Contains temporary data such as function parameters, return
addresses, and local variables.
• Data Section: Holds global variables.
• Heap: Dynamically allocated memory during process runtime.
Continues..
• Process vs. Program:
• Program:
• A passive entity (e.g., an executable file stored on disk).
• Process:
• An active entity with associated resources.
• Becomes a process when the executable file is loaded into memory.
Process States
• A process changes state as it executes, based on its current activity.
• Key Process States:
• New: The process is being created.
• Running: The process is currently executing instructions.
• Waiting: The process is waiting for an event to occur (e.g., I/O completion).
• Ready: The process is waiting to be assigned to a processor.
• Terminated: The process has completed execution.
Process States
Process Control Block
• A Process Control Block (PCB) represents a process within an
operating system.
• It contains essential information associated with a specific process.
• The PCB is crucial for process management, allowing the operating
system to maintain and control process execution effectively.
Continues..
• Key Components of a PCB:
• Process State:
• Indicates the current state of the process (e.g., new, ready, running, waiting, halted).
• Program Counter:
• Holds the address of the next instruction to be executed.
• CPU Registers:
• Includes accumulators, index registers, stack pointers, and general-purpose registers.
• State information is saved during interrupts to resume process execution correctly.
• CPU-Scheduling Information:
• Contains process priority, scheduling queue pointers, and other scheduling parameters.
Continues..
• Memory-Management Information:
• May include base/limit register values, page tables, or segment tables based on the
memory management system.
• Accounting Information:
• This includes details such as the amount of CPU and real time used by a process, time
limits, account numbers, and job or process numbers.
• I/O Status Information:
• This consists of the list of I/O devices allocated to the process and a list of open files.
Continues..
Thread
• A thread is the smallest unit of execution within a process.
• A thread is a lightweight process, sharing resources like memory and
files with other threads within the same process.
• Threads share the same process resources, such as memory and open
files, but execute independently.
• Allows for multiple sequences of instructions to be run simultaneously
within a single process.
Continues..
• Benefits of Using Threads
• Improved Application Responsiveness:
• Threads allow programs to remain responsive while performing background tasks.
• Resource Sharing:
• Threads share the same memory and resources, making communication between
them faster and easier.
• Efficient CPU Utilization:
• Threads enable better utilization of CPU resources by allowing multiple tasks to run
in parallel, especially on multicore systems.
• Simpler Program Structure:
• Multithreading can simplify the design of complex applications by dividing tasks into
smaller, manageable threads.
Continues..
• Thread Life Cycle
• New:
• The thread is created but not yet started.
• Runnable:
• The thread is ready to run and waiting for CPU time.
• Running:
• The thread is currently executing.
• Blocked/Waiting:
• The thread is waiting for an event or resource.
• Terminated:
• The thread has finished execution
State Diagram
Thread vs. Process
• Process: Heavyweight, isolated, with its own memory space.
• Thread: Lightweight, shared memory space, faster context switching.
Multi-Thread
• Multithreading is the ability of a CPU or an operating system to
manage multiple threads of execution within a single process.
• Each thread can run independently, allowing for concurrent execution
of tasks.
• Why is Multithreading Important?
• Enhances performance, especially on multicore processors.
• Improves application responsiveness and efficiency.
Benefits of Multithreading
• Increased Responsiveness:
• Applications remain responsive while performing background tasks.
• Resource Sharing:
• Threads within a process share resources, leading to efficient resource
utilization.
• Improved Throughput:
• Multiple threads can perform tasks simultaneously, increasing overall system
throughput.
• Scalability:
• On multicore systems, threads can run in parallel, making better use of
available CPU cores.
Context Switch
• Interrupt Occurrence:
• Interrupts cause the CPU to switch from its current task to execute a kernel
routine.
• The current process's state must be preserved to resume it later.
• Saving Process Context:
• The Process Control Block (PCB) stores the context, including:
• CPU registers.
• Memory management information.
• Process state.
Continues..
• Context Switching involves:
• Saving the context of the current process.
• Loading the context of the next process.
• Overhead: Adds Factors Affecting Context Switch Speed:
• Hardware Support:
• The presence of multiple register sets (e.g., Sun UltraSPARC).
• Operating System Complexity:
• Advanced memory management techniques.
• Impact on System Performance:
• More complex systems and memory management increase the workload
during context switches
How context switching works?
CPU scheduling
• Single-Processor Limitation:
• Only one process can run at a time.
• Other processes must wait until the CPU is available.
• Objective of Multiprogramming:
• Maximize CPU Utilization by keeping multiple processes in memory.
• Switches CPU from one process to another when waiting occurs (e.g., during
I/O operations).
• How productivity of CPU can be increased?
• Ensures that the CPU is always engaged in productive tasks.
• Reduces idle time, enhancing overall system efficiency.
Continues..
• Importance of CPU Scheduling:
• Central to optimizing computer
resource usage.
• Ensures continuous work progress
even when processes must wait.
CPU Burst Vs I/O Burst
• CPU Burst
• Definition: A period when a process is actively using the CPU for computations.
• Characteristics:
• High CPU usage.
• Short intervals of intense processing.
• Example: Calculating complex algorithms or data processing.
• I/O Burst:
• Definition: A period when a process is waiting for I/O operations to complete (e.g.,
reading from disk, network operations).
• Characteristics:
• Low CPU usage.
• Processes wait for I/O operations, causing the CPU to be idle.
• Example: Reading data from a file or waiting for user input.
CPU-Bound Programs Vs I/O-Bound Programs
• CPU-Bound Programs:
• Definition: Programs that spend most of their time in CPU bursts.
• Characteristics:
• Require extensive computation.
• Performance depends heavily on CPU speed.
• Example: Scientific simulations, mathematical computations.
• I/O-Bound Programs:
• Definition: Programs that spend most of their time in I/O bursts.
• Characteristics:
• Limited CPU usage.
• Performance depends on I/O device speed.
• Example: File copying, web browsing.
Histogram of CPU-burst durations of a
average program.
CPU Scheduling criteria
• Whenever the CPU becomes idle, the operating system must select
one of the processes in the ready queue to be executed.
• The selection process is carried out by the short-term scheduler, or
CPU scheduler.
• The scheduler selects a process from the processes in memory that
are ready to execute and allocates the CPU to that process.
• CPU scheduling is the process by which the operating system decides
which task (process) gets to use the CPU and for how long.
• This is to maximize CPU utilization, ensure fairness, and achieve
efficient process management.
Two types of scheduling
• Non-preemptive
• Once CPU is assigned, it is not taken away until the process finishes
• Preemptive
• CPU can be taken away before the process completes
FCFS
• Non-preemptive
• Processes are executed in the order they arrive in the ready queue.
• Advantages:
• Simple to implement
• Fair in the order of arrival
• Disadvantages:
• May lead to long wait times (especially for longer processes)
• The "Convoy Effect" (short processes behind a long one)
• Example:
• P1 (burst: 6), P2 (burst: 4), P3 (burst: 2)
• Execution: P1 → P2 → P3
SJFS
• Shortest Job First (SJF)
• Non-preemptive
• The process with the shortest CPU burst time is executed next.
• Advantages:
• Minimizes average waiting time
• Disadvantages:
• Difficult to predict CPU burst time
• Can lead to "starvation" (long processes waiting indefinitely)
• Example:
• P1 (burst: 6), P2 (burst: 4), P3 (burst: 2)
• Execution: P3 → P2 → P1
SRTF
• Shortest Remaining Time First (SRTF)
• Preemptive version of SJF
• The process with the shortest remaining burst time is selected, and a
running process can be preempted if a new process has a shorter burst
time.
• Advantages:
• Better turnaround time than SJF in some cases
• Disadvantages:
• Risk of starvation for long processes
• Example:
• P1 (burst: 8), P2 (burst: 4), P3 (burst: 1)
• If P3 arrives while P1 is executing, P1 is preempted.
Round Robin
• Round Robin (RR)
• Preemptive
• Each process is given a fixed time slice or quantum (e.g., 4ms). When a process's time
slice expires, it's moved to the back of the queue, and the next process is executed.
• Advantages:
• Fair, every process gets CPU time
• Suitable for time-sharing systems
• Disadvantages:
• Performance depends on the choice of time quantum (too small causes overhead, too large
behaves like FCFS)
• Example:
• P1 (burst: 8), P2 (burst: 4), P3 (burst: 2), Time Quantum: 4
• Execution: P1 → P2 → P3 → P1 (remaining 4)
Priority Scheduling.
• Priority Scheduling
• Can be preemptive or non-preemptive
• The process with the highest priority (lowest number) is selected for
execution. In case of tie, FCFS may be used.
• Advantages:
• Important processes get executed first
• Disadvantages:
• Risk of starvation(waiting) for low-priority processes (solved by aging)
• Example:
• P1 (priority: 3), P2 (priority: 1), P3 (priority: 2)
• Execution: P2 → P3 → P1

You might also like