1. LPU MCA Semester 1
  2. CAP366
  3. Unit 1

CAP366 · Unit 1: Introduction to operating systems

What an operating system is and what it does

11 practice questions · in the MTE and ETE syllabus

Key points

  • OS = resource allocator + control program
  • Mode bit separates user and kernel mode
  • Privileged instructions run only in kernel mode
  • Timer interrupt lets the OS regain the CPU

An operating system is the software layer that sits between users/programs and the hardware. It plays two roles: a resource manager/allocator (CPU, memory, files, devices are shared fairly and efficiently) and a control program that stops programs from damaging each other or the machine.

The key protection mechanism is dual-mode operation: a mode bit separates user mode from kernel mode, and privileged instructions (I/O, setting the timer, disabling interrupts, changing memory maps) run only in kernel mode. A timer guarantees the OS regains the CPU from a program that never yields.

MechanismPrevents
Mode bit + privileged instructionsPrograms touching devices or other programs directly
Timer interruptA program keeping the CPU forever
Memory protectionReading/writing another program's memory

Exam pitfall: the kernel is the always-resident core of the OS, not the whole OS; a compiler or GUI is not an OS service, and a privileged instruction in user mode causes a trap, not a silent skip.

Try two questions

Question 1 · Tier 4, Analyse

Why must the instruction that disables timer interrupts be privileged?

  1. A program could otherwise keep the CPU forever and the OS could never regain control
  2. The timer hardware would otherwise lose its count and the system clock would run fast
  3. Disk controllers would otherwise stop delivering their completion interrupts to drivers
  4. The process would otherwise be unable to make system calls into the kernel at all
Show the answer

A. The timer lets the OS preempt a running program. If user code could disable it, one program could monopolise the CPU.

Why not B: Disabling interrupts does not corrupt the counter; the issue is loss of OS control.

Why not C: Timer interrupts are separate from device interrupts, and this is not the protection reason.

Why not D: System calls use a trap instruction and do not depend on the timer interrupt.

Question 2 · Tier 3, Apply

A student program running in user mode tries to execute a privileged I/O instruction directly. What does the hardware do?

  1. It executes the instruction because the OS granted the program a time slice
  2. It ignores the instruction silently and continues with the next one
  3. It sets the mode bit to kernel and runs the instruction for the program
  4. It raises a trap so the OS regains control and can terminate the program
Show the answer

D. Privileged instructions in user mode cause a trap into the kernel, which usually kills the offending process. This is how dual-mode operation protects the OS.

Why not A: A time slice grants CPU time, not permission to run privileged instructions.

Why not B: Silent skipping would hide the fault; the hardware signals an exception instead.

Why not C: Only a trap or system call into OS code changes the mode, never the program itself.