Operating System Oveew

Operating System Overview

What is an Operating System?

  • Interfaces the machine with applications.

  • Dynamically allocates shared system resources to programs.

  • Manages memory, processes, and devices.

Kernel

  • The portion of the OS in main memory.

  • Contains frequently used functions; also called the nucleus.

Objectives of an Operating System

  • Convenience: Makes the computer easier to use.

  • Efficiency: Allows efficient use of system resources.

  • Ability to evolve: Permits effective development and introduction of new functions without disrupting service.

OS as a User/Computer Interface

  • Provides abstraction over hardware.

  • Simplifies access to hardware resources.

  • Acts as a mediator between applications and hardware.

Key OS Services

  • Program Development: Provides tools like editors and debuggers.

  • Program Execution: Loads instructions, initializes I/O, and manages resources.

  • I/O Device Access: Offers a uniform interface for device interaction.

  • Controlled File Access: Manages file structures and permissions.

  • System Access: Controls security and resource sharing.

  • Error Detection & Response: Handles errors with minimal impact.

  • Accounting: Tracks resource usage.

System Interfaces

  • Instruction Set Architecture (ISA): Defines machine language instructions.

  • Application Programming Interface (API): Provides high-level access to system resources via libraries; enables interaction with the OS.

  • Application Binary Interface (ABI): Defines the system call interface for portability and hardware access; ensures portability across systems.

OS as a Resource Manager

  • Manages computer resources for data movement, storage, and processing.

  • Controls functions by managing resources.

  • Relinquishes control temporarily to the processor before regaining it.

Ease of Evolution of Software

  • Accommodates new hardware, user needs, security requirements, and system resources.

  • Supported by modular architecture, layering, and abstraction.

Key Factors for Ease of Evolution

  • Modularity: Components can be modified independently.

  • Abstraction: Allows compatibility with future technologies.

  • Dynamic updates: Allows dynamic loading and unloading of components.

Evolution of Operating Systems

  • Serial Processing (1940s – Mid-1950s): No OS; direct interaction with hardware.

  • Batch Systems (Mid-1950s – 1960s): Jobs submitted in batches; improves processor utilization.

  • Multiprogrammed Systems (Early 1960s): Multiple programs in memory; maximizes CPU usage.

  • Time-Sharing (Late 1960s): Interactive computing; multiple users share resources.

Serial Processing

  • No operating system, direct interaction with hardware.

  • Programs in machine code, loaded via input devices.

  • Users operate computers serially.

Challenges
  • Scheduling Issues: Manual sign-up sheets, inefficient time slots.

  • Setup Time: Manual loading, errors require restarting.

Innovations
  • Libraries, Linkers, Loaders, Debuggers, I/O driver routines all improve efficiency.

Batch Operating Systems

  • Improves processor utilization and reduce wasted time.

  • Jobs submitted in batches using a monitor program.

  • Monitor controls execution, reducing setup time and scheduling inefficiencies.

Monitor and Processor View
  • Monitor: Reads and executes jobs sequentially, controls scheduling.

  • Processor: Alternates between user programs and monitor execution.

Advantages
  • Computer can run unsupervised once started.

  • Increased efficiency by combining transactions into batches.

Disadvantages
  • Difficult to maintain priority, no direct user interaction.

  • CPU often idle, time delay before processing.

Multiprogramming System

  • Multiple programs loaded into main memory.

  • Maximizes CPU usage by switching between programs.

  • Context switching ensures no CPU time is wasted.

Key challenges:
  • OS must manage memory and provide protection to avoid one process modifying another.

  • Fragmentation occurs as programs enter or leave memory.

  • Large programs may not fit entirely in memory; solved by pagination and virtual memory.

Time-Sharing Systems

  • Interactive computing where users directly interact with the computer.

  • Processor time shared among multiple users.

  • Uses multiprogramming to handle multiple interactive jobs.

Parallel Systems

  • Multiple processors work together on a single task.

  • Share a common memory space.

  • Increases computational speed by dividing tasks into sub-tasks.

Distributed Systems

  • Multiple independent computers connected by a network.

  • Each node operates independently with its own memory.

  • Designed for tasks where each node performs a portion of the computation.

Key Differences:
  • Parallel Systems: Multiple processors with shared memory.

  • Distributed Systems: Multiple independent computers with their own memory and communication via a network.

Theoretical Advances in OS Development

  • Processes

  • Memory management

  • Information protection and security

  • Scheduling and resource management

Process

  • A program in execution.

  • An instance of a program running on a computer.

  • An entity that can be assigned to and executed on a processor.

  • A unit of activity with a single sequential thread of execution.

Computer System Development
  • Multiprogramming Batch Operation

  • General-purpose Time Sharing

  • Real-time transaction processing systems

Interrupt

  • Mechanism for modules (I/O, memory) to interrupt the processor.

  • Processor saves context and branches to an interrupt-handling routine.

