← Back to Operating Systems

Worked Examples

Learn to identify and explain OS functions in real scenarios

1

Running Multiple Applications

Scenario

A student has the following applications open: Google Chrome (8 tabs), Microsoft Word, Spotify (playing music), and a file manager window. She switches between Word and Chrome frequently while music continues playing. Her computer has a single-core processor and 8GB RAM.

Question: Explain how the operating system manages this situation.

🔍 Step 1: Identify the OS Functions Involved

What's Happening OS Function
Four programs appear to run simultaneously Memory Management - Multitasking
Each program needs RAM to store data Memory Management - Allocation
User clicks between windows User Interface - GUI
Music plays through speakers Peripheral Management - Audio output

✅ Step 2: Explain Memory Allocation

The OS allocates a portion of RAM to each application:

Application Approximate RAM Usage What's Stored
Chrome (8 tabs) ~2GB Web page content, JavaScript, images for each tab
Microsoft Word ~500MB Program code, document content, undo history
Spotify ~300MB Application, buffered audio data
File Manager ~100MB Folder contents, thumbnails
Operating System ~2GB Core OS processes, UI, drivers

Total: ~5GB of 8GB RAM used, leaving headroom for smooth operation.

📋 Step 3: Explain Multitasking (Time Slicing)

With a single-core processor, true simultaneous execution is impossible. The OS achieves multitasking through time slicing:

Chrome (5ms) → Word (5ms) → Spotify (5ms) → File Manager (5ms) → Repeat...
  • The OS rapidly switches the CPU between programs (hundreds of times per second)
  • Each program gets a small "time slice" of CPU attention
  • This happens so fast that users perceive simultaneous operation
  • The active window (Word or Chrome) may get priority (more time slices)
  • Spotify gets consistent slices to prevent audio stuttering
Key Insight: Memory Management handles two related but different tasks: (1) allocating separate RAM space to each program, and (2) scheduling CPU time between programs. Both are essential for multitasking.
2

Installing and Using a New Printer

Scenario

A user connects a new USB printer to their computer. Windows displays "Setting up device..." and then "Your device is ready to use." The user opens a Word document and clicks Print. The document appears in the print queue, then prints successfully.

Question: Explain the role of the OS at each stage of this process.

🔍 Step 1: Device Detection and Driver Installation

Step OS Action OS Function
USB cable plugged in OS detects new hardware via USB interrupt signal Peripheral Management
"Setting up device..." OS identifies device type and searches for appropriate driver Peripheral Management
Driver installation OS installs driver software (from Windows Update or device) File Management + Peripheral
"Device ready" OS confirms driver loaded and communication established Peripheral Management

✅ Step 2: The Printing Process

Step OS Action Why It's Needed
User clicks Print in Word Application sends print request to OS Applications don't communicate directly with hardware
OS receives request Print job added to print queue (buffer) Printer is slower than CPU; queue prevents blocking
OS processes job Passes document to printer driver Driver translates document into printer commands
Driver sends data Printer-specific commands sent via USB Each printer model needs specific commands
Document prints Printer executes commands, OS monitors for errors OS handles issues like "out of paper"

📋 Step 3: Why Drivers Are Essential

The driver acts as a translator:

Word says "Print page" → OS receives request → Driver translates → Printer understands
  • Without the driver, the OS wouldn't know how to communicate with this specific printer
  • Different printers use different command languages
  • The driver hides this complexity from applications
  • Applications just say "print" - the OS and driver handle the details
Key Insight: Peripheral Management involves: detecting devices (Plug and Play), loading drivers, managing data transfer (buffers/queues), and handling communication between applications and hardware.
3

School Network User Management

Scenario

At a school, students log in with usernames like "2025jsmith". When John logs in, he sees his own Documents folder with his coursework. He cannot see files belonging to other students. He tries to install a game but gets "Administrator privileges required." Teachers can access a shared Teaching Resources folder that students cannot see.

Question: Explain how User Management controls this system.

🔍 Step 1: Account Structure

User Type Account Characteristics Access Rights
Students Standard user account (e.g., 2025jsmith) Own files only, read shared resources, no software install
Teachers Staff account with elevated privileges Own files, Teaching Resources folder, limited software install
IT Admin Administrator account Full access - all files, all settings, software installation

✅ Step 2: Authentication Process

