ITM 301

Operating System

TU BITM · Semester 5 · BITM curriculum and programme regulation

Requirement
required
Credits
3
Study Guide
9 units available

Chapter notes

Authoritative study guide across 9 syllabus units

Open a unit to read its study notes.

Unit 1: Operating System Overview· 4 LHs· ~5 marks

Part 1: Core Concepts (2 Marks)

  • Operating System: System software acting as an intermediary between user applications and computer hardware, functioning as an Extended Machine (resource abstraction) and Resource Manager (allocating CPU, memory, devices).
  • System Call: The programmatic programmatic interface provided by the OS allowing user-level processes to request privileged services from the kernel (e.g., fork(), read(), write(), exec()).
  • Kernel Architectures:
    • Monolithic Kernel: All OS services (VFS, IPC, drivers, scheduler) execute in a single privileged address space (Linux).
    • Microkernel: Only essential primitives (IPC, low-level scheduling, memory mapping) run in kernel space; drivers and file systems run as user-space servers (Minix, QNX).

Part 2: Structural Frameworks (10 Marks)

Dual-Mode Operation Transition

  1. [User Process Execution] ---- User Mode (Mode bit = 1)
  2. Executes System Call (e.g. read())
  3. Software Interrupt (Trap / Syscall Instruction)
    • [Kernel System Call Handler] -- Kernel Mode (Mode bit = 0)
    • (Validates arguments, executes privileged hardware I/O)
  4. Returns from Trap
    • [User Process Resumes] ---- User Mode (Mode bit = 1)

Part 3: Distinction Tables

Basis of Comparison Monolithic Kernel Microkernel
Execution Space All core OS services run in privileged kernel space. Only bare minimal services in kernel space; servers in user space.
Performance High speed; direct internal function calls without IPC overhead. Slower due to constant message-passing IPC context switches.
Fault Isolation A crash in a third-party device driver crashes entire OS. A crashed server crashes only that user process; easily restarted.

Part 4: Worked Problems & Exam Traps

Process Creation with fork() System Call

#include <stdio.h>
#include <unistd.h>

int main() {
    pid_t pid = fork();

    if (pid < 0) {
        printf("Fork failed!\n");
    } else if (pid == 0) {
        // Child process receives return value 0
        printf("Hello from Child! (PID = %d)\n", getpid());
    } else {
        // Parent process receives Child's PID
        printf("Hello from Parent! (Child PID = %d)\n", pid);
    }
    return 0;
}

fork() duplicates the calling process. If you write fork(); fork(); fork();, total processes created is 23=82^3 = 8 (1 parent + 7 children).