Interrupts and the Instruction Cycle

  • Interrupts disabled during fetch stage

  • Interrupts enabled during execution stage

  • Check for interrupt; initiate interrupt handler

Simple Interrupt Processing

  • Device controller issues an interrupt.

  • Processor finishes execution and acknowledges interrupt.

  • Saves process state, pushes PSW and PC onto the control stack.

  • Restores process state, loads new PC value.

Multiple Interrupts

  • Disabled interrupt: processor ignores new requests.

  • Define priorities: higher-priority interrupts can interrupt lower-priority handlers.

Challenges in OS Coordination and Error Diagnosis

  • Managing multiple concurrent jobs.

  • Ad hoc methods for coordination.

  • Difficulties in error diagnosis.

Main Causes of Errors in OS

  • Improper Synchronization: Poor signaling leads to lost or duplicate signals.

  • Failed Mutual Exclusion: Simultaneous access to shared resources.

  • Nondeterminate Program Operation: Results depend on other programs' activities.

  • Deadlocks: Programs wait for each other.

Tackling Process Management Issues

  • Systematic approach needed; process concept foundation.

A process consists of:
  • An executable program

  • Associated data (variables, buffers, etc.)

  • The execution context (process state)

Thread

  • A single process can be broken up into multiple, concurrent threads.

Memory Management in OS

  • Process Isolation

  • Automatic Allocation and Management

  • Support of Modular Programming

  • Protection and Access Control

  • Long-Term Storage

Virtual Memory and File System

  • File System: Implements long-term storage through files.

  • Virtual Memory: Allows programs to use memory without limitations.

  • Paging Systems: Divides processes into fixed-size blocks (pages) for easier packing into memory.

Paging and Address Translation

  • Pages can be located anywhere in memory.

  • OS provides dynamic mapping from virtual to physical memory addresses.

  • Not all pages need to be in memory simultaneously (virtual memory).

Information Protection and Security

  • Increased need to protect information with time-sharing systems.

  • Operating systems provide built-in tools for security mechanisms.

Key Categories of Security in OS:
  • Availability: Ensures system is accessible and operational.

  • Confidentiality: Only authorized users can access data.

  • Data Integrity: Protects data from unauthorized changes.

  • Authenticity: Verifies the identity of users and ensures data is valid.

Scheduling and Resource Management

  • Balances fairness, differential responsiveness, and efficiency.

Scheduling Criteria:
  • Fairness: Equal access to resources.

  • Differential Responsiveness: Discriminating among different jobs based on service requirements.

  • Efficiency: maximizing throughout and minimize response time

OS Queues and Scheduling

  • Short-Term Queue: Processes ready to execute.

  • Long-Term Queue: New jobs waiting to enter the system.

  • I/O Queues: Processes waiting for I/O devices.

Scheduling Strategies:
  • Round- robin and priority-based scheduling

Balancing Fairness, Responsiveness, and Efficiency

  • Ongoing challenge to optimize system performance.

Virtual Machines and Virtualizing

  • Allows a single PC/server to run multiple operating systems.

VM Architecture:
  • A host OS can support multiple virtual machines (VMs), each running a separate OS.

Managing Application Execution

  • The OS manages resources to ensure smooth application execution.

What is a Process?

  • A program in execution

Essential Elements of a Process

  • Identifier

  • State

  • Priority

  • Program Counter

  • Memory Pointers

  • Context Data

  • I/O Status

  • Accounting Info

Process Control Block (PCB)

  • Data structure managed by the OS.

  • Contains sufficient information to interrupt and resume a process.

A Two-State Process Model

  • Running and Not running

Reason of Process Creation

  • New batch job

  • Interactive log- on

  • Created by OS to provide a service

  • Spawned by existing process

Reason for Process Termination

  • Normal completion

  • Error and fault conditions

  • Quit an application

  • User logs off

A Five-State Model

  • New, Ready, Running, Blocked, Exit

Process States

  • Ready

  • Blocked

  • Blocked/Suspend

  • Ready/Suspend

Reasons for Process Suspension

  • Swapping

  • Other OS reason

  • Interactive user request

  • Timing

  • Parent process request

OS Table Management Overview

  • Memory Tables

  • I/O Tables

  • File Tables

  • Process Tables

Memory Tables

  • Tracks main (real) and secondary (virtual) memory usage.

I/O, File, and Process Tables

  • I/O Tables

  • File Tables

  • Process Tables

General Structure of Operating System Control Tables

  • Process image

  • Memory tables

  • I/O tables

  • File tables

  • Primary process table

Physical Manifestation of a Process

  • The collection (program, data, stack, attributes) is known as the Process Image

Process Control Block (PCB)

  • The PCB contains details such as process identification, state information, memory management, and resource utilization.

Modes of Execution

  • User Mode

  • Kernel Mode

  • Mode Switching