SlideShare a Scribd company logo
Operating Systems
Introduction
Dr.M.Sivakumar
AP,NWC, SRMIST
Introduction
1. Computer-System Organization, Computer-System Architecture,
2. Operating-System Structure
3. Operating-System Operations
4. Process Management, Memory Management, Storage Management, Protection and
Security
5. Kernel Data Structures, Computing Environments, Open Source Operating Systems,
6. Operating System Services, User and Operating System Interface,
7. System Calls, Types of System Calls, System Programs,
8. Operating System Design and Implementation,
9. Operating System Structure, Operating-System Debugging, Operating System
Generation, System Boot.
SESSION-1
Introduction, Computers- System Organization, Computer-System Architecture
What is an Operating System?
• A program that acts as an intermediary between a user of a computer
and the computer hardware
• Operating system goals:
– Execute user programs and make solving user problems easier
– Make the computer system convenient to use
– Use the computer hardware in an efficient manner
Example Operating Systems
Desktop and Laptop Operating Systems
Mobile Operating Systems
Server Operating Systems
Embedded Operating Systems
Real-Time Operating Systems (RTOS)
Specialized and Less Common Operating Systems
Example Operating Systems
Desktop and Laptop Operating Systems
• Windows
– Windows 10
– Windows 11
– Windows 7 (though officially unsupported, it still has users)
• macOS
– macOS Ventura
– macOS Monterey
– macOS Big Sur
• Linux Distributions
– Ubuntu
– Fedora
– Debian
– CentOS
– Red Hat Enterprise Linux (RHEL)
– Linux Mint
– Arch Linux
Real-Time Operating Systems (RTOS)
• VxWorks
• FreeRTOS
• RTLinux
• QNX
Mobile Operating Systems
• Android
– Android 13
– Android 12
• iOS
– iOS 16
– iOS 15
Server Operating Systems
• Windows Server
– Windows Server 2022
– Windows Server 2019
• Linux Distributions for Servers
– Ubuntu Server
– CentOS Stream
– Red Hat Enterprise Linux (RHEL)
– SUSE Linux Enterprise Server
– Debian
• UNIX-Based Systems
– AIX (IBM)
– HP-UX (Hewlett-Packard)
– Solaris (Oracle)
Embedded Operating Systems
• Embedded Linux
• Windows Embedded
• Tizen
• Contiki
Specialized and Less Common
Operating Systems
• FreeBSD
• OpenBSD
• NetBSD
• Haiku
• ReactOS
Computer System Structure
• Computer system can be divided into four components:
1. Hardware
• provides basic computing resources
• CPU, memory, I/O devices
2. Operating system
• Controls and coordinates use of hardware among
various applications and users
3. Application programs
• define the ways in which the system resources are
used to solve the computing problems of the users
• Word processors, compilers, web browsers, database
systems, video games
4. Users
• People, machines, other computers
What Operating Systems Do
• Depends on the point of view
– User View
– System View
• User View
– Users want convenience, ease of use and good performance
– But shared computer such as mainframe or minicomputer must keep all users happy
– Users of dedicate systems such as workstations have dedicated resources but frequently use shared resources
from servers
– Handheld computers are resource poor, optimized for usability and battery life
– Some computers have little or no user interface, such as embedded computers in devices and automobiles
• System View
– Resource Allocator (CPU time, memory space, file-storage space, I/O devices)
– Control Program : manages the execution of user programs to prevent errors and improper use of the
computer
Defining Operating Systems
• OS is a resource allocator
– Manages all resources
– Decides between conflicting requests for efficient and fair resource use
• OS is a control program
– Controls execution of programs to prevent errors and improper use of the
computer
Defining Operating Systems
• The operating system is the one program running at all times on the computer—
usually called the kernel.
• Along with the kernel, there are two other
types of programs:
• System programs, which are associated
with the operating system but are not
necessarily part of the kernel
• Application programs, which include all
programs not associated with the
operation of the system
Computer-System Organization
• Computer-System Operation
• Storage Structure
• I/O Structure
Computer-System Organization
Computer-System Operation
• A modern general-purpose computer system consists of one or more CPUs and a
number of device controllers connected through a common bus that provides access
to shared memory
• Each device controller is in charge of a
specific type of device (for Example, disk
drives, audio devices, or video displays)
• The CPU and the device controllers can
execute in parallel, competing for memory
cycles.
Computer-System Organization
Computer-System Operation
• Bootstrap Program
• When computer is powered up or rebooted—it
needs to have an initial program to run
• It is stored within the computer hardware in read-
only memory (ROM)
• The bootstrap program must know how to load
the operating system and how to start executing
that system.
• The bootstrap program must locate the
operating-system kernel and load it into memory
• Once the kernel is loaded and executing, it can
start providing services to the system and its
users.
Computer-System Organization
Computer-System Operation
• Interrupt (Hardware / Software)
– Hardware may trigger an interrupt at any time by sending a
signal to the CPU, usually by way of the system bus
– Software may trigger an interrupt by executing a special
operation called a system call
– When the CPU is interrupted, it stops what it is doing and
immediately transfers execution to a fixed location
– Each computer design has its own interrupt mechanism
– Interrupt Vector: A table of pointers to interrupt routines
can be used
• System processes, or System daemons
• Some services are provided outside of the kernel, by system programs that are loaded into
memory at boot time
• run the entire time the kernel is running
Interrupt Timeline
Computer-System Organization
Storage Structure
• Register
– Fastest, smallest storage directly within the CPU
• Cache
– Small, fast memory between CPU and main memory, improves performance
• Main Memory
– Volatile, primary storage for active programs and data
• Solid-state disks
– Non-volatile, faster than magnetic disks, uses flash memory
• Magnetic disk
– Non-volatile, large capacity, slower than SSDs, e.g., hard drives
• Optical Disk
– Non-volatile, used for distribution and backup, e.g., CDs, DVDs
• Magnetic tape
– Non-volatile, used for archival storage, high capacity, slow access
Storage systems organized in hierarchy by
Speed, Cost, Volatility
Computer-System Organization
I/O Structure
• Importance of I/O Management
• Crucial for system reliability and performance due to
varied device nature.
• System Architecture:
• Components: CPUs, device controllers, common bus.
• Device Controllers: Manage specific device types,
have local buffers and special-purpose registers.
• Device Driver: Provides a uniform interface to the
device, communicates with the device controller.
• I/O Operation Process:
1.Device driver loads registers in the device controller.
2.Device controller determines action (e.g., read/write).
3.Data is transferred to/from the device to the controller's
local buffer.
4.Device controller signals completion via interrupt.
5.Device driver returns control/data/status to the OS.
Computer-System Organization
I/O Structure
• Interrupt-driven I/O
• Suitable for small data transfers, high overhead for bulk
transfers.
• Direct Memory Access (DMA):
• Transfers data directly between device and memory.
• Reduces CPU involvement, generates fewer interrupts.
• High-End System Architecture:
• Switch Architecture
• Allows concurrent communication between multiple
components.
• Enhanced DMA
• More effective in systems with switch architecture.
Computer-System Architecture
Single-Processor Systems Multiprocessor Systems Clustered Systems
Single-Processor Systems
• System Classification:
– Single-Processor System: Defined as having only one general-purpose
CPU.
– Multiprocessor System: Requires multiple general-purpose CPUs.
– The presence of special-purpose microprocessors does not classify the
system as a multiprocessor system if there is only one general-
purpose CPU.
• Single-Processor System:
• Main CPU: Executes a general-purpose instruction set, including instructions from user processes.
• Special-Purpose Processors: Present in the form of device-specific processors (e.g., disk, keyboard, graphics controllers) or more
general-purpose processors (e.g., I/O processors).
• Special-Purpose Processors:
• Limited Instruction Set: Run a limited instruction set and do not run user processes.
• Managed by the Operating System:
• Example: A disk-controller microprocessor receives tasks from the main CPU, manages its own disk queue, and schedules
algorithm, reducing the main CPU's overhead.
• Example: A keyboard microprocessor converts keystrokes into codes for the CPU.
• Autonomous Operation: In some cases, these processors operate independently and are not managed by the operating system.
Multiprocessor Systems
• Multiprocessor systems have two or more processors in close communication, sharing the computer bus and sometimes
the clock, memory, and peripheral devices.
• Types:
– Asymmetric multiprocessing
• Each processor is assigned a specific task
• A boss processor controls the system; the other processors either look to the boss for instruction or have
predefined tasks (boss–worker relationship)
• Boss processor schedules and allocates work to the worker processors
– Symmetric multiprocessing (SMP)
• each processor performs all tasks within the operating system
• All processors share physical memory
• Examples: AIX, UNIX
• Advantages
1. Increased throughput
2. Economy of scale
3. Increased reliability
Multiprocessor Systems
• Multicore Processor
– CPU design is to include multiple computing cores on a single chip
– Advantages
• More efficient than multiple chips with single cores because on-chip
communication is faster than between-chip communication
• One chip with multiple cores uses significantly less power than multiple
single-core chips.
– Multicore systems are multiprocessor systems, not all multiprocessor systems
are multicore
• Blade servers
• A relatively recent development in which multiple
processor boards, I/O boards, and networking
boards are placed in the same chassis
• Each blade-processor board boots independently
and runs its own operating system
Clustered Systems
• Gathers together multiple CPUs. Composed of two or
more individual systems—or nodes—joined together
• Each node may be a single processor system or a
multicore system
• Share storage and are closely linked via a local-area
network LAN
• Types
• Asymmetric Clustering
• one machine is in hot-standby mode while the other is running the applications
• Hot-standby host machine does nothing but monitor the active server
• If that server fails, the hot-standby host becomes the active server
• Symmetric Clustering
• Two or more hosts are running applications and are monitoring each other
• Some clusters are for high-performance computing (HPC)
• Applications must be written to use parallelization
• Some have distributed lock manager (DLM) to avoid conflicting operations
SESSION-02
Operating-System Structure, Operating- System Operations, Process Management, Memory Management,
Storage Management.
Operating-System Structure
• Operating Systems
– Environment for Program Execution: Provides the environment within which programs are executed.
– Variety in Makeup: Internally, operating systems vary greatly but share many commonalities.
• Multiprogramming
– Purpose: Increases CPU utilization by organizing jobs so that the CPU always has one to execute.
– Memory Management: Keeps several jobs in memory simultaneously. Jobs are initially kept on disk in a
job pool.
– Job Execution: The operating system picks and executes one job from memory. When the job waits
(e.g., for I/O), the CPU switches to another job.
– Continuous CPU Utilization: Ensures the CPU is never idle as long as there is at least one job to execute.
• Time Sharing (Multitasking)
• Logical Extension of Multiprogramming: Allows users to interact with programs while they are running.
• Interactive Systems: Provides direct communication between user and system through input devices (e.g., keyboard,
mouse) and output devices.
• Rapid Switching: CPU switches rapidly between users, giving the impression that the entire system is dedicated to each
user.
• CPU Scheduling and Multiprogramming: Uses these techniques to give each user a small portion of CPU time.
• Processes and I/O: Processes execute for short times and often perform interactive I/O, which may be slow.
Memory layout for a
multiprogramming
system
Operating-System Structure
• Memory Management and Scheduling
– Job Scheduling: Decides which jobs to load into memory when there is insufficient space for all.
– CPU Scheduling: Determines which job runs first when multiple jobs are ready to run.
– Concurrency: Limits jobs' ability to affect one another across all system phases (e.g., process scheduling, disk
storage, memory management).
• Response Time and Memory Techniques
– Swapping: Swaps processes in and out of memory to disk to ensure reasonable response time.
– Virtual Memory: Allows execution of processes not completely in memory. It enables running larger programs than
the actual physical memory and abstracts main memory.
• Additional System Requirements
– File System: Manages files residing on disks.
– Disk Management: Ensures efficient disk usage.
– Resource Protection: Protects resources from inappropriate use.
– Job Synchronization and Communication: Provides mechanisms to synchronize and communicate between jobs.
– Deadlock Prevention: Ensures jobs do not get stuck waiting for each other indefinitely.
Operating-System Operations
• Interrupt-Driven Nature of Operating Systems
• Dual-Mode and Multimode Operation
• Extended Modes
• Instruction Execution Life Cycle
• Hardware Protection
• Timers
Operating-System Operations
Interrupt-Driven Nature of Operating Systems
• Interrupts and Traps
– Interrupts: Signal events that require immediate attention.
– Traps (Exceptions): Software-generated interrupts caused by errors (e.g., division by zero) or specific user
requests for OS services.
• Interrupt Service Routine: Specific code segments handle different types of interrupts.
Dual-Mode and Multimode Operation
• User Mode and Kernel Mode
– Mode Bit: A hardware bit distinguishes between user mode (1) and kernel mode (0).
– Kernel Mode: The OS executes with full privileges.
– User Mode: Applications execute with limited privileges.
• Transition Between Modes
– System Calls: User applications request OS services, causing a switch from user mode to kernel mode.
– Interrupts and Traps: Automatically switch the mode to kernel mode.
– Privileged Instructions: Certain instructions (e.g., I/O control, timer management) can only be executed in kernel
mode to protect the system.
Introduction to Operating Systems and its basics
Operating-System Operations
• Extended Modes
– Virtualization: CPUs may have additional modes for virtualization (e.g., Virtual Machine Manager mode) with privileges
between user mode and kernel mode.
– Privilege Levels: Some CPUs, like Intel 64, support multiple privilege levels instead of a simple dual-mode system.
• Instruction Execution Life Cycle:
– Boot Time: Starts in kernel mode, loads the OS, and switches to user mode for applications.
– System Calls: User programs request OS actions, switching from user to kernel mode and back.
– System Calls:
• Mechanism: A method for user programs to request OS services, often implemented as traps.
• Handling: The OS examines the request, verifies parameters, executes the request, and returns control to the user program.
• Hardware Protection
– MS-DOS Example: Lacked dual-mode support, leading to potential system corruption by user programs.
– Modern Systems: Utilize dual-mode operation for better protection and error handling.
– Timers:
– Purpose: Ensure the OS maintains control over the CPU, preventing user programs from running indefinitely.
– Implementation: A timer interrupts the system after a specified period, either fixed or variable.
– Usage: The OS sets a timer before transferring control to a user program. If the timer interrupts, control returns to the OS,
which can terminate or extend the program's execution time.
Resource Management
OS Functions
Process
Management
Memory
Management
File-System
Management
Mass-Storage
Management
Cache
Management
I/O System
Management
• An operating system (OS) is a resource manager
• The system’s CPU, memory space, file-storage space, and I/O devices are among the
resources that the operating system must manage.
Process Management
• Process
– A program in execution.
– Examples: A time-shared user program (e.g., compiler), a word-processing program, or a
system task (e.g., sending output to a printer).
• Program vs. Process
– Program: A passive entity (e.g., a file stored on disk).
– Process: An active entity (execution instance of a program).
• Process Resources
– Required Resources: CPU time, memory, files, I/O devices.
• Resources are allocated at creation or during execution.
– Initialization Data: Input data necessary for the process to accomplish its task (e.g., file name
for a process displaying file status).
Process Management
Process Management
• Process Execution
– Sequential Execution: The CPU executes one instruction after another from the process until
completion.
• Program Counter: Keeps track of the next instruction to execute.
– Single Instruction at a Time: At most, one instruction is executed at any given time for a process.
– Multiple Processes from the Same Program: They are considered separate execution sequences.
• Multithreading
– Multithreaded Process: Has multiple program counters, each for a different thread.
• System Work Unit
– Collection of Processes: A system consists of both operating-system processes (executing system
code) and user processes (executing user code).
– Concurrent Execution: Processes can execute concurrently, often by multiplexing on a single CPU.
Process Management
• Operating System Responsibilities for Process Management
– Scheduling: Scheduling processes and threads on CPUs.
– Creation and Deletion: Creating and deleting both user and system processes.
– Suspension and Resumption: Suspending and resuming processes.
– Synchronization Mechanisms: Providing mechanisms for process synchronization.
– Communication Mechanisms: Providing mechanisms for process communication.
Memory Management
• To execute a program all (or part) of the instructions must be in memory
• All (or part) of the data that is needed by the program must be in memory.
• Memory management determines what is in memory and 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
• To make the computer system convenient for users, the operating system (OS)
provides a uniform, logical view of information storage
• The OS system abstracts from the physical properties of its storage devices to
define a logical storage unit, the file.
• The operating system maps files onto physical media and accesses these files via
the storage devices
• Classified as,
– File-System Management
– Mass-Storage Management
– Caching
– I/O Systems
File-System Management
• Files usually organized into directories
• Access control on most systems to determine who can access what
• OS 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
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
• OS activities
– Mounting and unmounting
– Free-space management
– Storage allocation
– Disk scheduling
– Partitioning
– Protection
• Some storage need not be fast
• Tertiary storage includes optical storage,
magnetic tape
• Still must be managed – by OS or applications
• Varies between WORM (write-once, read-
many-times) and RW (read-write)
Characteristics of various types of storage
Caching Management
• Caching is a technique used to store copies of data in a faster storage
system temporarily
• Information is usually kept in slower, larger storage systems (like main
memory) and copied into faster, smaller caches.
• When data is needed, the system first checks the cache. If the data is
present (cache hit), it is used from the cache. If not (cache miss), it is
retrieved from the main storage and copied to the cache.
• Each CPU in a multiprocessor system has its own cache, which can
lead to multiple copies of the same data.
Data Movement in Storage Hierarchies
• Data movement between storage levels can be controlled by hardware
(implicit) or the operating system (explicit).
• Moving data from disk to memory is often controlled by the OS, while
moving data from cache to CPU is usually handled by hardware.
I/O Systems Management
• The I/O subsystem consists of several components:
– A memory-management component that includes buffering, caching, and
spooling
– A general device-driver interface
– Drivers for specific hardware devices
SESSION-03
Protection and Security
Kernel Data Structures
Computing Environments
Protection and Security
Protection
• Mechanisms that control access to resources by processes or users, ensuring that only authorized
entities can operate on those resources.
• Protection Mechanisms
– Authorization: Ensuring that only authorized processes or users can access files, memory
segments, CPU, and other resources.
– Memory Addressing Hardware: Ensures processes operate within their own address space.
– CPU Timer: Ensures no process monopolizes the CPU by eventually forcing it to relinquish control.
– Device-Control Registers: Protect peripheral devices by restricting user access.
• Importance of Protection
– Reliability: Detecting errors at subsystem interfaces early to prevent contamination of healthy
subsystems.
– Distinguishing Usage: Differentiating between authorized and unauthorized or incompetent users to
prevent misuse
Protection and Security
Security
• Measures that protect a system from external and internal attacks, preventing unauthorized access,
data breaches, and other malicious activities.
• Security Mechanisms
– Authentication: Ensuring that users are who they claim to be.
– Prevention of Attacks: Defending against viruses, worms, denial-of-service attacks, identity theft,
and theft of service.
– System Security Features: Implemented by the operating system or additional software to prevent
security breaches.
• Authentication and Authorization Process
– Login Process: User provides credentials, and the system assigns a UID upon successful
authentication.
– Association: The UID is linked to all processes and threads of the user.
– Group Membership: Users can belong to multiple groups, each with its own GID, which grants
varying levels of access.
Protection and Security
• User Identification and Access Control
– User IDs (UIDs): Unique identifiers for users, used to associate users with their processes
and threads.
– Group IDs (GIDs): Identifiers for sets of users, allowing differentiated access based on group
membership.
– Security IDs (SIDs): Windows term for user IDs.
• Privilege Escalation
– Need for Escalation: Sometimes users need additional permissions for specific tasks, like
accessing restricted devices.
– Methods:
• UNIX setuid: Programs can run with the UID of the file owner rather than the current
user, providing temporary elevated privileges.
• Effective UID: The elevated privileges last until explicitly turned off or the process
terminates.
Protection and Security
• Practical Examples
– File Access in UNIX: File owners have full control, while specific groups can have read-only
access.
– Windows User and Group Management: Using SIDs to manage permissions and access
control.
Kernal
• The kernel is a computer program at
the core of a computer's operating
system and generally has complete
control over everything in the system.
• It is the portion of the operating
system code that is always resident in
memory and facilitates interactions
between hardware and software
components
Kernel Data Structures
• Data structures are ways to organize and store data for efficient access and
modification.
• Understanding basic data structures is fundamental for problem-solving and efficient
algorithm design in computer science
• Basic Data Structures
– Array
– List
– Stack
– Queue
– Tree
– Hash functions and Maps
– Bitmaps
Arrays
• An array is a collection of elements stored at contiguous memory
locations.
• Each element can be accessed directly using its index.
• Arrays have a fixed size, defined at the time of their creation.
• Example: Main memory is constructed as an array.
• Limitations:
• Fixed size: Cannot accommodate varying sizes easily.
• Deletion: Removing an item requires shifting elements to
maintain order.
Kernel Data Structures
Lists
• A list is a collection of elements that can be accessed sequentially
• linked list, in which items are linked to one another
• Types of Linked Lists:
• Singly Linked List: Each element points
to its successor.
• Doubly Linked List: Each element
points to both its predecessor and
successor.
• Circularly Linked List: The last element
points back to the first element.
• Drawback: Access time is linear (O(n)), as elements must be traversed sequentially.
Kernel Data Structures
Stacks
• Operations:
– Push: Adds an item to the top of the stack.
– Pop: Removes the top item from the stack.
• Usage in Operating Systems
– Function calls: Parameters, local variables, and
return addresses are pushed onto the stack during
function calls and popped off upon return.
• Examples: Undo mechanisms in text editors,
backtracking algorithms.
• A stack is a sequentially ordered data structure that follows the Last In, First Out
(LIFO) principle.
Kernel Data Structures
Queues
• Operations
– Enqueue: Adds an item to the end of the queue.
– Dequeue: Removes the item from the front of the
queue.
• Usage in Operating Systems
– Print jobs: Printed in the order they were
submitted.
– CPU task scheduling: Tasks waiting to be run are
organized in queues.
• Examples: Lines at a checkout counter, traffic signals.
• A queue is a sequentially ordered data structure that follows the First In, First Out (FIFO) principle.
Kernel Data Structures
Trees
• A tree is a hierarchical data structure consisting of
nodes linked through parent-child relationships.
• Components:
– Node: Basic unit containing data.
– Root: Topmost node with no parent.
– Edge: Link between parent and child.
– Leaf: Node with no children.
– Subtree: Tree consisting of a node and its
descendants.
• General Trees
• Structure: Each node can have an unlimited number of
children.
• Usage: Representing hierarchical data like
organizational structures, file systems.
• Binary Trees
• A tree where each node has at most two children,
referred to as the left child and the right child.
• Properties:
• Simplifies tree traversal and management.
• Suitable for binary operations and expressions.
• Binary Search Trees (BST)
• A binary tree with an ordering property where for each
node:
• Left child ≤ Parent node.
• Right child ≥ Parent node.
• Example: Show a diagram of a BST.
Kernel Data Structures
Trees
• Operations in BST
– Insertion: Adding a new node while maintaining the BST property.
– Deletion: Removing a node and reorganizing the tree to maintain the BST property.
– Search: Finding a node with a specific value.
• Balancing Algorithms
– Need for Balancing: To prevent performance degradation in BST operations.
– Common Balancing Techniques:
• AVL Trees: Self-balancing BST where the difference in heights of left and right subtrees is at most one for
all nodes.
• Red-Black Trees: Balanced BST where nodes have an extra color attribute to ensure the tree remains
balanced after insertions and deletions.
• Practical Applications
– Databases: Efficiently managing indexes.
– File Systems: Hierarchical file directory structures.
– Networking: Routing algorithms and multicast trees.
Kernel Data Structures
Hash Functions and Hash maps
• Hash Function
– A hash function takes data as input, performs a numeric operation, and returns a numeric value (hash).
– Quickly retrieves data by using the hash value as an index into a table (typically an array).
– Searching for a data item using a hash function can be as efficient as O(1), compared to O(n) for a linear search
through a list.
– Extensively used in operating systems for fast data retrieval.
• Hash Map
• A data structure that uses a hash function to map [key: value ] pairs.
• Apply the hash function to the key to obtain the value from the hash map.
• Example
• User authentication: Map a user name to a password.
• Steps:
• User enters their user name and password.
• Apply the hash function to the user name.
• Use the hash value to retrieve the stored password.
• Compare the retrieved password with the entered password for
authentication.
Applications of Hash Functions and Maps
• Databases
– Indexing and retrieving records efficiently.
• Caching
– Storing frequently accessed data for quick retrieval
• Password Management
– Storing hashed passwords for secure authentication.
• Symbol Tables
– Compiler design for variable and function lookups.
Kernel Data Structures
Bitmaps
• A bitmap is a string of binary digits (bits) representing the status of items
• Commonly used to track the availability of resources in an efficient manner
• Binary Digits
– Each bit in the bitmap represents the status of a corresponding item.
– 0: Indicates that the resource is available
– 1: Indicates that the resource is unavailable (or vice versa, depending on the
convention used)
• Example: Consider the bitmap 001011101
– Resources 2, 4, 5, 6, and 8 are unavailable.
– Resources 0, 1, 3, and 7 are available.
Applications of Bitmaps
• Disk Block Management
– Disk Drives: A medium-sized disk drive may be divided into thousands of disk blocks.
– Bitmap Usage: A bitmap can represent the availability of each disk block efficiently.
– Example: If a disk has 10,000 blocks, a 10,000-bit bitmap can track the availability of each block.
• Memory Management
– Page Allocation: Bitmaps can represent which pages in memory are allocated or free.
• File Systems
– Inode Allocation: Bitmaps can track which inodes are used or free in a filesystem.
• Resource Allocation
– Thread/Process Management: Bitmaps can track the availability of threads or processes in a
pool.
Computing Environments
aditional
omputing
Mobile
omputing
stributed
Systems
ent–Server
omputing
er-to-Peer
omputing
tualization
d Computing
eal-Time
mbedded
Systems
Traditional Computing
• Traditional Office Environment
– PCs connected to a network
– Servers providing file and print services
– Remote access was limited and awkward
– Portability achieved via laptop computers
– Terminals attached to mainframes
• Modern Office Environment
– Increased access methods to computing environments
– Web technologies and increasing WAN bandwidth
– Establishment of company portals for web accessibility
– Use of network computers (thin clients) for enhanced security and
maintenance
• Home Computing Evolution
– Transition from single computer with slow modem
connection
– Increased network-connection speeds at lower costs
– Home networks including printers, client PCs, and
servers
– Use of firewalls for network security
• Modern Computing Processes
– Decline of traditional time-sharing systems
– Use of scheduling techniques on desktop computers,
laptops, servers, and mobile devices
– Management of user and system processes to
allocate computer time
– Example: Multiple windows and web browser
processes on a PC
Mobile Computing
• Mobile computing on handheld smartphones and tablets
• Historical Limitations: Smaller screens, less memory, reduced
functionality compared to PCs
• Modern Advancements:
– Multimedia: Music, video, digital books, high-definition video
recording
– Applications: Wide range including navigation, gaming,
augmented reality
– Unique Features: GPS chips, accelerometers, gyroscopes
• Connectivity
– Wireless: IEEE 802.11
– Cellular Data Networks
• Operating Systems
– Apple iOS: iPhone and iPad
– Google Android: Various smartphones and tablets
• Challenges
• Limited memory and processing power
compared to PCs
Distributed Systems
• Definition of Networked Computer Systems
– Provides access to shared resources
– Increases computation speed, functionality, data
availability, and reliability
• Types of Network Access
– Generalized as file access (network interface’s device
driver)
– Specific network functions (e.g., FTP, NFS)
• Network Fundamentals
– Communication path between two or more systems
– Dependent on networking for functionality
– Varied by protocols, distances, and transport media
• Common Network Protocols
– TCP/IP: Fundamental architecture of the Internet,
supported by most OS
– Proprietary protocols for specific needs
• Types of Networks by Distance
• LAN: Local-Area Network (within a room, building, or campus)
• WAN: Wide-Area Network (links buildings, cities, countries)
• MAN: Metropolitan-Area Network (links buildings within a city)
• PAN: Personal-Area Network (Bluetooth and 802.11 devices)
• Networking Media
• Copper wires, fiber strands, wireless transmissions
• Satellites, microwave dishes, radios
• Cellular phones, infrared communication
• Operating Systems and Networking
• Network Operating System: Provides file sharing and
communication scheme
• Distributed Operating System: Provides a unified environment,
appearing as a single OS
• Impact of Networking Protocols
• Affects system utility and popularity
• Integration with OS through network adapters and device drivers
Client–Server Computing
• Shift from Centralized to Decentralized Systems
– Terminals connected to centralized systems
replaced by PCs and mobile devices
– Increased user-interface functionality on PCs via
web interfaces
• Client-Server Systems
– Definition: Specialized distributed systems where
servers satisfy requests from client systems
• Types of Server Systems
• Compute Servers
• Provide an interface for clients to request
actions (e.g., read data)
• Server executes actions and sends results to
clients
• Example: Database servers responding to data
requests
• File Servers
• Provide a file-system interface for clients
• Clients can create, update, read, and delete
files
• Example: Web servers delivering files to web
browsers
• Impact of Client-Server Model
• Enhanced efficiency and resource distribution
• Scalable and flexible system architecture
Peer-to-Peer Computing
• Definition of P2P Systems:
– Nodes act as both clients and servers
– No distinction between clients and servers
• Advantages of P2P Systems:
– Avoids server bottlenecks
– Services distributed across multiple nodes
• Joining a P2P Network:
– Node must join the network of peers
– Nodes can request and provide services
Service Discovery Methods
• Centralized Lookup Service
• Node registers its service with a centralized service
• Client contacts the centralized service to find providers
• Communication happens directly between client and service
provider
• Decentralized Discovery
• No centralized service
• Client broadcasts service request to all nodes
• Nodes providing the service respond directly to the client
• Requires a discovery protocol
Examples of P2P Systems
• Napster
• Centralized server maintained an index of files
• File exchange happened directly between peers
• Gnutella
• Clients broadcasted file requests
• Nodes responded directly to the client
• Skype
• Hybrid approach with centralized login server
• Decentralized peer communication using VoIP technology
Virtualization
• Definition
• Allows operating systems to run as
applications within other operating
systems
• OS natively compiled for a CPU runs
within another native OS on the same
CPU
• Originated on IBM mainframes for
concurrent task execution
Virtualization
• Virtualization vs. Emulation
– Emulation
• Translates instructions from one CPU type to another
• Example: Apple’s Rosetta for IBM Power CPU to Intel x86
• Slower performance due to instruction translation
– Interpretation
• Executes high-level language code or translates to intermediate
form
• Example: Java runs on Java Virtual Machines (JVMs), essentially
Java emulators
• Virtualization in Modern Computing
• VMware
• Created to address issues with running multiple Windows XP
applications
• Allows running multiple guest OS on a host OS
• Virtual Machine Manager (VMM)
• Manages guest OS resources and protection
• Example: Running Windows on a Mac OS X with x86 CPU
• Applications and Benefits
• Exploration and Compatibility
• Users can install multiple OS for exploration
• Run applications for different OS on the
same machine
• Development and Testing
• Companies run multiple OS on a single
server for development, testing, and
debugging
• Data Centers
• Virtualization common for managing
computing environments
• VMMs like VMware ESX and Citrix
XenServer act as the host
Cloud Computing
• Cloud computing is a type of computing that delivers
computing, storage, and even applications as a service across a
network.
• Uses virtualization as a base for its functionality
• Types of Cloud Computing
– Public Cloud: Available to anyone via the Internet for a fee
(e.g., Amazon EC2)
– Private Cloud: Run by a company for internal use
– Hybrid Cloud: Combines public and private cloud
components
– Software as a Service (SaaS) – one or more applications
available via the Internet (i.e., word processor)
– Platform as a Service (PaaS) – software stack ready for
application use via the Internet (i.e., a database server)
– Infrastructure as a Service (IaaS) – servers or storage
available over Internet (i.e., storage available for backup use)
Real-Time Embedded Systems
• Found in car engines and manufacturing to DVDs and
microwave ovens
• Real-time embedded systems most prevalent form of
computers
– Vary considerable, special purpose, limited purpose
OS, real-time OS
– Have little or no user interface
• Spend their time monitoring and managing hardware
devices, such as automobile engines and robotic arms.
• Many other special computing environments as well
– Some have OSes, some perform tasks without an OS
• Real-time OS has well-defined fixed time constraints
– Processing must be done within constraint
– Correct operation only if constraints met
• Specialized computing systems designed to
perform specific tasks within a defined time
constraint.
• embedded as part of a larger device, often in
dedicated hardware, and interact with the
physical environment through sensors and
actuators.
SESSION-4
Open-Source Operating Systems, Operating-System Services
Open Source Operating Systems
• Definition: Operating systems available in source code
format, allowing users to view, modify, and distribute the
code
• Examples:
– Linux: Most famous open-source OS
– Microsoft Windows: Closed-source approach
– Apple Mac OS X and iOS: Hybrid approach with open-
source kernel (Darwin) and proprietary components
• Benefits of Open-Source:
– Transparency: Access to source code for learning and
modification
– Security: More eyes on the code can lead to quicker
detection and fixing of bugs
– Community Support: Contributions from a global
community of programmers
– Commercial Opportunities: Revenue through support
contracts and hardware sales (e.g., Red Hat)
• History
– Early Days: Open-source was common; programs were
shared among enthusiasts and user groups
– Commercial Shift: Companies began limiting software
use to protect code and manage copyrights
– GNU Project: Started by Richard Stallman in 1983 to
create a free, UNIX-compatible OS
– GNU Manifesto (1985): Advocated for free and open-
source software
– Free Software Foundation (FSF): Formed to encourage
the free exchange and use of software
– GPL (General Public License): Requires source code
distribution and copylefting (sharing modifications
under the same license)
• Notable Open-Source Projects
– Linux Kernel
– GNU Utilities
– Firefox Browser
– Apache Web Server
Linux
• Overview:
– GNU/Linux: A prominent example of an open-
source OS
– Origins: GNU project provided UNIX-
compatible tools; Linus Torvalds released a
UNIX-like kernel in 1991
• Development:
– Linus Torvalds: Started with a rudimentary
kernel and invited global contributions
– Internet Impact: Enabled rapid growth and
updates with contributions from thousands of
programmers
• Use Cases
– Servers, desktops, and embedded systems.
– Various distributions tailored for specific
purposes (e.g., gaming, enterprise).
• Major Distributions
– RedHat: Enterprise-focused, commercial use
– SUSE: Versatile, with both community and enterprise versions
– Fedora: Cutting-edge features, community-driven
– Debian: Known for stability, foundational for many other
distributions
– Slackware: One of the oldest, known for simplicity
– Ubuntu: User-friendly, popular for desktops and servers
• Specialized Distributions
– PCLinuxOS: LiveCD, can run directly from CD-ROM without
installation
– PCLinuxOS Supergamer DVD: LiveDVD with graphics drivers
and games, designed for gaming enthusiasts
• Features
– Custom Builds: Each distribution varies in function, utility,
applications, hardware support, and user interface
– LiveCD/LiveDVD: Allows running the OS directly from a
CD/DVD, useful for temporary or trial use without installation
Run Linux on a Windows system
1. Download the free “VMware Player” tool from
– http://www.vmware.com/download/player/
– and install it on your system.
2. Choose a Linux version from among the hundreds of “appliances,” or virtual machine
images, available from VMware at
– http://www.vmware.com/appliances/
– These images are preinstalled with operating systems and applications and include many
flavors of Linux.
3. Boot the virtual machine within VMware Player.
BSD (Berkeley Software Distribution) UNIX
• History:
– Origins: BSD UNIX derived from AT&T’s UNIX in
1978
– Licensing: Initially required an AT&T license;
4.4BSD-lite, released in 1994, became fully open-
source
• Distributions:
– FreeBSD: Known for performance and advanced
networking features
– NetBSD: Focuses on portability across different
hardware platforms
– OpenBSD: Emphasizes security and code
correctness
– DragonFlyBSD: Designed for high-performance
and advanced features
• Exploring BSD UNIX:
– Source Code:
• Available with the distribution
• Location: /usr/src/ (General source), /usr/src/sys/
(Kernel source)
• Example: Virtual memory implementation can be
found in /usr/src/sys/vm
• Darwin and Mac OS X:
– Darwin: Core kernel of Mac OS X based on BSD UNIX
– Open Source: Available from Apple's Open Source site
– Kernel Package: Starts with “xnu”
• Use Cases:
• Servers (e.g., FreeBSD used in some high-performance
environments).
• Network appliances and embedded systems.
• Desktop environments (e.g., DesktopBSD).
Solaris
• Overview:
– Solaris: Commercial UNIX-based operating system from Sun Microsystems
– Origin: Evolved from SunOS, initially based on BSD UNIX, then moved to AT&T’s System V UNIX in 1991
• OpenSolaris:
– Release: Most Solaris code was open-sourced in 2005
– Current Status: The project’s state is unclear post-Sun's acquisition by Oracle in 2009
– Access: Source code from 2005 still available at OpenSolaris Source Code
• Project Illumos:
– Background: Forked from OpenSolaris, expanded with additional features
– Purpose: Basis for several products
– Resources: Available at Illumos Wiki
• Use Cases:
– Enterprise environments.
– High-performance computing and large-scale server deployments.
Open-Source Systems as Learning Tools
• Open-source operating systems like GNU/Linux, BSD UNIX, and Solaris serve as powerful educational resources for students and
developers.
• Benefits of Open-Source Systems for Learning
– Access to Source Code
• Exploration: Students can explore the complete source code, gaining insights into the inner workings of operating systems.
• Modification: They can modify and test code to understand the effects of changes, helping to deepen their understanding
of system internals.
– Hands-On Experience
• Real-World Applications: Working with actual operating systems provides practical experience with real-world code,
beyond theoretical learning.
• Debugging and Development: Opportunities to identify and fix bugs or contribute new features, enhancing problem-
solving skills.
– Educational Resources
• Documentation: Many open-source projects come with extensive documentation that can be valuable for learning.
• Community Support: Vibrant communities around these projects offer forums, mailing lists, and other resources where
learners can ask questions and get help.
– Understanding Historical Systems
• Historical Context: Access to historic open-source projects like Multics can help students understand the evolution of
operating systems and their design philosophies.
– Cross-Pollination of Ideas
• Shared Components: Components and ideas from one open-source project may be used in others, facilitating innovation
and rapid improvements.
Open-Source Systems as Learning Tools
Specific Examples
• GNU/Linux:
– Versatility: Offers a wide range of distributions for different use cases, from desktop environments to
specialized server setups.
– Tools and Applications: Provides access to a broad array of tools and applications, enabling comprehensive
learning experiences.
• BSD UNIX:
– Code Quality and Security: Known for its robust networking capabilities and security features, providing a
good example of high-quality code and design.
– Variations: Includes several distributions like FreeBSD, OpenBSD, and NetBSD, each with its focus and
strengths.
• Solaris:
– Advanced Features: Offers advanced features like ZFS and DTrace, providing students with examples of
cutting-edge technology in operating system design.
– Illumos: The continued development of Illumos demonstrates the impact of open-source evolution on legacy
systems.
Operating System Services
Operating System Services
• Services to User
– User interface
– Program execution
– I/O operations
– File-system manipulation
– Communications
– Error detection
• Services to OS itself
– Resource allocation
– Accounting
– Protection and security
Operating System Services
• User Interface (UI)
– Types of UI
• Command-Line Interface (CLI): Uses text commands entered via keyboard.
• Batch Interface: Commands and directives are entered into files, which are then executed.
• Graphical User Interface (GUI): Uses a window system with a pointing device and keyboard for
I/O, menu selections, and text entry.
– Some operating systems offer multiple UI options (CLI, batch, GUI)
• Program Execution
– Program Loading and Running
– Program Termination: Programs must be able to end normally or abnormally (indicating error).
• I/O Operations
– Requirements for running programs may need to perform I/O operations involving files or devices.
– Special Functions may be required for specific devices (e.g., CD/DVD recording, screen blanking).
– User Access typically restricted for efficiency and protection; OS provides controlled I/O access.
Operating System Services
• Communications
– Process Communication: Needed for processes to exchange information.
– Types:
• Shared Memory: Processes read and write to a shared memory section.
• Message Passing: Information packets are moved between processes by the OS.
– Scope: Communication can occur between processes on the same computer or across a network.
• Error Detection
– Continuous Monitoring: The OS must constantly detect and correct errors.
– Types of Errors:
• Hardware Errors: CPU, memory (e.g., power failure, memory error).
• I/O Device Errors: Disk errors, network failures, printer issues.
• User Program Errors: Arithmetic overflow, illegal memory access, excessive CPU usage.
– Error Handling:
• System Halt: May halt the system for severe errors.
• Process Termination: Terminate the error-causing process.
• Error Codes: Return codes to processes for error detection and correction.
Operating System Services
• Resource Allocation
– Multiple Users/Jobs: Efficient resource allocation is crucial when multiple users or jobs run
simultaneously.
– Types of Resources Managed
• CPU Cycles: Managed with CPU-scheduling routines considering CPU speed, job requirements,
available registers, etc.
• Main Memory: Allocation for running processes.
• File Storage: Allocation and management of disk space.
• I/O Devices: Allocation of peripheral devices like printers and USB drives with general request and
release code.
• Accounting
– Resource Usage Tracking: Keeping track of how much and what kinds of resources each user utilizes.
– Purpose:
• Billing: Users can be billed based on resource usage.
• Usage Statistics: Accumulating data for system reconfiguration and improvement.
Operating System Services
• Protection and Security
– Information Control: Owners of stored information control access in multiuser or networked
systems.
– Process Isolation: Ensuring that processes do not interfere with each other or the OS.
– Access Control: Controlling access to system resources to ensure protection.
– User Authentication: Requiring users to authenticate (e.g., via passwords) to access system
resources.
– External Security: Protecting external I/O devices, including network adapters, from
unauthorized access.
– Intrusion Detection: Recording all connections to detect break-ins.
– Holistic Security: Ensuring security measures are comprehensive, as a system is only as secure
as its weakest point.
SESSION-5
User and Operating-System Interface, System Calls, Types of System Calls
User and Operating System Interface
• Command Interpreters
• Graphical User Interfaces
• Choice of Interface
User Operating System Interface - CLI
CLI or command interpreter allows direct command entry
– Sometimes implemented in kernel, sometimes by systems program
– Sometimes multiple flavors implemented – shells
– Primarily fetches a command from user and executes it
– Sometimes commands built-in, sometimes just names of programs
• If the latter, adding new features doesn’t require shell modification
User Operating System Interface - GUI
• User-friendly desktop metaphor interface
– Usually mouse, keyboard, and monitor
– Icons represent files, programs, actions, etc
– Various mouse buttons over objects in the interface cause various actions (provide
information, options, execute function, open directory (known as a folder)
– Invented at Xerox PARC
• Many systems now include both CLI and GUI interfaces
– Microsoft Windows is GUI with CLI “command” shell
– Apple Mac OS X is “Aqua” GUI interface with UNIX kernel underneath and shells available
– Unix and Linux have CLI with optional GUI interfaces (CDE, KDE, GNOME)
User Operating System Interface - GUI
 Touchscreen devices require new interfaces
 Mouse not possible or not desired
 Actions and selection based on gestures
 Virtual keyboard for text entry
 Voice commands.
The Mac OS X GUI
System Calls
• System calls are the fundamental interface between an application and
the operating system.
• Typically written in a high-level language (C or C++)
• Mostly accessed by programs via a high-level Application Programming
Interface (API) rather than direct system call use
• Three most common APIs are
– Win32 API for Windows,
– POSIX API for POSIX-based systems (including virtually all versions of UNIX,
Linux, and Mac OS X), and
– Java API for the Java virtual machine (JVM)
Example of System Calls
• System call sequence to copy the contents of one file to
another file
System Call Implementation
• Typically, a number associated with each system call
– System-call interface maintains a table indexed
according to these numbers
• The system call interface invokes the intended
system call in OS kernel and returns status of the
system call and any return values
• The caller need know nothing about how the system
call is implemented
– Just needs to obey API and understand what OS
will do as a result call
– Most details of OS interface hidden from
programmer by API
• Managed by run-time support library (set of
functions built into libraries included with
compiler)
API – System Call – OS
Relationship
System Call Parameter Passing
• Often, more information is required than simply identity of
desired system call
– Exact type and amount of information vary according to
OS and call
• Three general methods used to pass parameters to the OS
1. Simplest: pass the parameters in registers
• In some cases, may be more parameters than
registers
2. Parameters stored in a block, or table, in memory, and
address of block passed as a parameter in a register
• This approach taken by Linux and Solaris
3. Parameters placed, or pushed, onto the stack by the
program and popped off the stack by the operating
system
– Block and stack methods do not limit the number or
length of parameters being passed
Parameter Passing via Table
Types of System Calls
1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
6. Protection
• Process control
• create process, terminate process
• end, abort
• load, execute
• get process attributes, set process attributes
• wait for time
• wait event, signal event
• allocate and free memory
• Dump memory if error
• Debugger for determining bugs, single step
execution
• Locks for managing access to shared data between
processes
Types of System Calls
• File management
– create file, delete file
– open, close file
– read, write, reposition
– get and set file attributes
• Device management
– request device, release device
– read, write, reposition
– get device attributes, set device attributes
– logically attach or detach devices
• Information maintenance
• get time or date, set time or date
• get system data, set system data
• get and set process, file, or device attributes
• Communications
• create, delete communication connection
• send, receive messages if message passing
model to host name or process name
• From client to server
• Shared-memory model create and gain
access to memory regions
• transfer status information
• attach and detach remote devices
• Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
Examples of Windows and
Unix System Calls EXAMPLE OF STANDARD C LIBRARY
SESSION-6
System Programs, Operating-System Design and Implementation
System Programs
• Also known as system utilities
• Provide a convenient environment for program
development and execution.
• They can be divided into:
– File manipulation
– Status information sometimes stored in a File
modification
– Programming language support
– Program loading and execution
– Communications
– Background services
– Application programs
• Most users’ view of the operation system is defined by
system programs, not the actual system calls
System Programs
• File management
– Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories
• Status information
– Some ask the system for info - date, time, amount of available memory, disk space, number of users
– Others provide detailed performance, logging, and debugging information
– Typically, these programs format and print the output to the terminal or other output devices
– Some systems implement a registry - used to store and retrieve configuration information
• File modification
– Text editors to create and modify files
– Special commands to search contents of files or perform transformations of the text
• Programming-language support - Compilers, assemblers, debuggers and interpreters sometimes provided
• Program loading and execution- Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders, debugging
systems for higher-level and machine language
• Communications
– Provide the mechanism for creating virtual connections among processes, users, and computer systems
– Example: Messaging, browsing, email, remote login, and file transfer
System Programs
• Background Services
– Launch at boot time
• Some for system startup, then terminate
• Some from system boot to shutdown
– Provide facilities like disk checking, process scheduling, error logging,
printing
– Run in user context not kernel context
– Known as services, subsystems, daemons
• Application programs
– Don’t pertain to system
– Run by users
– Not typically considered part of OS
– Launched by command line, mouse click, finger poke
Introduction to Operating Systems and its basics
Operating System Design and Implementation
• Design and Implementation of OS not “solvable”, but some approaches have proven successful
• Internal structure of different Operating Systems can vary widely
• Start the design by defining goals and specifications
• Affected by choice of hardware, type of system
• Design Goals
– User goals – operating system should be convenient to use, easy to learn, reliable, safe, and
fast
– System goals – operating system should be easy to design, implement, and maintain, as well
as flexible, reliable, error-free, and efficient
Operating System Design and Implementation
• Mechanisms and Policies
– Mechanisms determine how to do something;
– Policies determine what will be done.
– The separation of policy from mechanism is a very important principle, it allows maximum
flexibility if policy decisions are to be changed later
– For example, the timer construct is a mechanism for ensuring CPU protection, but deciding
how long the timer is to be set for a particular user is a policy decision.
– Specifying and designing an OS is highly creative task of software engineering
Operating System Design and Implementation
• Implementation
– Much variation
• Early OS’s in assembly language
• Then system programming languages like Algol, PL/1
• Now C, C++
– Actually usually a mix of languages
• Lowest levels in assembly
• Main body in C
• Systems programs in C, C++, scripting languages like
PERL, Python, shell scripts
– More high-level language easier to port to other hardware
• But slower
– Emulation can allow an OS to run on non-native hardware
• MS-DOS was written in Intel 8088
assembly language
• The Linux and Windows operating system
kernels are written mostly in C
• Some small sections of assembly code for
device drivers and for saving and restoring
the state of registers
SESSION-7
Operating-System Structure, Operating-System Debugging,
Operating System Structure
• Simple Structure
• Layered Approach
• Microkernels
• Modules
• Hybrid Systems
Operating System Structure - Simple Structure (MS-DOS)
• MS-DOS – written to provide the most functionality in the least
space
– Not divided into modules
– Although MS-DOS has some structure, its interfaces and levels
of functionality are not well separated
– Application programs can access basic I/O routines directly,
leading to system crashes from errant or malicious programs
– Written for Intel 8088 with no dual mode or hardware
protection, leaving base hardware accessible
Operating System Structure - Simple Structure (UNIX)
• UNIX – limited by hardware functionality, the
original UNIX operating system had limited
structuring.
• The UNIX OS consists of two separable parts
– Systems programs
– The kernel
• Consists of everything below the system-call
interface and above the physical hardware
• Provides the file system, CPU scheduling,
memory management, and other
operating-system functions; a large number
of functions for one level
Operating System Structure - Layered Approach
• The operating system is divided into a
number of layers (levels), each built on
top of lower layers.
• The bottom layer (layer 0), is the
hardware; the highest (layer N) is the user
interface.
• With modularity, layers are selected such
that each uses functions (operations) and
services of only lower-level layers
Operating System Structure - Microkernels
• Moves as much from the kernel into user space
• Mach example of microkernel
– Mac OS X kernel (Darwin) partly based on Mach
• Communication takes place between user modules using
message passing
• Benefits:
– Easier to extend a microkernel
– Easier to port the operating system to new
architectures
– More reliable (less code is running in kernel mode)
– More secure
• Detriments:
– Performance overhead of user space to kernel space
communication
Operating System Structure - Modules
• Many modern operating systems implement loadable kernel modules
– Uses object-oriented approach
– Each core component is separate
– Each talks to the others over known interfaces
– Each is loadable as needed within the kernel
• Overall, similar to layers but with more flexible
– Linux, Solaris, etc
Operating System Structure - Hybrid Systems
• Most modern operating systems are actually not one
pure model
– Hybrid combines multiple approaches to address
performance, security, usability needs
– Linux and Solaris kernels in kernel address space,
so monolithic, plus modular for dynamic loading of
functionality
– Windows mostly monolithic, plus microkernel for
different subsystem personalities
• Example:
– the Apple Mac OS X operating system and the two
most prominent mobile operating systems—iOS
and Android.
Operating System Structure - Hybrid Systems
• Apple mobile OS for iPhone, iPad
– Structured on Mac OS X, added functionality
– Does not run OS X applications natively
• Also runs on different CPU architecture (ARM
vs. Intel)
– Cocoa Touch Objective-C API for developing apps
– Media services layer for graphics, audio, video
– Core services provides cloud computing,
databases
– Core operating system, based on Mac OS X kernel
Operating System Structure - Hybrid Systems
• Developed by Open Handset Alliance (mostly Google)
– Open Source
• Similar stack to IOS
• Based on Linux kernel but modified
– Provides process, memory, device-driver management
– Adds power management
• Runtime environment includes core set of libraries and
Dalvik virtual machine
– Apps developed in Java plus Android API
• Java class files compiled to Java bytecode then
translated to executable than runs in Dalvik VM
• Libraries include frameworks for web browser (webkit),
database (SQLite), multimedia, smaller libc
Operating-System Debugging
• Failure Analysis
• Performance Tuning
• DTrace
Operating-System Debugging
• Debugging is finding and fixing errors, or bugs
• Failure Analysis
– OS generate log files containing error information
– Failure of an application can generate core dump file capturing memory of the process
– Operating system failure can generate crash dump file containing kernel memory
– Beyond crashes, performance tuning can optimize system performance
• Sometimes using trace listings of activities, recorded for analysis
• Profiling is periodic sampling of instruction pointer to look for statistical trends
– Kernighan’s Law: “Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by definition, not smart
enough to debug it.”
Operating-System Debugging
• Performance Tuning
• Performance tuning in operating systems is essential for optimizing system efficiency by identifying and resolving
processing bottlenecks.
• Monitoring System Performance
– To identify bottlenecks, the system's performance needs to be monitored effectively.
– The operating system must provide mechanisms for computing and displaying system behavior metrics.
• Trace Listings
– Event Logging: The system logs interesting events along with their time and important parameters into a trace file.
– Post-Analysis: An analysis program processes the trace file to determine system performance, identify bottlenecks,
and pinpoint inefficiencies.
– Simulation: The trace data can be used as input for simulations to test suggested system improvements.
– Error Detection: Traces also aid in identifying errors in operating-system behavior.
• Interactive Performance Tools
– These tools allow users and administrators to query the state of various system components in real-time to identify
bottlenecks.
• Examples:
– UNIX top Command: Displays system resource usage and lists the top resource-using processes.
– Disk I/O, Memory, and Network Tools: Provide insights into the state of disk I/O, memory allocation, and network
traffic.
Operating-System Debugging
• Windows Task Manager
– Functionality:
• Similar to UNIX top, it includes information on
current applications and processes, CPU and
memory usage, and networking statistics.
– User Interface:
• Provides a graphical interface for users to monitor
and manage system performance
• Advanced Performance Analysis Tools
– Research and Development:
• Making operating systems easier to understand,
debug, and tune is an active area of research.
– Kernel-Enabled Tools:
• A new generation of tools has emerged, significantly
enhancing performance analysis capabilities.
Operating-System Debugging
• DTrace
– DTrace tool in Solaris, FreeBSD, Mac OS X allows live
instrumentation on production systems
– Probes fire when code is executed within a provider,
capturing state data and sending it to consumers of
those probes
– Example of following XEventsQueued system call move
from libc library to kernel and back
– DTrace code to record amount of time each process
with UserID 101 is in running mode (on CPU) in
nanoseconds
Operating-System Debugging
– This code enables scheduler probes and records
the CPU time of processes with user ID 101
An example of Dcode
SESSION-8
Operating-System Generation
Operating System Generation
• SYSGEN is the process of configuring or generating an operating system for a specific computer system, taking
into account its hardware and peripheral configurations. Here are the key points regarding SYSGEN:
• Distribution and Installation
– Operating systems are typically distributed on disk, CD-ROM, DVD-ROM, or as an ISO image.
– A special SYSGEN program is used to configure the operating system based on the specific hardware setup.
• Information Needed for SYSGEN
– CPU Configuration
• Determine the CPU type and installed options (e.g., extended instruction sets, floating-point
arithmetic). For multiple CPU systems, describe each CPU.
– Boot Disk Formatting : Decide how the boot disk will be partitioned and what will be stored in each
partition.
– Memory Availability: The system may determine available memory by probing memory locations until an
illegal address fault occurs.
– Device Availability: Identify available devices, including device number, interrupt number, type, model,
and special characteristics.
– Operating-System Options :Specify options such as buffer sizes, CPU scheduling algorithms, and maximum
number of supported processes.
Operating System Generation
• Methods of System Generation
– Source Code Modification
• System administrator modifies the operating system's source code based on the
hardware description.
• The modified source code is compiled to create a tailored operating system.
– Module Selection from Precompiled Library
• System description is used to create tables and select modules from a precompiled
library.
• Modules are linked to form the operating system, which may be more general but faster
to generate.
– Table-Driven System
• All code is included in the system, and selection occurs at execution time.
• SYSGEN involves creating tables to describe the system.
SESSION-9
System Boot.
System Boot
• The process of starting a computer by loading the operating system (OS) kernel is known as
booting the system.
• Bootstrap Program
– Bootstrap Program/Loader: A small piece of code that locates the OS kernel, loads it into
main memory, and starts its execution.
– Two-Step Process: On some systems, a simple bootstrap loader first fetches a more complex
boot program from disk, which then loads the kernel.
• Initial Boot Sequence
– CPU Reset Event: When the CPU is powered up or rebooted, the instruction register is
loaded with a predefined memory location, initiating execution.
– ROM: The initial bootstrap program is stored in Read-Only Memory (ROM), ensuring it is
reliable and virus-free.
System Boot
• Tasks of the Bootstrap Program
– Run Diagnostics: Checks the state of the machine.
– System Initialization: Initializes CPU registers, device controllers, and main memory.
– Load the OS: Locates and loads the OS kernel.
• Types of Systems and Storage
– Systems with ROM OS: Small systems like phones or game consoles may store the entire OS in ROM.
• Advantage: Rugged and reliable.
• Disadvantage: Updating the OS requires changing ROM hardware chips.
– EPROM: Some systems use Erasable Programmable Read-Only Memory, which can be written to under specific
conditions.
– Firmware: General term for ROM and EPROM, bridging hardware and software characteristics.
• Bootstrapping Larger Operating Systems
– Firmware Bootstrap Loader: For large OSs, the bootstrap loader in firmware loads the OS from disk.
– Boot Block: The firmware loads a small program from a fixed disk location (boot block) into memory, which in
turn loads the entire OS.
Example: GRUB - An open-source bootstrap program used in Linux systems, facilitating the loading of the OS kernel from disk.
Classroom Activity
• Group Activity (40 minutes): 06.08.2024
– Divide the students into small groups
– Each group is assigned a type of operating system (e.g., Windows, Linux,
macOS, Android, iOS, FreeRTOS, SteamOS, UNIX, OpenBSD).
– Each group should research their assigned OS and prepare a short presentation
covering:
• Key features
• Typical use cases
• Strengths and weaknesses
Classroom Activity
• Team-1 Android
• Team-2 Ubuntu
• Team-3 Kali
• Team-4 Windows
• Team-5 Parrot OS
• Team-6 SteamOS
• Team-7 Unix
• Team-8 MacOS
• Team-9 Solaris
• Team-10 Linux
• Team-11 OpenBSD
• Team-12 iOS
• Team-13 RTOS

More Related Content

PPTX
Lecture_01 Operating System Course Introduction
PPTX
OS M1.1.pptx
PDF
Ch1 introduction
PPTX
Operating system introduction and introduction
PPTX
Operating system (BCS303) MODULE 1 NOTES
PPT
chapter1.ppt
PDF
Lecture - 1.pdf
Lecture_01 Operating System Course Introduction
OS M1.1.pptx
Ch1 introduction
Operating system introduction and introduction
Operating system (BCS303) MODULE 1 NOTES
chapter1.ppt
Lecture - 1.pdf

Similar to Introduction to Operating Systems and its basics (20)

PDF
Operating systemMINIX GitHub: https://github.com/Stichting-MINIX-Research-Fou...
PPTX
381CCS_CHAPTER1_UPDATEDdatabase management .pptx
PPT
Computer Architecture & Organization.ppt
PPTX
Operating_System_Xpand_Version_2025v1.pptx
PPT
Operating Systems with Storage and Process Management
PPT
Operating Systems _ Process & Storage Management
PPT
Operating Systems Storage & Process Management
PPT
OPERATING SYSTEM ENGINEERING SYLLABUS PPT
PPT
OS Intro.ppt
PPTX
Operating System PPT for CSE students 2nd yr
PPSX
Operating system
PPTX
OS Introduction
PPTX
Design Of Operating System_Lecture_OS_1.pptx
PPTX
Week1_Introduction to_Operating System - Part 1.pptx
PPTX
OperatingSystem_Module-1 3rd semester.pptx
PPTX
What is an Operating Systems?
PDF
CH01.pdf
PPTX
CSE3120- Module1 part 1 v1.pptx
PPTX
Introduction _to_ OperatingSystem_1.pptx
Operating systemMINIX GitHub: https://github.com/Stichting-MINIX-Research-Fou...
381CCS_CHAPTER1_UPDATEDdatabase management .pptx
Computer Architecture & Organization.ppt
Operating_System_Xpand_Version_2025v1.pptx
Operating Systems with Storage and Process Management
Operating Systems _ Process & Storage Management
Operating Systems Storage & Process Management
OPERATING SYSTEM ENGINEERING SYLLABUS PPT
OS Intro.ppt
Operating System PPT for CSE students 2nd yr
Operating system
OS Introduction
Design Of Operating System_Lecture_OS_1.pptx
Week1_Introduction to_Operating System - Part 1.pptx
OperatingSystem_Module-1 3rd semester.pptx
What is an Operating Systems?
CH01.pdf
CSE3120- Module1 part 1 v1.pptx
Introduction _to_ OperatingSystem_1.pptx
Ad

More from Sivakumar M (12)

PPTX
Operating Systems Process Management.pptx
PPTX
Operating Systems Protection and Security
PPTX
Operating Systems CPU Scheduling and its Algorithms
PPTX
18CSC311J WEB DESIGN AND DEVELOPMENT UNIT-4
PPTX
18CSC311J WEB DESIGN AND DEVELOPMENT UNIT-2
PPTX
18CSC311J WEB DESIGN AND DEVELPMENT UNIT-1
PPTX
18CSC311J Web Design and Development UNIT-3
PPTX
Object Oriented Design and Programming Unit-05
PPTX
Object Oriented Design and Programming Unit-04
PPTX
Object Oriented Design and Programming Unit-03
PPTX
Object Oriented Design and Programming Unit-02
PPTX
Object Oriented Design and Programming Unit-01
Operating Systems Process Management.pptx
Operating Systems Protection and Security
Operating Systems CPU Scheduling and its Algorithms
18CSC311J WEB DESIGN AND DEVELOPMENT UNIT-4
18CSC311J WEB DESIGN AND DEVELOPMENT UNIT-2
18CSC311J WEB DESIGN AND DEVELPMENT UNIT-1
18CSC311J Web Design and Development UNIT-3
Object Oriented Design and Programming Unit-05
Object Oriented Design and Programming Unit-04
Object Oriented Design and Programming Unit-03
Object Oriented Design and Programming Unit-02
Object Oriented Design and Programming Unit-01
Ad

Recently uploaded (20)

PPTX
GDM (1) (1).pptx small presentation for students
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Lesson notes of climatology university.
PDF
Sports Quiz easy sports quiz sports quiz
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
GDM (1) (1).pptx small presentation for students
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Pharma ospi slides which help in ospi learning
Pharmacology of Heart Failure /Pharmacotherapy of CHF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Final Presentation General Medicine 03-08-2024.pptx
PPH.pptx obstetrics and gynecology in nursing
2.FourierTransform-ShortQuestionswithAnswers.pdf
01-Introduction-to-Information-Management.pdf
RMMM.pdf make it easy to upload and study
Abdominal Access Techniques with Prof. Dr. R K Mishra
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Lesson notes of climatology university.
Sports Quiz easy sports quiz sports quiz
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Microbial disease of the cardiovascular and lymphatic systems

Introduction to Operating Systems and its basics

  • 2. Introduction 1. Computer-System Organization, Computer-System Architecture, 2. Operating-System Structure 3. Operating-System Operations 4. Process Management, Memory Management, Storage Management, Protection and Security 5. Kernel Data Structures, Computing Environments, Open Source Operating Systems, 6. Operating System Services, User and Operating System Interface, 7. System Calls, Types of System Calls, System Programs, 8. Operating System Design and Implementation, 9. Operating System Structure, Operating-System Debugging, Operating System Generation, System Boot.
  • 3. SESSION-1 Introduction, Computers- System Organization, Computer-System Architecture
  • 4. What is an Operating System? • A program that acts as an intermediary between a user of a computer and the computer hardware • Operating system goals: – Execute user programs and make solving user problems easier – Make the computer system convenient to use – Use the computer hardware in an efficient manner
  • 5. Example Operating Systems Desktop and Laptop Operating Systems Mobile Operating Systems Server Operating Systems Embedded Operating Systems Real-Time Operating Systems (RTOS) Specialized and Less Common Operating Systems
  • 6. Example Operating Systems Desktop and Laptop Operating Systems • Windows – Windows 10 – Windows 11 – Windows 7 (though officially unsupported, it still has users) • macOS – macOS Ventura – macOS Monterey – macOS Big Sur • Linux Distributions – Ubuntu – Fedora – Debian – CentOS – Red Hat Enterprise Linux (RHEL) – Linux Mint – Arch Linux Real-Time Operating Systems (RTOS) • VxWorks • FreeRTOS • RTLinux • QNX Mobile Operating Systems • Android – Android 13 – Android 12 • iOS – iOS 16 – iOS 15 Server Operating Systems • Windows Server – Windows Server 2022 – Windows Server 2019 • Linux Distributions for Servers – Ubuntu Server – CentOS Stream – Red Hat Enterprise Linux (RHEL) – SUSE Linux Enterprise Server – Debian • UNIX-Based Systems – AIX (IBM) – HP-UX (Hewlett-Packard) – Solaris (Oracle) Embedded Operating Systems • Embedded Linux • Windows Embedded • Tizen • Contiki Specialized and Less Common Operating Systems • FreeBSD • OpenBSD • NetBSD • Haiku • ReactOS
  • 7. Computer System Structure • Computer system can be divided into four components: 1. Hardware • provides basic computing resources • CPU, memory, I/O devices 2. Operating system • Controls and coordinates use of hardware among various applications and users 3. Application programs • define the ways in which the system resources are used to solve the computing problems of the users • Word processors, compilers, web browsers, database systems, video games 4. Users • People, machines, other computers
  • 8. What Operating Systems Do • Depends on the point of view – User View – System View • User View – Users want convenience, ease of use and good performance – But shared computer such as mainframe or minicomputer must keep all users happy – Users of dedicate systems such as workstations have dedicated resources but frequently use shared resources from servers – Handheld computers are resource poor, optimized for usability and battery life – Some computers have little or no user interface, such as embedded computers in devices and automobiles • System View – Resource Allocator (CPU time, memory space, file-storage space, I/O devices) – Control Program : manages the execution of user programs to prevent errors and improper use of the computer
  • 9. Defining Operating Systems • OS is a resource allocator – Manages all resources – Decides between conflicting requests for efficient and fair resource use • OS is a control program – Controls execution of programs to prevent errors and improper use of the computer
  • 10. Defining Operating Systems • The operating system is the one program running at all times on the computer— usually called the kernel. • Along with the kernel, there are two other types of programs: • System programs, which are associated with the operating system but are not necessarily part of the kernel • Application programs, which include all programs not associated with the operation of the system
  • 11. Computer-System Organization • Computer-System Operation • Storage Structure • I/O Structure
  • 12. Computer-System Organization Computer-System Operation • A modern general-purpose computer system consists of one or more CPUs and a number of device controllers connected through a common bus that provides access to shared memory • Each device controller is in charge of a specific type of device (for Example, disk drives, audio devices, or video displays) • The CPU and the device controllers can execute in parallel, competing for memory cycles.
  • 13. Computer-System Organization Computer-System Operation • Bootstrap Program • When computer is powered up or rebooted—it needs to have an initial program to run • It is stored within the computer hardware in read- only memory (ROM) • The bootstrap program must know how to load the operating system and how to start executing that system. • The bootstrap program must locate the operating-system kernel and load it into memory • Once the kernel is loaded and executing, it can start providing services to the system and its users.
  • 14. Computer-System Organization Computer-System Operation • Interrupt (Hardware / Software) – Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus – Software may trigger an interrupt by executing a special operation called a system call – When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location – Each computer design has its own interrupt mechanism – Interrupt Vector: A table of pointers to interrupt routines can be used • System processes, or System daemons • Some services are provided outside of the kernel, by system programs that are loaded into memory at boot time • run the entire time the kernel is running
  • 16. Computer-System Organization Storage Structure • Register – Fastest, smallest storage directly within the CPU • Cache – Small, fast memory between CPU and main memory, improves performance • Main Memory – Volatile, primary storage for active programs and data • Solid-state disks – Non-volatile, faster than magnetic disks, uses flash memory • Magnetic disk – Non-volatile, large capacity, slower than SSDs, e.g., hard drives • Optical Disk – Non-volatile, used for distribution and backup, e.g., CDs, DVDs • Magnetic tape – Non-volatile, used for archival storage, high capacity, slow access Storage systems organized in hierarchy by Speed, Cost, Volatility
  • 17. Computer-System Organization I/O Structure • Importance of I/O Management • Crucial for system reliability and performance due to varied device nature. • System Architecture: • Components: CPUs, device controllers, common bus. • Device Controllers: Manage specific device types, have local buffers and special-purpose registers. • Device Driver: Provides a uniform interface to the device, communicates with the device controller. • I/O Operation Process: 1.Device driver loads registers in the device controller. 2.Device controller determines action (e.g., read/write). 3.Data is transferred to/from the device to the controller's local buffer. 4.Device controller signals completion via interrupt. 5.Device driver returns control/data/status to the OS.
  • 18. Computer-System Organization I/O Structure • Interrupt-driven I/O • Suitable for small data transfers, high overhead for bulk transfers. • Direct Memory Access (DMA): • Transfers data directly between device and memory. • Reduces CPU involvement, generates fewer interrupts. • High-End System Architecture: • Switch Architecture • Allows concurrent communication between multiple components. • Enhanced DMA • More effective in systems with switch architecture.
  • 19. Computer-System Architecture Single-Processor Systems Multiprocessor Systems Clustered Systems
  • 20. Single-Processor Systems • System Classification: – Single-Processor System: Defined as having only one general-purpose CPU. – Multiprocessor System: Requires multiple general-purpose CPUs. – The presence of special-purpose microprocessors does not classify the system as a multiprocessor system if there is only one general- purpose CPU. • Single-Processor System: • Main CPU: Executes a general-purpose instruction set, including instructions from user processes. • Special-Purpose Processors: Present in the form of device-specific processors (e.g., disk, keyboard, graphics controllers) or more general-purpose processors (e.g., I/O processors). • Special-Purpose Processors: • Limited Instruction Set: Run a limited instruction set and do not run user processes. • Managed by the Operating System: • Example: A disk-controller microprocessor receives tasks from the main CPU, manages its own disk queue, and schedules algorithm, reducing the main CPU's overhead. • Example: A keyboard microprocessor converts keystrokes into codes for the CPU. • Autonomous Operation: In some cases, these processors operate independently and are not managed by the operating system.
  • 21. Multiprocessor Systems • Multiprocessor systems have two or more processors in close communication, sharing the computer bus and sometimes the clock, memory, and peripheral devices. • Types: – Asymmetric multiprocessing • Each processor is assigned a specific task • A boss processor controls the system; the other processors either look to the boss for instruction or have predefined tasks (boss–worker relationship) • Boss processor schedules and allocates work to the worker processors – Symmetric multiprocessing (SMP) • each processor performs all tasks within the operating system • All processors share physical memory • Examples: AIX, UNIX • Advantages 1. Increased throughput 2. Economy of scale 3. Increased reliability
  • 22. Multiprocessor Systems • Multicore Processor – CPU design is to include multiple computing cores on a single chip – Advantages • More efficient than multiple chips with single cores because on-chip communication is faster than between-chip communication • One chip with multiple cores uses significantly less power than multiple single-core chips. – Multicore systems are multiprocessor systems, not all multiprocessor systems are multicore • Blade servers • A relatively recent development in which multiple processor boards, I/O boards, and networking boards are placed in the same chassis • Each blade-processor board boots independently and runs its own operating system
  • 23. Clustered Systems • Gathers together multiple CPUs. Composed of two or more individual systems—or nodes—joined together • Each node may be a single processor system or a multicore system • Share storage and are closely linked via a local-area network LAN • Types • Asymmetric Clustering • one machine is in hot-standby mode while the other is running the applications • Hot-standby host machine does nothing but monitor the active server • If that server fails, the hot-standby host becomes the active server • Symmetric Clustering • Two or more hosts are running applications and are monitoring each other • Some clusters are for high-performance computing (HPC) • Applications must be written to use parallelization • Some have distributed lock manager (DLM) to avoid conflicting operations
  • 24. SESSION-02 Operating-System Structure, Operating- System Operations, Process Management, Memory Management, Storage Management.
  • 25. Operating-System Structure • Operating Systems – Environment for Program Execution: Provides the environment within which programs are executed. – Variety in Makeup: Internally, operating systems vary greatly but share many commonalities. • Multiprogramming – Purpose: Increases CPU utilization by organizing jobs so that the CPU always has one to execute. – Memory Management: Keeps several jobs in memory simultaneously. Jobs are initially kept on disk in a job pool. – Job Execution: The operating system picks and executes one job from memory. When the job waits (e.g., for I/O), the CPU switches to another job. – Continuous CPU Utilization: Ensures the CPU is never idle as long as there is at least one job to execute. • Time Sharing (Multitasking) • Logical Extension of Multiprogramming: Allows users to interact with programs while they are running. • Interactive Systems: Provides direct communication between user and system through input devices (e.g., keyboard, mouse) and output devices. • Rapid Switching: CPU switches rapidly between users, giving the impression that the entire system is dedicated to each user. • CPU Scheduling and Multiprogramming: Uses these techniques to give each user a small portion of CPU time. • Processes and I/O: Processes execute for short times and often perform interactive I/O, which may be slow. Memory layout for a multiprogramming system
  • 26. Operating-System Structure • Memory Management and Scheduling – Job Scheduling: Decides which jobs to load into memory when there is insufficient space for all. – CPU Scheduling: Determines which job runs first when multiple jobs are ready to run. – Concurrency: Limits jobs' ability to affect one another across all system phases (e.g., process scheduling, disk storage, memory management). • Response Time and Memory Techniques – Swapping: Swaps processes in and out of memory to disk to ensure reasonable response time. – Virtual Memory: Allows execution of processes not completely in memory. It enables running larger programs than the actual physical memory and abstracts main memory. • Additional System Requirements – File System: Manages files residing on disks. – Disk Management: Ensures efficient disk usage. – Resource Protection: Protects resources from inappropriate use. – Job Synchronization and Communication: Provides mechanisms to synchronize and communicate between jobs. – Deadlock Prevention: Ensures jobs do not get stuck waiting for each other indefinitely.
  • 27. Operating-System Operations • Interrupt-Driven Nature of Operating Systems • Dual-Mode and Multimode Operation • Extended Modes • Instruction Execution Life Cycle • Hardware Protection • Timers
  • 28. Operating-System Operations Interrupt-Driven Nature of Operating Systems • Interrupts and Traps – Interrupts: Signal events that require immediate attention. – Traps (Exceptions): Software-generated interrupts caused by errors (e.g., division by zero) or specific user requests for OS services. • Interrupt Service Routine: Specific code segments handle different types of interrupts. Dual-Mode and Multimode Operation • User Mode and Kernel Mode – Mode Bit: A hardware bit distinguishes between user mode (1) and kernel mode (0). – Kernel Mode: The OS executes with full privileges. – User Mode: Applications execute with limited privileges. • Transition Between Modes – System Calls: User applications request OS services, causing a switch from user mode to kernel mode. – Interrupts and Traps: Automatically switch the mode to kernel mode. – Privileged Instructions: Certain instructions (e.g., I/O control, timer management) can only be executed in kernel mode to protect the system.
  • 30. Operating-System Operations • Extended Modes – Virtualization: CPUs may have additional modes for virtualization (e.g., Virtual Machine Manager mode) with privileges between user mode and kernel mode. – Privilege Levels: Some CPUs, like Intel 64, support multiple privilege levels instead of a simple dual-mode system. • Instruction Execution Life Cycle: – Boot Time: Starts in kernel mode, loads the OS, and switches to user mode for applications. – System Calls: User programs request OS actions, switching from user to kernel mode and back. – System Calls: • Mechanism: A method for user programs to request OS services, often implemented as traps. • Handling: The OS examines the request, verifies parameters, executes the request, and returns control to the user program. • Hardware Protection – MS-DOS Example: Lacked dual-mode support, leading to potential system corruption by user programs. – Modern Systems: Utilize dual-mode operation for better protection and error handling. – Timers: – Purpose: Ensure the OS maintains control over the CPU, preventing user programs from running indefinitely. – Implementation: A timer interrupts the system after a specified period, either fixed or variable. – Usage: The OS sets a timer before transferring control to a user program. If the timer interrupts, control returns to the OS, which can terminate or extend the program's execution time.
  • 31. Resource Management OS Functions Process Management Memory Management File-System Management Mass-Storage Management Cache Management I/O System Management • An operating system (OS) is a resource manager • The system’s CPU, memory space, file-storage space, and I/O devices are among the resources that the operating system must manage.
  • 32. Process Management • Process – A program in execution. – Examples: A time-shared user program (e.g., compiler), a word-processing program, or a system task (e.g., sending output to a printer). • Program vs. Process – Program: A passive entity (e.g., a file stored on disk). – Process: An active entity (execution instance of a program). • Process Resources – Required Resources: CPU time, memory, files, I/O devices. • Resources are allocated at creation or during execution. – Initialization Data: Input data necessary for the process to accomplish its task (e.g., file name for a process displaying file status).
  • 34. Process Management • Process Execution – Sequential Execution: The CPU executes one instruction after another from the process until completion. • Program Counter: Keeps track of the next instruction to execute. – Single Instruction at a Time: At most, one instruction is executed at any given time for a process. – Multiple Processes from the Same Program: They are considered separate execution sequences. • Multithreading – Multithreaded Process: Has multiple program counters, each for a different thread. • System Work Unit – Collection of Processes: A system consists of both operating-system processes (executing system code) and user processes (executing user code). – Concurrent Execution: Processes can execute concurrently, often by multiplexing on a single CPU.
  • 35. Process Management • Operating System Responsibilities for Process Management – Scheduling: Scheduling processes and threads on CPUs. – Creation and Deletion: Creating and deleting both user and system processes. – Suspension and Resumption: Suspending and resuming processes. – Synchronization Mechanisms: Providing mechanisms for process synchronization. – Communication Mechanisms: Providing mechanisms for process communication.
  • 36. Memory Management • To execute a program all (or part) of the instructions must be in memory • All (or part) of the data that is needed by the program must be in memory. • Memory management determines what is in memory and 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
  • 37. Storage Management • To make the computer system convenient for users, the operating system (OS) provides a uniform, logical view of information storage • The OS system abstracts from the physical properties of its storage devices to define a logical storage unit, the file. • The operating system maps files onto physical media and accesses these files via the storage devices • Classified as, – File-System Management – Mass-Storage Management – Caching – I/O Systems
  • 38. File-System Management • Files usually organized into directories • Access control on most systems to determine who can access what • OS 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
  • 39. 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 • OS activities – Mounting and unmounting – Free-space management – Storage allocation – Disk scheduling – Partitioning – Protection • Some storage need not be fast • Tertiary storage includes optical storage, magnetic tape • Still must be managed – by OS or applications • Varies between WORM (write-once, read- many-times) and RW (read-write)
  • 40. Characteristics of various types of storage
  • 41. Caching Management • Caching is a technique used to store copies of data in a faster storage system temporarily • Information is usually kept in slower, larger storage systems (like main memory) and copied into faster, smaller caches. • When data is needed, the system first checks the cache. If the data is present (cache hit), it is used from the cache. If not (cache miss), it is retrieved from the main storage and copied to the cache. • Each CPU in a multiprocessor system has its own cache, which can lead to multiple copies of the same data.
  • 42. Data Movement in Storage Hierarchies • Data movement between storage levels can be controlled by hardware (implicit) or the operating system (explicit). • Moving data from disk to memory is often controlled by the OS, while moving data from cache to CPU is usually handled by hardware.
  • 43. I/O Systems Management • The I/O subsystem consists of several components: – A memory-management component that includes buffering, caching, and spooling – A general device-driver interface – Drivers for specific hardware devices
  • 44. SESSION-03 Protection and Security Kernel Data Structures Computing Environments
  • 45. Protection and Security Protection • Mechanisms that control access to resources by processes or users, ensuring that only authorized entities can operate on those resources. • Protection Mechanisms – Authorization: Ensuring that only authorized processes or users can access files, memory segments, CPU, and other resources. – Memory Addressing Hardware: Ensures processes operate within their own address space. – CPU Timer: Ensures no process monopolizes the CPU by eventually forcing it to relinquish control. – Device-Control Registers: Protect peripheral devices by restricting user access. • Importance of Protection – Reliability: Detecting errors at subsystem interfaces early to prevent contamination of healthy subsystems. – Distinguishing Usage: Differentiating between authorized and unauthorized or incompetent users to prevent misuse
  • 46. Protection and Security Security • Measures that protect a system from external and internal attacks, preventing unauthorized access, data breaches, and other malicious activities. • Security Mechanisms – Authentication: Ensuring that users are who they claim to be. – Prevention of Attacks: Defending against viruses, worms, denial-of-service attacks, identity theft, and theft of service. – System Security Features: Implemented by the operating system or additional software to prevent security breaches. • Authentication and Authorization Process – Login Process: User provides credentials, and the system assigns a UID upon successful authentication. – Association: The UID is linked to all processes and threads of the user. – Group Membership: Users can belong to multiple groups, each with its own GID, which grants varying levels of access.
  • 47. Protection and Security • User Identification and Access Control – User IDs (UIDs): Unique identifiers for users, used to associate users with their processes and threads. – Group IDs (GIDs): Identifiers for sets of users, allowing differentiated access based on group membership. – Security IDs (SIDs): Windows term for user IDs. • Privilege Escalation – Need for Escalation: Sometimes users need additional permissions for specific tasks, like accessing restricted devices. – Methods: • UNIX setuid: Programs can run with the UID of the file owner rather than the current user, providing temporary elevated privileges. • Effective UID: The elevated privileges last until explicitly turned off or the process terminates.
  • 48. Protection and Security • Practical Examples – File Access in UNIX: File owners have full control, while specific groups can have read-only access. – Windows User and Group Management: Using SIDs to manage permissions and access control.
  • 49. Kernal • The kernel is a computer program at the core of a computer's operating system and generally has complete control over everything in the system. • It is the portion of the operating system code that is always resident in memory and facilitates interactions between hardware and software components
  • 50. Kernel Data Structures • Data structures are ways to organize and store data for efficient access and modification. • Understanding basic data structures is fundamental for problem-solving and efficient algorithm design in computer science • Basic Data Structures – Array – List – Stack – Queue – Tree – Hash functions and Maps – Bitmaps Arrays • An array is a collection of elements stored at contiguous memory locations. • Each element can be accessed directly using its index. • Arrays have a fixed size, defined at the time of their creation. • Example: Main memory is constructed as an array. • Limitations: • Fixed size: Cannot accommodate varying sizes easily. • Deletion: Removing an item requires shifting elements to maintain order.
  • 51. Kernel Data Structures Lists • A list is a collection of elements that can be accessed sequentially • linked list, in which items are linked to one another • Types of Linked Lists: • Singly Linked List: Each element points to its successor. • Doubly Linked List: Each element points to both its predecessor and successor. • Circularly Linked List: The last element points back to the first element. • Drawback: Access time is linear (O(n)), as elements must be traversed sequentially.
  • 52. Kernel Data Structures Stacks • Operations: – Push: Adds an item to the top of the stack. – Pop: Removes the top item from the stack. • Usage in Operating Systems – Function calls: Parameters, local variables, and return addresses are pushed onto the stack during function calls and popped off upon return. • Examples: Undo mechanisms in text editors, backtracking algorithms. • A stack is a sequentially ordered data structure that follows the Last In, First Out (LIFO) principle.
  • 53. Kernel Data Structures Queues • Operations – Enqueue: Adds an item to the end of the queue. – Dequeue: Removes the item from the front of the queue. • Usage in Operating Systems – Print jobs: Printed in the order they were submitted. – CPU task scheduling: Tasks waiting to be run are organized in queues. • Examples: Lines at a checkout counter, traffic signals. • A queue is a sequentially ordered data structure that follows the First In, First Out (FIFO) principle.
  • 54. Kernel Data Structures Trees • A tree is a hierarchical data structure consisting of nodes linked through parent-child relationships. • Components: – Node: Basic unit containing data. – Root: Topmost node with no parent. – Edge: Link between parent and child. – Leaf: Node with no children. – Subtree: Tree consisting of a node and its descendants. • General Trees • Structure: Each node can have an unlimited number of children. • Usage: Representing hierarchical data like organizational structures, file systems. • Binary Trees • A tree where each node has at most two children, referred to as the left child and the right child. • Properties: • Simplifies tree traversal and management. • Suitable for binary operations and expressions. • Binary Search Trees (BST) • A binary tree with an ordering property where for each node: • Left child ≤ Parent node. • Right child ≥ Parent node. • Example: Show a diagram of a BST.
  • 55. Kernel Data Structures Trees • Operations in BST – Insertion: Adding a new node while maintaining the BST property. – Deletion: Removing a node and reorganizing the tree to maintain the BST property. – Search: Finding a node with a specific value. • Balancing Algorithms – Need for Balancing: To prevent performance degradation in BST operations. – Common Balancing Techniques: • AVL Trees: Self-balancing BST where the difference in heights of left and right subtrees is at most one for all nodes. • Red-Black Trees: Balanced BST where nodes have an extra color attribute to ensure the tree remains balanced after insertions and deletions. • Practical Applications – Databases: Efficiently managing indexes. – File Systems: Hierarchical file directory structures. – Networking: Routing algorithms and multicast trees.
  • 56. Kernel Data Structures Hash Functions and Hash maps • Hash Function – A hash function takes data as input, performs a numeric operation, and returns a numeric value (hash). – Quickly retrieves data by using the hash value as an index into a table (typically an array). – Searching for a data item using a hash function can be as efficient as O(1), compared to O(n) for a linear search through a list. – Extensively used in operating systems for fast data retrieval. • Hash Map • A data structure that uses a hash function to map [key: value ] pairs. • Apply the hash function to the key to obtain the value from the hash map. • Example • User authentication: Map a user name to a password. • Steps: • User enters their user name and password. • Apply the hash function to the user name. • Use the hash value to retrieve the stored password. • Compare the retrieved password with the entered password for authentication.
  • 57. Applications of Hash Functions and Maps • Databases – Indexing and retrieving records efficiently. • Caching – Storing frequently accessed data for quick retrieval • Password Management – Storing hashed passwords for secure authentication. • Symbol Tables – Compiler design for variable and function lookups.
  • 58. Kernel Data Structures Bitmaps • A bitmap is a string of binary digits (bits) representing the status of items • Commonly used to track the availability of resources in an efficient manner • Binary Digits – Each bit in the bitmap represents the status of a corresponding item. – 0: Indicates that the resource is available – 1: Indicates that the resource is unavailable (or vice versa, depending on the convention used) • Example: Consider the bitmap 001011101 – Resources 2, 4, 5, 6, and 8 are unavailable. – Resources 0, 1, 3, and 7 are available.
  • 59. Applications of Bitmaps • Disk Block Management – Disk Drives: A medium-sized disk drive may be divided into thousands of disk blocks. – Bitmap Usage: A bitmap can represent the availability of each disk block efficiently. – Example: If a disk has 10,000 blocks, a 10,000-bit bitmap can track the availability of each block. • Memory Management – Page Allocation: Bitmaps can represent which pages in memory are allocated or free. • File Systems – Inode Allocation: Bitmaps can track which inodes are used or free in a filesystem. • Resource Allocation – Thread/Process Management: Bitmaps can track the availability of threads or processes in a pool.
  • 61. Traditional Computing • Traditional Office Environment – PCs connected to a network – Servers providing file and print services – Remote access was limited and awkward – Portability achieved via laptop computers – Terminals attached to mainframes • Modern Office Environment – Increased access methods to computing environments – Web technologies and increasing WAN bandwidth – Establishment of company portals for web accessibility – Use of network computers (thin clients) for enhanced security and maintenance • Home Computing Evolution – Transition from single computer with slow modem connection – Increased network-connection speeds at lower costs – Home networks including printers, client PCs, and servers – Use of firewalls for network security • Modern Computing Processes – Decline of traditional time-sharing systems – Use of scheduling techniques on desktop computers, laptops, servers, and mobile devices – Management of user and system processes to allocate computer time – Example: Multiple windows and web browser processes on a PC
  • 62. Mobile Computing • Mobile computing on handheld smartphones and tablets • Historical Limitations: Smaller screens, less memory, reduced functionality compared to PCs • Modern Advancements: – Multimedia: Music, video, digital books, high-definition video recording – Applications: Wide range including navigation, gaming, augmented reality – Unique Features: GPS chips, accelerometers, gyroscopes • Connectivity – Wireless: IEEE 802.11 – Cellular Data Networks • Operating Systems – Apple iOS: iPhone and iPad – Google Android: Various smartphones and tablets • Challenges • Limited memory and processing power compared to PCs
  • 63. Distributed Systems • Definition of Networked Computer Systems – Provides access to shared resources – Increases computation speed, functionality, data availability, and reliability • Types of Network Access – Generalized as file access (network interface’s device driver) – Specific network functions (e.g., FTP, NFS) • Network Fundamentals – Communication path between two or more systems – Dependent on networking for functionality – Varied by protocols, distances, and transport media • Common Network Protocols – TCP/IP: Fundamental architecture of the Internet, supported by most OS – Proprietary protocols for specific needs • Types of Networks by Distance • LAN: Local-Area Network (within a room, building, or campus) • WAN: Wide-Area Network (links buildings, cities, countries) • MAN: Metropolitan-Area Network (links buildings within a city) • PAN: Personal-Area Network (Bluetooth and 802.11 devices) • Networking Media • Copper wires, fiber strands, wireless transmissions • Satellites, microwave dishes, radios • Cellular phones, infrared communication • Operating Systems and Networking • Network Operating System: Provides file sharing and communication scheme • Distributed Operating System: Provides a unified environment, appearing as a single OS • Impact of Networking Protocols • Affects system utility and popularity • Integration with OS through network adapters and device drivers
  • 64. Client–Server Computing • Shift from Centralized to Decentralized Systems – Terminals connected to centralized systems replaced by PCs and mobile devices – Increased user-interface functionality on PCs via web interfaces • Client-Server Systems – Definition: Specialized distributed systems where servers satisfy requests from client systems • Types of Server Systems • Compute Servers • Provide an interface for clients to request actions (e.g., read data) • Server executes actions and sends results to clients • Example: Database servers responding to data requests • File Servers • Provide a file-system interface for clients • Clients can create, update, read, and delete files • Example: Web servers delivering files to web browsers • Impact of Client-Server Model • Enhanced efficiency and resource distribution • Scalable and flexible system architecture
  • 65. Peer-to-Peer Computing • Definition of P2P Systems: – Nodes act as both clients and servers – No distinction between clients and servers • Advantages of P2P Systems: – Avoids server bottlenecks – Services distributed across multiple nodes • Joining a P2P Network: – Node must join the network of peers – Nodes can request and provide services Service Discovery Methods • Centralized Lookup Service • Node registers its service with a centralized service • Client contacts the centralized service to find providers • Communication happens directly between client and service provider • Decentralized Discovery • No centralized service • Client broadcasts service request to all nodes • Nodes providing the service respond directly to the client • Requires a discovery protocol Examples of P2P Systems • Napster • Centralized server maintained an index of files • File exchange happened directly between peers • Gnutella • Clients broadcasted file requests • Nodes responded directly to the client • Skype • Hybrid approach with centralized login server • Decentralized peer communication using VoIP technology
  • 66. Virtualization • Definition • Allows operating systems to run as applications within other operating systems • OS natively compiled for a CPU runs within another native OS on the same CPU • Originated on IBM mainframes for concurrent task execution
  • 67. Virtualization • Virtualization vs. Emulation – Emulation • Translates instructions from one CPU type to another • Example: Apple’s Rosetta for IBM Power CPU to Intel x86 • Slower performance due to instruction translation – Interpretation • Executes high-level language code or translates to intermediate form • Example: Java runs on Java Virtual Machines (JVMs), essentially Java emulators • Virtualization in Modern Computing • VMware • Created to address issues with running multiple Windows XP applications • Allows running multiple guest OS on a host OS • Virtual Machine Manager (VMM) • Manages guest OS resources and protection • Example: Running Windows on a Mac OS X with x86 CPU • Applications and Benefits • Exploration and Compatibility • Users can install multiple OS for exploration • Run applications for different OS on the same machine • Development and Testing • Companies run multiple OS on a single server for development, testing, and debugging • Data Centers • Virtualization common for managing computing environments • VMMs like VMware ESX and Citrix XenServer act as the host
  • 68. Cloud Computing • Cloud computing is a type of computing that delivers computing, storage, and even applications as a service across a network. • Uses virtualization as a base for its functionality • Types of Cloud Computing – Public Cloud: Available to anyone via the Internet for a fee (e.g., Amazon EC2) – Private Cloud: Run by a company for internal use – Hybrid Cloud: Combines public and private cloud components – Software as a Service (SaaS) – one or more applications available via the Internet (i.e., word processor) – Platform as a Service (PaaS) – software stack ready for application use via the Internet (i.e., a database server) – Infrastructure as a Service (IaaS) – servers or storage available over Internet (i.e., storage available for backup use)
  • 69. Real-Time Embedded Systems • Found in car engines and manufacturing to DVDs and microwave ovens • Real-time embedded systems most prevalent form of computers – Vary considerable, special purpose, limited purpose OS, real-time OS – Have little or no user interface • Spend their time monitoring and managing hardware devices, such as automobile engines and robotic arms. • Many other special computing environments as well – Some have OSes, some perform tasks without an OS • Real-time OS has well-defined fixed time constraints – Processing must be done within constraint – Correct operation only if constraints met • Specialized computing systems designed to perform specific tasks within a defined time constraint. • embedded as part of a larger device, often in dedicated hardware, and interact with the physical environment through sensors and actuators.
  • 70. SESSION-4 Open-Source Operating Systems, Operating-System Services
  • 71. Open Source Operating Systems • Definition: Operating systems available in source code format, allowing users to view, modify, and distribute the code • Examples: – Linux: Most famous open-source OS – Microsoft Windows: Closed-source approach – Apple Mac OS X and iOS: Hybrid approach with open- source kernel (Darwin) and proprietary components • Benefits of Open-Source: – Transparency: Access to source code for learning and modification – Security: More eyes on the code can lead to quicker detection and fixing of bugs – Community Support: Contributions from a global community of programmers – Commercial Opportunities: Revenue through support contracts and hardware sales (e.g., Red Hat) • History – Early Days: Open-source was common; programs were shared among enthusiasts and user groups – Commercial Shift: Companies began limiting software use to protect code and manage copyrights – GNU Project: Started by Richard Stallman in 1983 to create a free, UNIX-compatible OS – GNU Manifesto (1985): Advocated for free and open- source software – Free Software Foundation (FSF): Formed to encourage the free exchange and use of software – GPL (General Public License): Requires source code distribution and copylefting (sharing modifications under the same license) • Notable Open-Source Projects – Linux Kernel – GNU Utilities – Firefox Browser – Apache Web Server
  • 72. Linux • Overview: – GNU/Linux: A prominent example of an open- source OS – Origins: GNU project provided UNIX- compatible tools; Linus Torvalds released a UNIX-like kernel in 1991 • Development: – Linus Torvalds: Started with a rudimentary kernel and invited global contributions – Internet Impact: Enabled rapid growth and updates with contributions from thousands of programmers • Use Cases – Servers, desktops, and embedded systems. – Various distributions tailored for specific purposes (e.g., gaming, enterprise). • Major Distributions – RedHat: Enterprise-focused, commercial use – SUSE: Versatile, with both community and enterprise versions – Fedora: Cutting-edge features, community-driven – Debian: Known for stability, foundational for many other distributions – Slackware: One of the oldest, known for simplicity – Ubuntu: User-friendly, popular for desktops and servers • Specialized Distributions – PCLinuxOS: LiveCD, can run directly from CD-ROM without installation – PCLinuxOS Supergamer DVD: LiveDVD with graphics drivers and games, designed for gaming enthusiasts • Features – Custom Builds: Each distribution varies in function, utility, applications, hardware support, and user interface – LiveCD/LiveDVD: Allows running the OS directly from a CD/DVD, useful for temporary or trial use without installation
  • 73. Run Linux on a Windows system 1. Download the free “VMware Player” tool from – http://www.vmware.com/download/player/ – and install it on your system. 2. Choose a Linux version from among the hundreds of “appliances,” or virtual machine images, available from VMware at – http://www.vmware.com/appliances/ – These images are preinstalled with operating systems and applications and include many flavors of Linux. 3. Boot the virtual machine within VMware Player.
  • 74. BSD (Berkeley Software Distribution) UNIX • History: – Origins: BSD UNIX derived from AT&T’s UNIX in 1978 – Licensing: Initially required an AT&T license; 4.4BSD-lite, released in 1994, became fully open- source • Distributions: – FreeBSD: Known for performance and advanced networking features – NetBSD: Focuses on portability across different hardware platforms – OpenBSD: Emphasizes security and code correctness – DragonFlyBSD: Designed for high-performance and advanced features • Exploring BSD UNIX: – Source Code: • Available with the distribution • Location: /usr/src/ (General source), /usr/src/sys/ (Kernel source) • Example: Virtual memory implementation can be found in /usr/src/sys/vm • Darwin and Mac OS X: – Darwin: Core kernel of Mac OS X based on BSD UNIX – Open Source: Available from Apple's Open Source site – Kernel Package: Starts with “xnu” • Use Cases: • Servers (e.g., FreeBSD used in some high-performance environments). • Network appliances and embedded systems. • Desktop environments (e.g., DesktopBSD).
  • 75. Solaris • Overview: – Solaris: Commercial UNIX-based operating system from Sun Microsystems – Origin: Evolved from SunOS, initially based on BSD UNIX, then moved to AT&T’s System V UNIX in 1991 • OpenSolaris: – Release: Most Solaris code was open-sourced in 2005 – Current Status: The project’s state is unclear post-Sun's acquisition by Oracle in 2009 – Access: Source code from 2005 still available at OpenSolaris Source Code • Project Illumos: – Background: Forked from OpenSolaris, expanded with additional features – Purpose: Basis for several products – Resources: Available at Illumos Wiki • Use Cases: – Enterprise environments. – High-performance computing and large-scale server deployments.
  • 76. Open-Source Systems as Learning Tools • Open-source operating systems like GNU/Linux, BSD UNIX, and Solaris serve as powerful educational resources for students and developers. • Benefits of Open-Source Systems for Learning – Access to Source Code • Exploration: Students can explore the complete source code, gaining insights into the inner workings of operating systems. • Modification: They can modify and test code to understand the effects of changes, helping to deepen their understanding of system internals. – Hands-On Experience • Real-World Applications: Working with actual operating systems provides practical experience with real-world code, beyond theoretical learning. • Debugging and Development: Opportunities to identify and fix bugs or contribute new features, enhancing problem- solving skills. – Educational Resources • Documentation: Many open-source projects come with extensive documentation that can be valuable for learning. • Community Support: Vibrant communities around these projects offer forums, mailing lists, and other resources where learners can ask questions and get help. – Understanding Historical Systems • Historical Context: Access to historic open-source projects like Multics can help students understand the evolution of operating systems and their design philosophies. – Cross-Pollination of Ideas • Shared Components: Components and ideas from one open-source project may be used in others, facilitating innovation and rapid improvements.
  • 77. Open-Source Systems as Learning Tools Specific Examples • GNU/Linux: – Versatility: Offers a wide range of distributions for different use cases, from desktop environments to specialized server setups. – Tools and Applications: Provides access to a broad array of tools and applications, enabling comprehensive learning experiences. • BSD UNIX: – Code Quality and Security: Known for its robust networking capabilities and security features, providing a good example of high-quality code and design. – Variations: Includes several distributions like FreeBSD, OpenBSD, and NetBSD, each with its focus and strengths. • Solaris: – Advanced Features: Offers advanced features like ZFS and DTrace, providing students with examples of cutting-edge technology in operating system design. – Illumos: The continued development of Illumos demonstrates the impact of open-source evolution on legacy systems.
  • 79. Operating System Services • Services to User – User interface – Program execution – I/O operations – File-system manipulation – Communications – Error detection • Services to OS itself – Resource allocation – Accounting – Protection and security
  • 80. Operating System Services • User Interface (UI) – Types of UI • Command-Line Interface (CLI): Uses text commands entered via keyboard. • Batch Interface: Commands and directives are entered into files, which are then executed. • Graphical User Interface (GUI): Uses a window system with a pointing device and keyboard for I/O, menu selections, and text entry. – Some operating systems offer multiple UI options (CLI, batch, GUI) • Program Execution – Program Loading and Running – Program Termination: Programs must be able to end normally or abnormally (indicating error). • I/O Operations – Requirements for running programs may need to perform I/O operations involving files or devices. – Special Functions may be required for specific devices (e.g., CD/DVD recording, screen blanking). – User Access typically restricted for efficiency and protection; OS provides controlled I/O access.
  • 81. Operating System Services • Communications – Process Communication: Needed for processes to exchange information. – Types: • Shared Memory: Processes read and write to a shared memory section. • Message Passing: Information packets are moved between processes by the OS. – Scope: Communication can occur between processes on the same computer or across a network. • Error Detection – Continuous Monitoring: The OS must constantly detect and correct errors. – Types of Errors: • Hardware Errors: CPU, memory (e.g., power failure, memory error). • I/O Device Errors: Disk errors, network failures, printer issues. • User Program Errors: Arithmetic overflow, illegal memory access, excessive CPU usage. – Error Handling: • System Halt: May halt the system for severe errors. • Process Termination: Terminate the error-causing process. • Error Codes: Return codes to processes for error detection and correction.
  • 82. Operating System Services • Resource Allocation – Multiple Users/Jobs: Efficient resource allocation is crucial when multiple users or jobs run simultaneously. – Types of Resources Managed • CPU Cycles: Managed with CPU-scheduling routines considering CPU speed, job requirements, available registers, etc. • Main Memory: Allocation for running processes. • File Storage: Allocation and management of disk space. • I/O Devices: Allocation of peripheral devices like printers and USB drives with general request and release code. • Accounting – Resource Usage Tracking: Keeping track of how much and what kinds of resources each user utilizes. – Purpose: • Billing: Users can be billed based on resource usage. • Usage Statistics: Accumulating data for system reconfiguration and improvement.
  • 83. Operating System Services • Protection and Security – Information Control: Owners of stored information control access in multiuser or networked systems. – Process Isolation: Ensuring that processes do not interfere with each other or the OS. – Access Control: Controlling access to system resources to ensure protection. – User Authentication: Requiring users to authenticate (e.g., via passwords) to access system resources. – External Security: Protecting external I/O devices, including network adapters, from unauthorized access. – Intrusion Detection: Recording all connections to detect break-ins. – Holistic Security: Ensuring security measures are comprehensive, as a system is only as secure as its weakest point.
  • 84. SESSION-5 User and Operating-System Interface, System Calls, Types of System Calls
  • 85. User and Operating System Interface • Command Interpreters • Graphical User Interfaces • Choice of Interface
  • 86. User Operating System Interface - CLI CLI or command interpreter allows direct command entry – Sometimes implemented in kernel, sometimes by systems program – Sometimes multiple flavors implemented – shells – Primarily fetches a command from user and executes it – Sometimes commands built-in, sometimes just names of programs • If the latter, adding new features doesn’t require shell modification
  • 87. User Operating System Interface - GUI • User-friendly desktop metaphor interface – Usually mouse, keyboard, and monitor – Icons represent files, programs, actions, etc – Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder) – Invented at Xerox PARC • Many systems now include both CLI and GUI interfaces – Microsoft Windows is GUI with CLI “command” shell – Apple Mac OS X is “Aqua” GUI interface with UNIX kernel underneath and shells available – Unix and Linux have CLI with optional GUI interfaces (CDE, KDE, GNOME)
  • 88. User Operating System Interface - GUI  Touchscreen devices require new interfaces  Mouse not possible or not desired  Actions and selection based on gestures  Virtual keyboard for text entry  Voice commands. The Mac OS X GUI
  • 89. System Calls • System calls are the fundamental interface between an application and the operating system. • Typically written in a high-level language (C or C++) • Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call use • Three most common APIs are – Win32 API for Windows, – POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and – Java API for the Java virtual machine (JVM)
  • 90. Example of System Calls • System call sequence to copy the contents of one file to another file
  • 91. System Call Implementation • Typically, a number associated with each system call – System-call interface maintains a table indexed according to these numbers • The system call interface invokes the intended system call in OS kernel and returns status of the system call and any return values • The caller need know nothing about how the system call is implemented – Just needs to obey API and understand what OS will do as a result call – Most details of OS interface hidden from programmer by API • Managed by run-time support library (set of functions built into libraries included with compiler) API – System Call – OS Relationship
  • 92. System Call Parameter Passing • Often, more information is required than simply identity of desired system call – Exact type and amount of information vary according to OS and call • Three general methods used to pass parameters to the OS 1. Simplest: pass the parameters in registers • In some cases, may be more parameters than registers 2. Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register • This approach taken by Linux and Solaris 3. Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system – Block and stack methods do not limit the number or length of parameters being passed Parameter Passing via Table
  • 93. Types of System Calls 1. Process Control 2. File Management 3. Device Management 4. Information Maintenance 5. Communication 6. Protection • Process control • create process, terminate process • end, abort • load, execute • get process attributes, set process attributes • wait for time • wait event, signal event • allocate and free memory • Dump memory if error • Debugger for determining bugs, single step execution • Locks for managing access to shared data between processes
  • 94. Types of System Calls • File management – create file, delete file – open, close file – read, write, reposition – get and set file attributes • Device management – request device, release device – read, write, reposition – get device attributes, set device attributes – logically attach or detach devices • Information maintenance • get time or date, set time or date • get system data, set system data • get and set process, file, or device attributes • Communications • create, delete communication connection • send, receive messages if message passing model to host name or process name • From client to server • Shared-memory model create and gain access to memory regions • transfer status information • attach and detach remote devices • Protection • Control access to resources • Get and set permissions • Allow and deny user access
  • 95. Examples of Windows and Unix System Calls EXAMPLE OF STANDARD C LIBRARY
  • 96. SESSION-6 System Programs, Operating-System Design and Implementation
  • 97. System Programs • Also known as system utilities • Provide a convenient environment for program development and execution. • They can be divided into: – File manipulation – Status information sometimes stored in a File modification – Programming language support – Program loading and execution – Communications – Background services – Application programs • Most users’ view of the operation system is defined by system programs, not the actual system calls
  • 98. System Programs • File management – Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories • Status information – Some ask the system for info - date, time, amount of available memory, disk space, number of users – Others provide detailed performance, logging, and debugging information – Typically, these programs format and print the output to the terminal or other output devices – Some systems implement a registry - used to store and retrieve configuration information • File modification – Text editors to create and modify files – Special commands to search contents of files or perform transformations of the text • Programming-language support - Compilers, assemblers, debuggers and interpreters sometimes provided • Program loading and execution- Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language • Communications – Provide the mechanism for creating virtual connections among processes, users, and computer systems – Example: Messaging, browsing, email, remote login, and file transfer
  • 99. System Programs • Background Services – Launch at boot time • Some for system startup, then terminate • Some from system boot to shutdown – Provide facilities like disk checking, process scheduling, error logging, printing – Run in user context not kernel context – Known as services, subsystems, daemons • Application programs – Don’t pertain to system – Run by users – Not typically considered part of OS – Launched by command line, mouse click, finger poke
  • 101. Operating System Design and Implementation • Design and Implementation of OS not “solvable”, but some approaches have proven successful • Internal structure of different Operating Systems can vary widely • Start the design by defining goals and specifications • Affected by choice of hardware, type of system • Design Goals – User goals – operating system should be convenient to use, easy to learn, reliable, safe, and fast – System goals – operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient
  • 102. Operating System Design and Implementation • Mechanisms and Policies – Mechanisms determine how to do something; – Policies determine what will be done. – The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later – For example, the timer construct is a mechanism for ensuring CPU protection, but deciding how long the timer is to be set for a particular user is a policy decision. – Specifying and designing an OS is highly creative task of software engineering
  • 103. Operating System Design and Implementation • Implementation – Much variation • Early OS’s in assembly language • Then system programming languages like Algol, PL/1 • Now C, C++ – Actually usually a mix of languages • Lowest levels in assembly • Main body in C • Systems programs in C, C++, scripting languages like PERL, Python, shell scripts – More high-level language easier to port to other hardware • But slower – Emulation can allow an OS to run on non-native hardware • MS-DOS was written in Intel 8088 assembly language • The Linux and Windows operating system kernels are written mostly in C • Some small sections of assembly code for device drivers and for saving and restoring the state of registers
  • 105. Operating System Structure • Simple Structure • Layered Approach • Microkernels • Modules • Hybrid Systems
  • 106. Operating System Structure - Simple Structure (MS-DOS) • MS-DOS – written to provide the most functionality in the least space – Not divided into modules – Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated – Application programs can access basic I/O routines directly, leading to system crashes from errant or malicious programs – Written for Intel 8088 with no dual mode or hardware protection, leaving base hardware accessible
  • 107. Operating System Structure - Simple Structure (UNIX) • UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. • The UNIX OS consists of two separable parts – Systems programs – The kernel • Consists of everything below the system-call interface and above the physical hardware • Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level
  • 108. Operating System Structure - Layered Approach • The operating system is divided into a number of layers (levels), each built on top of lower layers. • The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. • With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers
  • 109. Operating System Structure - Microkernels • Moves as much from the kernel into user space • Mach example of microkernel – Mac OS X kernel (Darwin) partly based on Mach • Communication takes place between user modules using message passing • Benefits: – Easier to extend a microkernel – Easier to port the operating system to new architectures – More reliable (less code is running in kernel mode) – More secure • Detriments: – Performance overhead of user space to kernel space communication
  • 110. Operating System Structure - Modules • Many modern operating systems implement loadable kernel modules – Uses object-oriented approach – Each core component is separate – Each talks to the others over known interfaces – Each is loadable as needed within the kernel • Overall, similar to layers but with more flexible – Linux, Solaris, etc
  • 111. Operating System Structure - Hybrid Systems • Most modern operating systems are actually not one pure model – Hybrid combines multiple approaches to address performance, security, usability needs – Linux and Solaris kernels in kernel address space, so monolithic, plus modular for dynamic loading of functionality – Windows mostly monolithic, plus microkernel for different subsystem personalities • Example: – the Apple Mac OS X operating system and the two most prominent mobile operating systems—iOS and Android.
  • 112. Operating System Structure - Hybrid Systems • Apple mobile OS for iPhone, iPad – Structured on Mac OS X, added functionality – Does not run OS X applications natively • Also runs on different CPU architecture (ARM vs. Intel) – Cocoa Touch Objective-C API for developing apps – Media services layer for graphics, audio, video – Core services provides cloud computing, databases – Core operating system, based on Mac OS X kernel
  • 113. Operating System Structure - Hybrid Systems • Developed by Open Handset Alliance (mostly Google) – Open Source • Similar stack to IOS • Based on Linux kernel but modified – Provides process, memory, device-driver management – Adds power management • Runtime environment includes core set of libraries and Dalvik virtual machine – Apps developed in Java plus Android API • Java class files compiled to Java bytecode then translated to executable than runs in Dalvik VM • Libraries include frameworks for web browser (webkit), database (SQLite), multimedia, smaller libc
  • 114. Operating-System Debugging • Failure Analysis • Performance Tuning • DTrace
  • 115. Operating-System Debugging • Debugging is finding and fixing errors, or bugs • Failure Analysis – OS generate log files containing error information – Failure of an application can generate core dump file capturing memory of the process – Operating system failure can generate crash dump file containing kernel memory – Beyond crashes, performance tuning can optimize system performance • Sometimes using trace listings of activities, recorded for analysis • Profiling is periodic sampling of instruction pointer to look for statistical trends – Kernighan’s Law: “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
  • 116. Operating-System Debugging • Performance Tuning • Performance tuning in operating systems is essential for optimizing system efficiency by identifying and resolving processing bottlenecks. • Monitoring System Performance – To identify bottlenecks, the system's performance needs to be monitored effectively. – The operating system must provide mechanisms for computing and displaying system behavior metrics. • Trace Listings – Event Logging: The system logs interesting events along with their time and important parameters into a trace file. – Post-Analysis: An analysis program processes the trace file to determine system performance, identify bottlenecks, and pinpoint inefficiencies. – Simulation: The trace data can be used as input for simulations to test suggested system improvements. – Error Detection: Traces also aid in identifying errors in operating-system behavior. • Interactive Performance Tools – These tools allow users and administrators to query the state of various system components in real-time to identify bottlenecks. • Examples: – UNIX top Command: Displays system resource usage and lists the top resource-using processes. – Disk I/O, Memory, and Network Tools: Provide insights into the state of disk I/O, memory allocation, and network traffic.
  • 117. Operating-System Debugging • Windows Task Manager – Functionality: • Similar to UNIX top, it includes information on current applications and processes, CPU and memory usage, and networking statistics. – User Interface: • Provides a graphical interface for users to monitor and manage system performance • Advanced Performance Analysis Tools – Research and Development: • Making operating systems easier to understand, debug, and tune is an active area of research. – Kernel-Enabled Tools: • A new generation of tools has emerged, significantly enhancing performance analysis capabilities.
  • 118. Operating-System Debugging • DTrace – DTrace tool in Solaris, FreeBSD, Mac OS X allows live instrumentation on production systems – Probes fire when code is executed within a provider, capturing state data and sending it to consumers of those probes – Example of following XEventsQueued system call move from libc library to kernel and back – DTrace code to record amount of time each process with UserID 101 is in running mode (on CPU) in nanoseconds
  • 119. Operating-System Debugging – This code enables scheduler probes and records the CPU time of processes with user ID 101 An example of Dcode
  • 121. Operating System Generation • SYSGEN is the process of configuring or generating an operating system for a specific computer system, taking into account its hardware and peripheral configurations. Here are the key points regarding SYSGEN: • Distribution and Installation – Operating systems are typically distributed on disk, CD-ROM, DVD-ROM, or as an ISO image. – A special SYSGEN program is used to configure the operating system based on the specific hardware setup. • Information Needed for SYSGEN – CPU Configuration • Determine the CPU type and installed options (e.g., extended instruction sets, floating-point arithmetic). For multiple CPU systems, describe each CPU. – Boot Disk Formatting : Decide how the boot disk will be partitioned and what will be stored in each partition. – Memory Availability: The system may determine available memory by probing memory locations until an illegal address fault occurs. – Device Availability: Identify available devices, including device number, interrupt number, type, model, and special characteristics. – Operating-System Options :Specify options such as buffer sizes, CPU scheduling algorithms, and maximum number of supported processes.
  • 122. Operating System Generation • Methods of System Generation – Source Code Modification • System administrator modifies the operating system's source code based on the hardware description. • The modified source code is compiled to create a tailored operating system. – Module Selection from Precompiled Library • System description is used to create tables and select modules from a precompiled library. • Modules are linked to form the operating system, which may be more general but faster to generate. – Table-Driven System • All code is included in the system, and selection occurs at execution time. • SYSGEN involves creating tables to describe the system.
  • 124. System Boot • The process of starting a computer by loading the operating system (OS) kernel is known as booting the system. • Bootstrap Program – Bootstrap Program/Loader: A small piece of code that locates the OS kernel, loads it into main memory, and starts its execution. – Two-Step Process: On some systems, a simple bootstrap loader first fetches a more complex boot program from disk, which then loads the kernel. • Initial Boot Sequence – CPU Reset Event: When the CPU is powered up or rebooted, the instruction register is loaded with a predefined memory location, initiating execution. – ROM: The initial bootstrap program is stored in Read-Only Memory (ROM), ensuring it is reliable and virus-free.
  • 125. System Boot • Tasks of the Bootstrap Program – Run Diagnostics: Checks the state of the machine. – System Initialization: Initializes CPU registers, device controllers, and main memory. – Load the OS: Locates and loads the OS kernel. • Types of Systems and Storage – Systems with ROM OS: Small systems like phones or game consoles may store the entire OS in ROM. • Advantage: Rugged and reliable. • Disadvantage: Updating the OS requires changing ROM hardware chips. – EPROM: Some systems use Erasable Programmable Read-Only Memory, which can be written to under specific conditions. – Firmware: General term for ROM and EPROM, bridging hardware and software characteristics. • Bootstrapping Larger Operating Systems – Firmware Bootstrap Loader: For large OSs, the bootstrap loader in firmware loads the OS from disk. – Boot Block: The firmware loads a small program from a fixed disk location (boot block) into memory, which in turn loads the entire OS. Example: GRUB - An open-source bootstrap program used in Linux systems, facilitating the loading of the OS kernel from disk.
  • 126. Classroom Activity • Group Activity (40 minutes): 06.08.2024 – Divide the students into small groups – Each group is assigned a type of operating system (e.g., Windows, Linux, macOS, Android, iOS, FreeRTOS, SteamOS, UNIX, OpenBSD). – Each group should research their assigned OS and prepare a short presentation covering: • Key features • Typical use cases • Strengths and weaknesses
  • 127. Classroom Activity • Team-1 Android • Team-2 Ubuntu • Team-3 Kali • Team-4 Windows • Team-5 Parrot OS • Team-6 SteamOS • Team-7 Unix • Team-8 MacOS • Team-9 Solaris • Team-10 Linux • Team-11 OpenBSD • Team-12 iOS • Team-13 RTOS