Operating Systems-1
Operating Systems-1
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
sector
head
Continues..
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.
• 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.