Previous | Tutorial index | Next
Tutorial 6: What Computer Systems Are Made Of
Learning Objective
To be able to explain what computer systems are made of.
6.1 Introduction: The Whole is Greater Than the Sum of Its Parts
In Tutorial 2, we examined the individual hardware components (CPU, RAM, motherboard). In Tutorial 3, we explored the foundational principles (von Neumann architecture, binary, FDE cycle). But a computer system is more than just a pile of silicon and copper. It is a dynamic synergy of hardware and software—where the physical body meets the logical mind.
A computer system is an integrated set of devices and programs designed to receive, process, manage, and present information. Understanding the system view means understanding how these layers stack, how they communicate, and how they are managed. This tutorial ties together all the previous concepts, introduces the critical role of the Operating System (OS) as the "master orchestrator," and explores how the same fundamental principles apply to everything from a smartwatch to a supercomputer.
6.2 Hardware: The Physical Foundation
As covered in Tutorial 2, hardware is the tangible, physical part of the system. However, in a "systems" context, we must view hardware not as isolated parts, but as a cooperative network of components connected by buses.
Key Hardware Subsystems (Recap and System View):
- Processing Unit (CPU): The active agent. It fetches, decodes, and executes instructions.
- Main Memory (RAM): The working space. It holds the active program and its data. It is volatile and fast.
- Storage (HDD/SSD): The long-term repository. It holds data persistently, but is slower than RAM.
- Input/Output (I/O) Devices: The system's sensory organs and appendages (keyboard, mouse, monitor, network card).
- Motherboard & Buses: The nervous system. Buses (data, address, control) transfer information between components. The chipset manages the traffic.
The Critical Interconnect (Buses):
Data moves between the CPU, RAM, and I/O devices via the System Bus. The bus is actually three separate pathways:
- Data Bus: Carries the actual data (e.g., a number being moved to a register).
- Address Bus: Carries the location (address) in memory where the data is going or coming from. The width of the address bus determines the maximum RAM the system can support (e.g., a 32-bit address bus can address up to 4GB of RAM).
- Control Bus: Carries command signals (e.g., "Read from memory," "Write to I/O device," "Interrupt request") that synchronize and orchestrate the actions.
6.3 Software: The Logical Mind
If hardware is the body, software is the instructions that make it useful. Software is divided into distinct layers.
6.3.1 System Software
System software forms the foundation. It manages the hardware and provides a platform for applications. It is typically written in lower-level languages (like C/C++) and runs with high privileges.
- Operating System (OS): The most critical piece. Examples: Windows, macOS, Linux, Android, iOS. We will dive deeply into this in section 6.5.
- Device Drivers: Specialized programs that act as translators. The OS uses a generic command like "print this document." The driver translates that into the specific electrical signals required by a particular printer model (e.g., HP LaserJet vs. Canon InkJet).
- Utility Programs: System maintenance tools. Examples: disk defragmenters, antivirus scanners, backup utilities, and system monitors.
- Firmware: Software stored in non-volatile ROM (e.g., BIOS/UEFI). It is the first software to run when the computer powers on, initializing the hardware and loading the OS from storage.
6.3.2 Application Software
Application software runs on top of the system software. It is designed for end-users to perform specific tasks.
- Productivity: Word processors, spreadsheets, email clients.
- Web browsers: Chrome, Firefox, Safari.
- Development tools: Python interpreter, VS Code, compilers.
- Games: Video games that heavily leverage the GPU.
- Specialized: Database management systems, CAD software, AI training frameworks.
6.3.3 Middleware
Software that connects different software applications. It sits "between" the OS and applications. Example: A web server (Apache, Nginx) that allows web applications to communicate via HTTP, or a database driver that allows an app to talk to a SQL server.
6.4 How Hardware and Software Interact: The Synergy
The interaction is a continuous cycle of translation and execution.
- Input: You press the 'A' key on the keyboard.
- Interrupt: The keyboard controller sends an Interrupt signal to the CPU. An interrupt tells the CPU to pause its current work and handle the keyboard input immediately.
- OS Catch: The OS (via its keyboard driver) reads the key code from the keyboard buffer.
- OS Processing: The OS determines which application window is active. It packages the key press into an "event" (e.g.,
WM_KEYDOWN on Windows, or an Event on Linux).
- Application Receives: The OS sends this event to the application program's message queue.
- Application Logic: The application (e.g., a notepad) processes the event. It checks if 'A' should be added to a document buffer.
- API Call: The application does not draw the 'A' directly on the screen. Instead, it calls a function from the OS's Graphics API (Application Programming Interface) such as
DrawText().
- Driver + GPU: The OS translates this API call into driver commands sent to the GPU.
- Output: The GPU renders the pixel data into its framebuffer. The monitor refreshes and displays the updated image.
The Key Rule: An application cannot write directly to the hard drive or the screen memory. It must ask the OS to do it on its behalf via system calls (APIs). This prevents a buggy or malicious application from crashing the entire system or stealing data.
6.5 The Operating System: The Master Resource Manager
The OS is the most fundamental piece of software. When a computer boots, the BIOS/UEFI loads the OS kernel into RAM, which then stays in control permanently. The OS has four primary jobs:
6.5.1 Process Management (Scheduling)
A process is a program in execution (e.g., Chrome, VS Code, a Python script).
- Since a CPU can only execute one instruction at a time per core, the OS must share the CPU among all running processes.
- The OS's scheduler uses algorithms (e.g., Round-Robin, Priority Scheduling) to give each process a small slice of CPU time (measured in milliseconds). It switches between processes so rapidly that it creates the illusion of simultaneous execution (multitasking).
- Context Switching: When the OS switches from Process A to Process B, it saves the state (registers, program counter) of Process A to memory and restores the saved state of Process B. This overhead is a necessary cost of multitasking.
6.5.2 Memory Management (Virtual Memory)
- Physical vs. Virtual Addresses: The OS maps the physical RAM addresses to virtual addresses for each application. Programmers write code using virtual addresses (0x00 to 0xFFFFFFFF), and the OS translates these to physical addresses via the Memory Management Unit (MMU) in the CPU.
- Paging: Physical RAM is divided into fixed-size blocks called frames. Virtual memory is divided into pages.
- Virtual Memory (Swap File): When physical RAM runs out, the OS moves some pages that haven't been accessed recently to a special file on the hard drive (called the pagefile in Windows or swap in Linux). This makes the system slower (because HDD/SSD is slower than RAM) but allows the system to run programs larger than the actual physical RAM.
6.5.3 File System Management
- File Systems: The OS provides a structured way to store and retrieve data on persistent storage. It organizes data into files and directories/folders.
- Common File Systems: NTFS (Windows), ext4 (Linux), APFS (macOS), FAT32 (older/removable drives).
- Access Control: The OS manages permissions (read, write, execute) for files, ensuring that users cannot read each other's private documents without authorization.
6.5.4 I/O Device Management (Drivers)
- The OS handles the complexity of communicating with thousands of different devices.
- It uses device drivers as loadable modules. The OS provides a standard interface (e.g., a
write() function), and the driver implements that interface for the specific hardware.
6.5.5 Protection (User Mode vs. Kernel Mode)
- Kernel Mode (Supervisor Mode): The "privileged" state where the OS kernel runs. In this mode, the CPU can execute any instruction and access any memory address (including hardware registers). Only the OS runs here.
- User Mode (Restricted Mode): Where applications run. If an application tries to execute a privileged instruction (like trying to write directly to the hard drive's controller), the CPU generates a trap (exception), and the OS takes over, potentially terminating the offending application.
- System Calls: The only way for a user-mode application to request a privileged operation (e.g., opening a file) is to make a system call. The OS checks the permissions, performs the operation, and returns the result.
6.6 The Scale of Computer Systems: Same Organization, Different Sizes
The fundamental principles (CPU, memory, storage, OS) apply across the entire spectrum of computing devices, but their implementation varies drastically based on scale and purpose.
| Device Type |
Key Characteristics |
Typical OS |
Scale & Purpose |
| Embedded Systems / IoT (Smartwatches, thermostats) |
Ultra-low power, small RAM/ROM (KB to MB), real-time constraints, often single-purpose. |
FreeRTOS, Zephyr, micro-Linux, or custom bare-metal firmware. |
Typically battery-powered, dedicated function (heart-rate monitor, temperature sensor). Often not general-purpose. |
| Mobile Devices (Smartphones, Tablets) |
Power-efficient ARM CPUs, integrated SoCs, moderate RAM (4-16GB), touch UI. |
Android (Linux kernel), iOS (Darwin/Unix kernel). |
Highly portable, long battery life, always-connected, rich app ecosystem. |
| Desktop/Laptop Computers |
High-performance x86/ARM CPUs, large RAM (16-128GB), powerful GPUs, extensive storage. |
Windows, macOS, Linux (Ubuntu, Fedora). |
General-purpose, high interactivity, rich multimedia, gaming, software development. |
| Workstations / Servers |
Multi-socket CPUs, ECC RAM (Error-Correcting Code) for reliability, large storage arrays (RAID), high network I/O. |
Windows Server, Red Hat Enterprise Linux, Ubuntu Server. |
Designed for 24/7 uptime, data processing, virtualization, running websites. |
| Mainframes |
Massive I/O throughput, high reliability, extreme security. Often use custom high-end processors. |
z/OS (IBM), Linux on Z. |
Banking transactions (ATMs), airline reservations, government records. Optimized for transaction volume, not raw speed. |
| Supercomputers |
Thousands (even millions) of CPU cores and GPUs connected by ultra-fast interconnects (e.g., InfiniBand). |
Linux (RHEL, SUSE) with specialized resource managers (SLURM, PBS). |
Weather forecasting, molecular modeling, nuclear simulations, AI training at scale. They use massive parallelism to solve the "hard" (NP-Complete) or extremely large problems we discussed in Tutorial 4. |
Key Insight: Despite the massive difference in scale, a smartphone, a desktop, a mainframe, and a supercomputer all share the same core structure: CPU (processing), Memory (temporary storage), Storage (permanent), OS (resource manager), and I/O.
6.7 Summary Table: Hardware, Software, and their Interaction
| Aspect |
Component |
Role in the System |
| Hardware |
CPU |
Executes instructions; the engine. |
|
RAM |
Holds active processes and data; the workspace. |
|
Storage (HDD/SSD) |
Holds persistent files and OS; the library. |
|
I/O Devices |
Interacts with user/external environment. |
|
Buses & Chipset |
Communication highways; connectivity. |
| Software |
Firmware (BIOS/UEFI) |
Bootstraps the system; initializes hardware. |
|
Kernel (OS core) |
Manages CPU, memory, files; enforces security. |
|
Device Drivers |
Translates OS commands into hardware-specific signals. |
|
System Utilities |
Maintains and optimizes the system. |
|
Applications |
User-facing programs (browsers, editors, games). |
| Interaction |
System Calls |
The interface between applications and the OS kernel. |
|
Interrupts |
Hardware signals that request CPU attention. |
6.8 Quizzes
Quiz 1: Hardware, Software, and the OS
1. Which of the following is considered system software?
- (A) Microsoft Word
- (B) Google Chrome
- (C) Linux Kernel
- (D) Call of Duty
Answer
(C) Linux Kernel
2. What is the primary role of a device driver?
- (A) To render 3D graphics for games
- (B) To act as a translator between the OS and specific hardware devices
- (C) To manage the file system on a hard drive
- (D) To compile Python code into machine code
Answer
(B) To act as a translator between the OS and specific hardware devices
3. In the interaction between hardware and software, what is an Interrupt?
- (A) A signal from the OS to the user to stop typing
- (B) A signal from hardware to the CPU to get immediate attention
- (C) A software bug that causes a crash
- (D) A file saved by the user
Answer
(B) A signal from hardware to the CPU to get immediate attention
Quiz 2: OS Resource Management
4. The OS's process scheduler is responsible for:
- (A) Allocating memory to applications
- (B) Deciding which process gets CPU time and for how long
- (C) Reading and writing files to the hard drive
- (D) Displaying graphics on the monitor
Answer
(B) Deciding which process gets CPU time and for how long
5. Virtual Memory allows a computer to:
- (A) Run programs that are larger than the physical RAM
- (B) Connect to virtual reality headsets
- (C) Boot up faster
- (D) Encrypt all files on the hard drive
Answer
(A) Run programs that are larger than the physical RAM
6. What is a "Context Switch" in the context of the OS?
- (A) Changing the computer's wallpaper
- (B) Saving the state of one process and loading the state of another to share the CPU
- (C) Switching from Wi-Fi to Ethernet
- (D) Changing the keyboard layout
Answer
(B) Saving the state of one process and loading the state of another to share the CPU
7. Which component is responsible for translating virtual memory addresses to physical RAM addresses?
- (A) The Hard Drive
- (B) The GPU
- (C) The MMU (Memory Management Unit) inside the CPU
- (D) The BIOS/UEFI
Answer
(C) The MMU (Memory Management Unit) inside the CPU
Quiz 3: Modes of Operation
8. In which mode does the OS kernel run?
- (A) User Mode
- (B) Kernel Mode (Privileged Mode)
- (C) Safe Mode
- (D) Basic Mode
Answer
(B) Kernel Mode (Privileged Mode)
9. What happens if an application in User Mode tries to execute a privileged instruction?
- (A) The OS ignores the instruction
- (B) The CPU generates a trap, and the OS takes control
- (C) The application gains Kernel Mode privileges
- (D) The computer shuts down immediately
Answer
(B) The CPU generates a trap, and the OS takes control
10. A "System Call" is:
- (A) A phone call made via the computer
- (B) A request from a user-mode application to the OS for a privileged operation
- (C) A hardware error message
- (D) A type of computer virus
Answer
(B) A request from a user-mode application to the OS for a privileged operation
Quiz 4: Scale of Systems
11. Which type of computer is specifically optimized for extremely high transaction volumes (e.g., ATM banking)?
- (A) Smartphone
- (B) Mainframe
- (C) Supercomputer
- (D) Embedded System
Answer
(B) Mainframe
12. A supercomputer is characterized by:
- (A) Extremely high single-core clock speed
- (B) Massive parallel processing using thousands of cores
- (C) Long battery life
- (D) Reliance on vacuum tubes
Answer
(B) Massive parallel processing using thousands of cores
13. An embedded system (like a smartwatch) differs from a desktop PC primarily in its:
- (A) Cost
- (B) Color
- (C) Resource constraints (power, memory) and specific-purpose design
- (D) Use of binary numbers
Answer
(C) Resource constraints (power, memory) and specific-purpose design
6.9 Exercises
Exercise 1: Classification of Software
Instructions: Classify the following items into the correct category: Firmware, Operating System, System Utility, Device Driver, or Application Software.
| Item |
Category |
| 1. Windows 11 |
|
| 2. A printer driver for an HP LaserJet |
|
| 3. Microsoft Word |
|
| 4. The UEFI BIOS |
|
5. defrag.exe (Disk Defragmenter) |
|
| 6. Google Chrome |
|
| 7. The Linux Kernel (v6.x) |
|
| 8. NVIDIA GPU Driver |
|
Answers
1. Operating System
2. Device Driver
3. Application Software
4. Firmware
5. System Utility
6. Application Software
7. Operating System (Kernel)
8. Device Driver
Exercise 2: Tracing a File Opening Operation
Instructions: You are working in a Python script (main.py) and you execute file = open('data.txt', 'r'). Trace the chain of events from the moment you hit "Run" until the data bytes are physically retrieved from the SSD.
- Python Interpreter: Calls the
open() function.
- Standard Library: Translates the Python call to a __________ (e.g.,
open() or fopen() in C).
- OS System Call: The C library invokes a system call (e.g.,
sys_open).
- OS Kernel: The OS receives the system call. It is running in __________ Mode.
- Virtual File System (VFS): The OS checks if the file path is valid.
- File System Driver: The OS translates the file name into specific blocks on the storage media (using a file system like NTFS/ext4).
- Storage Device Driver: The OS sends a command to the specific __________ driver to fetch those blocks.
- Hardware Interrupt: The SSD controller fetches the data and sends an __________ signal to the CPU.
- OS Transfer: The OS copies the data from the kernel buffer to the user-space buffer (your Python variable).
- Return: The
open() function returns a file object to your Python script.
Task: Fill in the blanks (2, 4, 7, 8).
Answers
2. C library call (`fopen`)
4. Kernel (Privileged)
7. SSD (Storage Device)
8. Interrupt
Exercise 3: System Scale Scenarios
Instructions: For each scenario below, identify the most appropriate type of computer system (Smartphone, Desktop PC, Mainframe, Supercomputer, Embedded System) and explain why in one sentence.
-
Scenario A: A government agency needs to predict the path of a hurricane by running complex atmospheric physics simulations involving billions of data points.
-
Scenario B: A bank needs a system to process millions of credit card transactions per hour with absolutely zero downtime and high security.
-
Scenario C: A company designs a pacemaker that monitors heart rate and delivers a shock if an arrhythmia is detected. It must last 10 years on a single battery.
-
Scenario D: A college student needs a device to write essays, play video games, and browse the internet while sitting in a dorm room.
Answers
- **A:** Supercomputer. Requires massive parallel processing to calculate complex physical models.
- **B:** Mainframe. Optimized for massive transaction volume, reliability, and security.
- **C:** Embedded System. Must be low-power, reliable, and perform a dedicated single function.
- **D:** Desktop PC. Designed for general-purpose, high-performance interactive use.
Exercise 4: Drawing a System Map
Instructions: Draw a layered diagram showing:
- Bottom Layer: Hardware (CPU, RAM, Storage, I/O).
- Middle Layer: The Operating System Kernel + Drivers.
- Top Layer: Application Software.
On your diagram:
- Draw arrows showing a System Call going from the Application layer down to the Kernel.
- Draw arrows showing an Interrupt going from Hardware (e.g., Keyboard) up to the Kernel.
- Write a short caption explaining why applications must go through the OS to access hardware.
6.10 Homework Questions
Answer the following questions in complete sentences. Each response should be 3–5 sentences unless otherwise specified.
Short Answer Questions
1. Explain the difference between system software and application software. Give one example of each and explain why they are categorized differently.
Sample Answer
System software manages the hardware and provides a foundation for other programs; examples include the operating system (Linux) and device drivers. Application software is designed for end-users to perform specific tasks; examples include a web browser (Chrome) or a word processor (Word). System software runs with high privileges and requires deep hardware knowledge, while applications rely on the OS to handle hardware interactions.
2. Why must an application in User Mode make a system call to read a file from the disk? Why can't it access the disk controller directly?
Sample Answer
An application cannot access the disk controller directly because the CPU prevents user-mode code from executing privileged instructions for security and stability reasons. If applications could directly access hardware, a bug in one application could corrupt the entire file system or crash the computer. The system call ensures the OS can verify permissions, manage concurrency (if multiple apps access the disk), and maintain system integrity.
3. What is Virtual Memory, and how does it allow a computer to run programs that exceed the physical capacity of RAM?
Sample Answer
Virtual memory is a memory management technique that uses a portion of the hard drive (swap/page file) as an extension of physical RAM. The OS maps virtual addresses used by applications to physical addresses in RAM, and if RAM is full, it swaps out less-frequently used pages (pages) to the hard drive. This creates the illusion of having more RAM than physically exists, though performance degrades because hard drives/SSDs are significantly slower than RAM.
4. Briefly describe the concept of "Context Switching" as performed by the OS scheduler. Why is this necessary for modern computing?
Sample Answer
Context switching is the process of saving the current state (registers, program counter) of a running process and loading the saved state of another process to allow the CPU to share its processing time. This is necessary because we have more processes than CPU cores and want to give the illusion of multitasking. While context switching enables smooth multitasking, it involves overhead (time and resource cost) because the CPU must save and restore states.
5. Compare and contrast a Desktop PC and a Mainframe in terms of their primary design goals and typical usage.
Sample Answer
A Desktop PC is designed for general-purpose interactivity, high multimedia performance, and affordability for a single user, focusing on low latency for human input (gaming, browsing). A Mainframe is designed for massive transaction processing, high throughput, and near 100% reliability, handling thousands of simultaneous user requests (like banking ATMs) but often using slower, more error-correcting hardware to ensure data integrity.
Essay Questions
Answer the following questions in 300–500 words each.
6. Explain the concept of "User Mode" and "Kernel Mode" as a fundamental security feature of modern operating systems. Why is this separation of privilege crucial for system stability? Provide a concrete scenario where an application running in User Mode might try to compromise the system and explain how the OS prevents it.
Suggested outline:
- Introduction: Define both modes and the privilege level (instruction set access, memory access).
- Kernel Mode: Runs the OS core. Full hardware access. Runs at CPU Ring 0 (x86).
- User Mode: Runs applications. Restricted instruction set. Runs at Ring 3.
- The System Call interface as the only bridge.
- Scenario: Malware tries to overwrite the Master Boot Record (MBR) of the hard drive.
- Prevention: The malware calls
write() (system call). The OS checks permissions (is this user an admin?). The OS performs the write safely via the driver. If the software tries to bypass the system call and write to the I/O port directly, the CPU raises a general protection fault (trap), and the OS terminates the malicious process, preserving system stability.
- Conclusion: This separation is the foundation of the computer's trusted computing base.
7. Trace the complete journey of a simple Python program, print("Hello"), from the moment you execute it to the moment "Hello" appears on the monitor. Your answer must explicitly mention: Process, Scheduler, Virtual Memory, System Call, Device Driver, GPU, and User Mode/Kernel Mode.
Suggested outline:
- Execution starts: Python interpreter is loaded from storage into virtual memory (paging).
- Process Creation: The OS creates a process for the interpreter, allocates virtual memory.
- Running: The Scheduler gives CPU slices to the interpreter process.
- Parsing: Python sees
print() and prepares to call the OS.
- System Call: Python invokes
sys_write (system call).
- Transition: CPU switches from User Mode to Kernel Mode.
- Kernel Processing: The OS kernel checks the file descriptor (stdout). It copies the string "Hello" from user space to kernel space.
- Driver Dispatch: The OS calls the graphics/terminal driver. The driver formats the string for the specific terminal/GUI.
- GPU/Display: The driver instructs the GPU (via DMA) to render the pixels for "Hello" into the framebuffer.
- Context Switch: The scheduler may switch away from the Python process to allow other processes.
- Refresh: The monitor refreshes and displays the pixel buffer. The user sees "Hello."
Research Questions
These questions require additional research beyond the tutorial content.
8. Research the structure of the Linux kernel. What are the main differences between a Monolithic kernel (like Linux) and a Microkernel (like Minix or Mach)? How do these architectural choices affect system performance and driver development?
9. Research the concept of RAID (Redundant Array of Independent Disks). How does the operating system interact with a hardware RAID controller vs. software RAID? Why is RAID important for server and mainframe systems?
10. Research the architecture of a real-world supercomputer (e.g., Frontier at Oak Ridge National Laboratory or Fugaku in Japan). How does the operating system (typically Linux) manage millions of cores simultaneously? What specialized job schedulers (like SLURM) are used, and how do they differ from a standard desktop scheduler?
Previous | Tutorial index | Next