CACS251 Operating System

Operating SystemUnit 17 min read

OS Basics: Definitions, Goals, Kernels & System Structures

Unit 1 of Operating System introduces the core concepts of OS—its definition, objectives, types of kernels, system structures, and how it interacts with hardware/software to manage resources efficiently.

What is an Operating System?

An Operating System (OS) is a system software that acts as an interface between hardware and application software. It manages system resources (CPU, memory, I/O devices) and provides services to users and applications.

Key Functions of an OS

mindmap
  root((Operating System))
    Functions
      Process Management
      Memory Management
      File System Management
      Device Management
      Security & Protection
    Services
      User Interface
      Program Execution
      I/O Operations
      File System Manipulation
      Communication
      Error Detection & Recovery

Why Do We Need an OS?

Without an OS, a computer would be useless because:

  • Users would have to manually control hardware.
  • Programs would not be able to run efficiently.
  • Resources would be wasted due to poor management.

Objectives of an Operating System

An OS aims to:

  1. Execute user programs efficiently.
  2. Make computing more convenient (e.g., GUI, command-line).
  3. Use computer hardware in an efficient manner (maximize resource utilization).
  4. Provide an environment for program development and execution.
  5. Control system performance (e.g., scheduling, memory allocation).
  6. Isolate the user from hardware (abstraction).

Types of Operating Systems

OS can be classified based on user interaction, processing mode, and hardware support:

Classification Types Description
By User Interaction Batch OS, Time-sharing OS, Real-time OS Batch: Jobs run in batches (e.g., old mainframes). Time-sharing: Multiple users (e.g., Linux). Real-time: Instant response (e.g., medical systems).
By Processing Mode Multiprogramming, Multitasking, Multiprocessing Multiprogramming: Multiple jobs in memory. Multitasking: Multiple tasks at once (e.g., Windows). Multiprocessing: Multiple CPUs (e.g., servers).
By Hardware Support Single-user, Multi-user, Distributed Single-user: One user at a time (e.g., Windows). Multi-user: Multiple users (e.g., Linux). Distributed: Spread across networks (e.g., cloud OS).

Kernel: The Core of an OS

The kernel is the central part of an OS that manages system resources and provides an interface for applications.

Types of Kernels

Kernel Type Description Examples
Monolithic Kernel Entire OS runs in kernel space (tightly coupled). Linux (early versions)
Microkernel Only essential services run in kernel; others run as user-space processes. QNX, MINIX
Hybrid Kernel Combines monolithic and microkernel approaches. Windows, macOS
Exokernel Provides minimal abstraction; applications manage resources directly. Nemesis, Exokernel (MIT)

How a Kernel Works

stateDiagram-v2
  [*] --> Kernel_Initialization
  Kernel_Initialization --> Hardware_Abstraction
  Hardware_Abstraction --> Process_Management
  Process_Management --> Memory_Management
  Memory_Management --> File_System
  File_System --> Device_Drivers
  Device_Drivers --> [*]

System Structures

An OS can be structured in different ways to improve modularity and efficiency:

1. Simple Batch System

  • Jobs are executed in batches.
  • No user interaction during execution.
  • Example: Early mainframe systems.

2. Multiprogramming System

  • Multiple jobs are kept in memory.
  • CPU switches between jobs when one is waiting.
  • Example: Unix-like systems.

3. Time-Sharing System

  • Multiple users share the system interactively.
  • CPU time is divided among users.
  • Example: Linux, Windows Server.

4. Real-Time System

  • Must respond within strict deadlines.
  • Hard real-time: Missed deadline = failure (e.g., aviation systems).
  • Soft real-time: Delay is tolerable (e.g., video streaming).

In the Real World

  1. eSewa (Nepal)

    • Uses a multi-user OS (Linux-based servers) to handle thousands of transactions simultaneously.
    • Kernel: Hybrid (manages security, payment processing, and user authentication efficiently).
  2. WhatsApp (Global)

    • Runs on distributed OS principles (servers across the world handle messages in real-time).
    • Kernel: Custom-built for scalability (handles billions of messages/day).
  3. Nepal Rastra Bank (NRB) Systems

    • Uses real-time OS for financial transactions (e.g., RTGS) to ensure instant processing.
    • Kernel: High-security hybrid kernel to prevent fraud.

Exam Tip

  • Definition-based questions (e.g., "Define OS") → Must include key points (resource management, user interface, hardware abstraction).
  • Comparison questions (e.g., monolithic vs. microkernel) → Use tables for clarity.
  • Real-world applications → Link to eSewa, WhatsApp, or banking systems in answers.
  • Kernel types → Memorize examples (Linux = monolithic, QNX = microkernel).

Worked Example: CPU Utilization in a Bank System

Suppose a bank’s OS processes 10 transactions per second, each taking 50ms on average.

  • CPU Utilization = (Total CPU time used) / (Total available time) = (10 × 50ms) / 1000ms = 50%
  • Implication: The bank’s OS must be efficient (e.g., multitasking) to handle more transactions without slowing down.

Visual: OS Layers (Abstraction)

Explanation:

  • Hardware → Physical components (CPU, RAM, disk).
  • Kernel → Manages processes, memory, I/O.
  • Shell → Provides user interface (e.g., Command Prompt, Terminal).
  • Applications → Run on top (e.g., Chrome, Word).

Visual: Kernel vs. Non-Kernel Components

pie
  title Kernel vs. Non-Kernel Components
  "Kernel Space (Core OS)" : 40
  "User Space (Applications)" : 60

Key Idea:

  • Kernel space → Privileged operations (e.g., memory access).
  • User space → Normal applications (e.g., games, browsers).

Real Picture: Motherboard (Hardware OS Interacts With)


Final Checklist for Exam

✅ Define OS and its 5 key objectives. ✅ Differentiate monolithic, microkernel, and hybrid kernels with examples. ✅ Explain system structures (batch, multiprogramming, time-sharing). ✅ Relate OS concepts to eSewa, WhatsApp, or banking systems. ✅ Solve CPU utilization problems (like the bank example above).


Next: Study Process Management (Unit 2)—where we dive into how OS schedules and controls processes!

Based on the TU BCA syllabus for Operating System (CACS251), unit 1.

Discussion

Loading…