When John types his username and password:

  1. The OS receives the credentials
  2. Credentials are checked against the user database (often on a server)
  3. If correct, the OS creates a session for that user
  4. John's profile is loaded, including his settings and permissions
  5. His personal folder (H:\2025jsmith\) is mounted as his Documents

📋 Step 3: Access Rights in Action

Action John Tries Result How OS Enforces This
Open his own document ✓ Allowed He has Read/Write permission on his folder
View another student's folder ✗ Denied No permission to read other students' folders
Open Teaching Resources ✗ Denied / Not visible Student group has no access to this folder
Install a game ✗ Denied Software installation requires Admin rights
Change desktop wallpaper ✓ Allowed Personal settings are permitted
Key Insight: User Management provides three key benefits: Security (protecting data from unauthorised access), Privacy (keeping each user's data separate), and Control (limiting what actions users can perform to protect the system).
4

File Management Operations

Scenario

Sarah downloads a file called "download(1).pdf" to her Downloads folder. She wants to organise it properly. She: (1) Creates a new folder "Computing" inside Documents, (2) Renames the file to "Unit1_Notes.pdf", (3) Moves it to the new folder, (4) Double-clicks to open it in Adobe Reader.

Question: Explain the file management operations and how the OS handles them.

🔍 Step 1: Understanding the File System

The OS maintains a hierarchical file system:

C:\
├── Users\
│   └── Sarah\
│       ├── Documents\
│       │   └── Computing\          ← New folder created here
│       │       └── Unit1_Notes.pdf  ← File moved here
│       └── Downloads\
│           └── download(1).pdf     ← Original location
└── Program Files\
    └── Adobe Reader\               ← Application to open PDF
                

✅ Step 2: Each Operation Explained

Operation What the OS Does File System Changes
Create folder "Computing" Allocates space in file system, creates folder entry New directory entry added under Documents
Rename file Changes the filename in the file system table File data unchanged, only the name reference updates
Move file Updates file's location reference in file system File data may stay in same physical location; pointer changes
Open file Looks up .pdf association, launches Adobe Reader, loads file to RAM File read from storage into memory

📋 Step 3: File Extensions and Associations

When Sarah double-clicks "Unit1_Notes.pdf":

  1. OS reads the file extension (.pdf)
  2. OS checks its registry of file associations
  3. Finds that .pdf files should open with Adobe Reader
  4. Launches Adobe Reader application
  5. Passes the file path to Adobe Reader
  6. Adobe Reader loads the PDF into memory
Key Insight: The file system provides a logical, organised view of storage. When you "move" a file to another folder on the same drive, the actual data often doesn't move - just the reference to its location changes. This is why moving is usually instant, but copying takes time.

Practice Problems

Now try analysing these scenarios yourself:

Problem 1: Computer Running Slowly

A user complains their computer is very slow. Task Manager shows: CPU: 15%, RAM: 98% used, Disk: 100% active. They have many browser tabs and applications open. What is happening and which OS function is involved?

Memory Management is the key function:

  • RAM is 98% full - almost all physical memory is in use
  • Disk at 100% indicates heavy use of virtual memory
  • The OS is swapping data between RAM and hard drive (much slower)
  • This "thrashing" causes the slowdown, not CPU (which is only 15% used)

Solution: Close some applications to free RAM, or add more RAM to the computer.

Problem 2: Device Not Working

After a Windows update, a user's wireless mouse stops working. The mouse worked fine yesterday. The USB receiver is plugged in and the light is on. What is the most likely cause and solution?

Peripheral Management / Driver issue:

  • The Windows update may have changed or broken the mouse driver
  • Hardware is fine (light is on) but OS can't communicate with it
  • The driver that translates between OS and mouse is not working correctly

Solution: Go to Device Manager, find the mouse, and either:

  • Update the driver (download latest from manufacturer)
  • Roll back the driver to the previous version
  • Uninstall and reinstall the driver

Problem 3: GUI vs CLI

A system administrator needs to rename 500 files, changing "report_2024_" to "archive_2024_" at the start of each filename. Why might they choose to use Command Line Interface instead of the GUI?

Advantages of CLI for this task:

  • Speed: One command can rename all 500 files at once
  • Automation: The command can be saved as a script for future use
  • Precision: Pattern matching ensures only correct files are renamed
  • Efficiency: GUI would require 500 individual rename operations

Example command (PowerShell):

Get-ChildItem report_2024_* | Rename-Item -NewName { $_.Name -replace 'report_2024_','archive_2024_' }

This single command does what would take hours in a GUI.