CS Atlas GATE 2027
Operating Systems course
0 / 58 complete

Operating Systems/Phase 0 · Foundations from Zero

Lesson 0.1.1 · Item 1 of 58

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

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

On this page

1 · The Hook

Every app you open, from a browser to a game, competes for the same few things: the processor, the memory, the disk and the screen. The operating system (OS) is the referee that shares them out. Before we can understand the referee we need to know the players, and the units they are measured in (bytes and powers of two), because half of GATE OS questions are arithmetic on those units.

2 · Predict First

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

A memory has addresses written with 10 bits (each bit is 0 or 1). How many different addresses are there?

Make a guess in your head. The answer opens Section 3.

3 · Core Concept

Predict First — the answer

Each bit doubles the choices: 2 × 2 × … (10 times) = 2¹⁰ = 1024 addresses.

In plain words

A computer has a CPU (the worker who follows instructions), memory or RAM (the desk where the current work is laid out, fast but forgotten when power goes off), a disk (the cupboard: big, slow, permanent) and I/O devices (keyboard, screen, network). Everything is stored as bits, and sizes come in powers of two.

1. The four parts

PartJobEveryday picture
CPU (processor)executes instructions one after another, very fastthe cook
Main memory (RAM)holds the programs and data being used now; loses everything at power-offthe kitchen counter
Disk / SSDstores files permanently; thousands of times slower than RAMthe store-room
I/O deviceskeyboard, screen, network card, printerthe waiters and the doorbell

Speed order (fastest first): CPU registers → cache → RAM → SSD → hard disk.

2. Program vs process

A program is a file on disk (a recipe). A process is a program while it is running (a cook actually following the recipe, with ingredients on the counter). One program can be running as several processes at once (two browser windows).

3. Bits, bytes and powers of two

  • A bit is 0 or 1. A byte = 8 bits.
  • With n bits you can write 2ⁿ different patterns. 8 bits → 256 values.
  • Sizes (memory is counted in powers of two):
NameBytes
1 KB (kilobyte)2¹⁰ = 1024
1 MB2²⁰
1 GB2³⁰
1 TB2⁴⁰

4. Addresses

Memory is a long row of numbered boxes, each holding one byte (byte-addressable). The box number is its address.

  • n address bits → 2ⁿ addresses → 2ⁿ bytes of memory.
  • A memory of 2ⁿ bytes needs n address bits: 64 KB = 2⁶ × 2¹⁰ = 2¹⁶ → 16 bits.
  • 32-bit addresses → 2³² bytes = 4 GB.

5. Handy power-of-two arithmetic

Multiply by adding exponents, divide by subtracting: 4 GB / 4 KB = 2³² / 2¹² = 2²⁰ (about a million). You will do this constantly in memory management (Phase 5).

4 · Visual

The CPU works on what is in RAM; RAM is filled from the disk; I/O devices bring data in and out.

Address bitsNumber of bytes
102¹⁰ = 1 KB
162¹⁶ = 64 KB
202²⁰ = 1 MB
322³² = 4 GB

5 · Worked Examples

Example 1 Easy

How many bytes are in 8 KB?

Solution

8 × 1024 = 8192 = 2¹³.

Example 2 Medium

How many address bits are needed for a 256 MB byte-addressable memory?

Solution

256 MB = 2⁸ × 2²⁰ = 2²⁸ → 28 bits.

Example 3 GATE

A 4 GB memory is cut into 4 KB pieces. How many pieces?

Solution

2³²/2¹² = 2²⁰ = 1,048,576.

6 · GATE Traps

  • KB here means 2¹⁰ = 1024 bytes, not 1000.
  • Byte = 8 bits; don't mix bits and bytes in a size question.
  • n address bits give 2ⁿ addresses, not 2n.
  • A program is passive (a file); a process is active (running).

7 · Memory Hook

"n bits, 2ⁿ choices. Divide powers of two by subtracting exponents."

8 · Connect the Dots

You know the players. Next lesson introduces the referee: what the operating system does, and the special protected mode it runs in.

9 · Self-Test

GATE format. Try every question before opening the vault.

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

How many address bits does a 64 KB byte-addressable memory need?

Numerical answer: ________

Q2 · NAT · 1 mark(s) — Powers of two

How many 4 KB pieces fit in 64 MB?

Numerical answer: ________

Q3 · NAT · 2 mark(s) — Memory size

A machine has 36-bit addresses (byte-addressable). How many GB of memory can it address?

Numerical answer: ________

Q4 · MCQ · 1 mark(s) — Program vs process

Which statement is correct?

  1. (A) One program can never have two processes.
  2. (B) A program is a running process.
  3. (C) A process is a program in execution.
  4. (D) A process is stored on disk.

Q5 · MCQ · 1 mark(s) — Speed order

Which list is ordered from fastest to slowest?

  1. (A) RAM, registers, disk, cache
  2. (B) cache, disk, RAM, registers
  3. (C) disk, RAM, cache, registers
  4. (D) registers, cache, RAM, disk

10 · Rule Card

  • 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.

11 · Concept Ledger

Unlocked in this lesson. From here on, these terms may be used.

CPUmain memory (RAM)diskI/O devicesmemory hierarchyprogram vs processbit and bytepowers of twoKB, MB, GBbyte-addressable memoryaddress bits

12 · Answer Vault

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

🔐 Open the Answer Vault

Self-Test

Q1 Answer: 16 · 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: 16384 · 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

Q3 Answer: 64 · 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

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

Running = process.

  • (A) is wrong: Two browser windows are two processes.
  • (B) is wrong: Reversed.
  • (D) is wrong: Programs are stored; processes run in memory.

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

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

Closest to the CPU is fastest.

  • (A) is wrong: Registers are fastest.
  • (B) is wrong: Disk is slowest.
  • (C) is wrong: Reversed.

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

Ready for the next idea?

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