CS Atlas GATE 2027
Operating Systems course
0 / 58 complete

Operating Systems/Phase 0 · Foundations from Zero

Chapter review LI-0.1 · Item 4 of 58

Chapter 0.1 Lock-in

Read at your own pace. Try the questions before opening the answers.

On this page

Phase 0Ch 0.1 What an operating system does

ACompressed recap

CPU, RAM (volatile), disk (permanent), I/O; program vs process; bits and bytes; KB = 2¹⁰; n address bits ↔ 2ⁿ bytes. OS = resource manager + protection; user vs kernel mode; privileged instructions (I/O, timer, interrupts, memory registers); interrupts vs traps; timer interrupt. System call = trap into kernel and back (2 mode switches); library functions vs system calls.

BMerged rule card

0.1.1 Inside a computer: CPU, memory, disk, I/O; bits, bytes and powers of two

  • CPU executes, RAM holds current work (volatile), disk stores permanently, I/O connects the outside.
  • Program = file; process = program in execution.
  • Byte = 8 bits; n bits → 2ⁿ values; 1 KB = 2¹⁰, 1 MB = 2²⁰, 1 GB = 2³⁰.
  • 2ⁿ bytes ↔ n address bits; divide powers of two by subtracting exponents.

0.1.2 What an operating system does: kernel, user mode and kernel mode, interrupts

  • OS = resource manager + abstraction + protection; kernel runs in kernel mode.
  • Mode bit: user mode (restricted) vs kernel mode (all instructions).
  • Privileged: I/O, set timer, enable/disable interrupts, memory-management registers, halt. Not privileged: arithmetic, read clock, trap/system-call instruction.
  • Interrupt = from hardware; trap/exception = from the running program; timer interrupt returns control to the OS.
  • Multiprogramming keeps the CPU busy; time-sharing switches fast for interaction.

0.1.3 System calls: how programs ask the operating system for help

  • System call: wrapper → parameters + number → trap → kernel handler via system-call table → result → return to user mode (2 mode switches).
  • Parameters: registers, memory block, or stack.
  • Categories: process (fork, exec, exit, wait), file (open, read, write, close, lseek), device, information, communication.
  • printf, malloc, strlen are library functions; write, brk are system calls.
  • Monolithic kernel vs microkernel.

CInterleaved GATE-style questions

Q1 · NAT · 1 mark(s) — Address bits

How many address bits does a 2 GB byte-addressable memory need?

Numerical answer: ________

Q2 · NAT · 2 mark(s) — Division

A 1 GB memory is divided into 8 KB blocks. How many blocks?

Numerical answer: ________

Q3 · MCQ · 1 mark(s) — Process

Two copies of the same text editor are open. How many processes are running the editor?

  1. (A) 2
  2. (B) 0
  3. (C) It depends on the file size
  4. (D) 1

Q4 · MCQ · 1 mark(s) — Privilege

Which instruction need NOT be privileged?

  1. (A) Halt the processor
  2. (B) Load the base/limit memory registers
  3. (C) Read the processor clock
  4. (D) Disable interrupts

Q5 · MCQ · 1 mark(s) — Traps

Division by zero in a user program causes:

  1. (A) a hardware interrupt from a device
  2. (B) a trap (exception) to the OS
  3. (C) a switch to user mode
  4. (D) nothing; the result is 0

Q6 · MSQ · 2 mark(s) — Modes

Which statements are true?

  1. (A) The mode bit records whether the CPU is in user or kernel mode.
  2. (B) A timer interrupt lets the OS regain the CPU.
  3. (C) User programs may execute I/O instructions directly.
  4. (D) The kernel runs in kernel mode.

Q7 · NAT · 1 mark(s) — System calls

A program calls printf 10 times; the library buffers the text and issues 2 write system calls. How many times does the program enter the kernel for printing?

Numerical answer: ________

Q8 · MCQ · 1 mark(s) — Library vs system call

malloc is best described as:

  1. (A) an interrupt handler
  2. (B) a library function that may use a system call (brk or mmap) to get more memory
  3. (C) a privileged instruction
  4. (D) a system call

DAnswer Vault

Try the questions first. Open when you are ready to check.

🔐 Open the Answer Vault

Q1 Answer: 31 · 1 mark(s)

2 × 2³⁰ = 2³¹.

Re-read: Lesson 0.1.1 — Inside a computer: CPU, memory, disk, I/O; bits, bytes and powers of two

Q2 Answer: 131072 · 2 mark(s)

2³⁰/2¹³ = 2¹⁷.

Re-read: Lesson 0.1.1 — Inside a computer: CPU, memory, disk, I/O; bits, bytes and powers of two

Q3 Answer: (A) · 1 mark(s)

Each running copy is a process.

  • (B) is wrong: They are running.
  • (C) is wrong: Unrelated.
  • (D) is wrong: One program, two processes.

Re-read: Lesson 0.1.1 — Inside a computer: CPU, memory, disk, I/O; bits, bytes and powers of two

Q4 Answer: (C) · 1 mark(s)

Reading the clock cannot harm anyone.

  • (A) is wrong: Would stop everything.
  • (B) is wrong: Would break memory protection.
  • (D) is wrong: Could stop the OS from regaining control.

Re-read: Lesson 0.1.2 — What an operating system does: kernel, user mode and kernel mode, interrupts

Q5 Answer: (B) · 1 mark(s)

An error in the running program.

  • (A) is wrong: No device is involved.
  • (C) is wrong: It enters kernel mode.
  • (D) is wrong: The OS must handle it.

Re-read: Lesson 0.1.2 — What an operating system does: kernel, user mode and kernel mode, interrupts

Q6 Answer: (A) (B) (D) · 2 mark(s)

I/O instructions are privileged.

  • (C) is wrong: They must go through system calls.

Re-read: Lesson 0.1.2 — What an operating system does: kernel, user mode and kernel mode, interrupts

Q7 Answer: 2 · 1 mark(s)

Only the write calls trap.

Re-read: Lesson 0.1.3 — System calls: how programs ask the operating system for help

Q8 Answer: (B) · 1 mark(s)

Runs in user mode, occasionally asks the kernel.

  • (A) is wrong: Not a handler.
  • (C) is wrong: Not an instruction.
  • (D) is wrong: The system calls are brk/mmap.

Re-read: Lesson 0.1.3 — System calls: how programs ask the operating system for help

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.