Lecture Recording Access
Operating System Structures: Comprehensive Study Notes
These notes cover the fundamental concepts of operating system structures, user interfaces, system calls, process management, and operating system design approaches. They are derived from a lecture on Chapter 2: System Structures.
User Interfaces and System Interaction
Graphical User Interface (GUI)
A GUI provides a visual way for users to interact with the operating system using a mouse, buttons, menus, and icons.
Advantages: Easy to learn and use; requires minimal memorization of commands.
Disadvantages: Consumes significant system resources (CPU, memory).
Common examples include Windows, macOS desktop environments, and modern mobile interfaces.
Command-Line Interface (CLI)
A CLI allows users to type text commands that the operating system interprets and executes.
Advantages: Very fast and efficient for experienced users; uses minimal system resources.
Disadvantages: Steep learning curve; commands vary between operating systems.
Example: On Windows, the
DIRcommand lists files in a directory. On Unix/Linux, the equivalent command isls.Shells are CLI programs. Unix/Linux offers multiple shells such as:
sh (Bourne shell)
bash (Bourne Again Shell)
Many others that can be customized.
Batch Interface
A batch system executes jobs without real-time user interaction.
Jobs are scheduled to run at a later time (e.g., overnight) to make efficient use of system resources.
Example: Banks process all supermarket transactions (e.g., Tesco, Asda) as overnight batch jobs when the computer system is less busy.
Command Line Interpreters
A CLI interpreter takes commands from the user.
Commands can be:
Built-in (e.g.,
DIRin MS-DOS/macOS) — part of the operating system itself.External programs — the user can run any executable program by typing its name (e.g.,
pythonlaunches the Python interpreter).
The interpreter loads the requested program into memory, runs it, and upon exit returns control back to itself.
Core Operating System Services
The operating system provides essential services that allow users and programs to work with hardware and software resources.
Program Execution
The OS loads a program into memory, runs it, and handles its termination (normal or error).
Users run programs via an interface (GUI, CLI, or batch).
Input/Output Operations
Programs need I/O (e.g., reading from keyboard, writing to display). The OS manages these operations so programs don't have to handle hardware details directly.
File System Management
The OS provides operations to create, open, read, write, delete, and organize files.
It abstracts the underlying storage media (hard disk, SSD, USB) so programs don't need to know the device specifics.
Communication
Inter-process communication (IPC) allows programs to exchange data (e.g., an embedded Excel sheet in OneNote).
Device-to-device communication — the OS handles data transfer between peripherals (USB to hard disk, network connections).
Error Detection
The OS catches errors like division by zero or accessing invalid memory addresses.
Severe errors (e.g., kernel panic, Blue Screen of Death) may cause the system to stop.
Resource Allocation
The OS decides how to distribute resources among multiple running programs:
CPU time — scheduling which process runs when.
Memory — allocating and deallocating space.
Storage — managing quotas (e.g., student account storage limits).
This is part of accounting — tracking usage for chargeback or policy enforcement.
Protection and Security
Protection ensures that one user or process cannot interfere with another's resources (files, memory).
Security involves authentication (login/password) and access control (read/write/execute permissions).
Example: Lecture files on OneDrive are shared only with authorized students; the OS enforces access rights.
System Calls and Application Programming Interface (API)
Definition
A system call is the programmatic way a user program requests a service from the operating system's kernel.
The collection of system calls forms the Application Programming Interface (API) .
System calls are low-level; they handle tasks like:
File operations (open, read, write, close)
Process control (create, terminate, wait)
Device management (request, release)
Information maintenance (get time, file attributes)
Communications (send/receive messages)
How System Calls Work (Example: Copying a File)
The user program calls a system function (e.g.,
CopyFile).The OS takes the source filename and destination filename.
The OS copies all data from the source to the destination.
Behind the scenes, the OS uses internal routines to read from disk, write to disk, handle errors, etc.
System Call Example in C (Reading a File)
ssize_t read(int fd, void *buf, size_t count);fd: file descriptor (an integer handle for the file).buf: buffer (memory area) where data is placed.count: maximum number of bytes to read.Programmers often read in chunks (e.g., 1 KB at a time) to handle large files.
Parameter Passing
System calls pass parameters such as:
Device (e.g.,
C:drive, network path)Mode (text, binary, executable)
File associations — the OS may automatically choose a program based on file extension (e.g.,
.txt→ Notepad,.mp4→ Films & TV).
Types of System Calls by Category
Process control:
CreateProcess(Windows),fork(Unix)File management:
ReadFile(Windows),read(Unix)Device management: request/release device, attach/detach
Information maintenance:
GetSystemTime,SetFileAttributesCommunications: create/close network connection, send/receive messages
Key takeaway: System calls are the interface between user programs and the OS kernel. They enforce the separation between user space and kernel space.
Operating System Structures
Simple Structure — MS-DOS
MS-DOS (Microsoft Disk Operating System) is a single-tasking, single-user OS.
It loads the kernel and then a command interpreter into memory.
Only one program can run at a time. When a program runs, it takes over memory; when it exits, control returns to the command interpreter.
No hardware protection — application programs can access hardware directly, causing instability.
Memory layout (simplified):
High Memory
[ User Program (e.g., Python) ]
[ Command Interpreter (COMMAND.COM) ]
[ Kernel (MSDOS.SYS, IO.SYS) ]
Low Memory (0)Layered Approach — Unix/Linux
The kernel is the core, most protected part. It provides essential services.
Programs communicate with the kernel via system calls; they never access hardware directly.
Hardware is isolated from user programs — a barrier exists between them.
Conceptual layering (example):
User Interface (CLI/GUI)
↓
File System
↓
I/O System
↓
Memory Management
↓
HardwareEach layer communicates with its neighbors; data flows outward and back.
This provides security and modularity.
Microkernel Architecture
Microkernel strives to keep the kernel as small as possible — only core functions (CPU scheduling, memory management, IPC) remain inside.
Other services (file systems, device drivers, networking) run in user space as separate processes.
Advantages:
Easier to extend and add new services.
Better security (less code runs in privileged mode).
Easier to port to different hardware.
Disadvantages:
Performance overhead due to inter-process communication (IPC) between user-space services.
May be slower than monolithic kernels.
Example: macOS 10 uses a microkernel (XNU) in its design.
Modular Kernel (Loadable Modules)
A modular kernel allows loading additional functionality into the kernel at runtime without recompiling.
Modules can be added for device drivers, file systems, or new system calls.
Advantages: Flexibility — an OS can be lean (only needed modules loaded) or extended easily.
Example: Linux supports loadable kernel modules (LKM).
Hybrid Kernel
A hybrid kernel combines aspects of monolithic and microkernel designs — it runs some services in kernel space for performance, but also supports modules for flexibility.
Examples: Windows, macOS.
Windows Kernel Structure
Large core kernel (tightly integrated) but with loadable parts (drivers, subsystems).
Balances performance and extensibility.
macOS Kernel Structure
Based on XNU (X is Not Unix), which includes a Mach microkernel component and BSD kernel.
Mach handles IPC, memory management, scheduling.
BSD provides file system, networking, POSIX API.
Additional layers: QuickTime (video/audio), Java, Aqua (GUI).
This hybrid approach keeps core I/O in kernel for speed, while specific video/audio processing is modular.
Linux Kernel Structure
Monolithic in design (all core services in kernel) but supports loadable modules.
Linux is Unix-like — it shares many concepts (process management, file systems, permissions).
Used widely in servers, desktops, embedded systems, and Android.
Process Management
Processes vs. Programs
A process is a program in execution — an active entity with a memory space, registers, and state.
The OS manages multiple processes, even if the user appears to run only one program (e.g., Teams, PowerPoint, background services).
Single-tasking vs. Multitasking
Single-tasking: Only one process runs at a time (e.g., MS-DOS).
Multitasking: Multiple processes share CPU (time-slicing) to appear concurrent (e.g., Windows, Unix).
Process States
Common states: new, ready, running, waiting, terminated.
Process Control Block (PCB)
The OS stores information about each process in a PCB: PID, program counter, registers, memory limits, file descriptors, etc.
Context Switching
Switching CPU from one process to another requires saving the previous process's state and loading the new one — this takes overhead.
Memory Management
Single Memory Space (MS-DOS)
Only one program and the OS/command interpreter occupy memory.
No protection between programs.
Multitasking Memory Layout (Unix/Linux)
The kernel occupies low memory.
Many processes (programs) can be scattered throughout memory (using relocation/segmentation/paging).
The OS enforces boundaries to prevent processes from interfering.
Example memory map for a multitasking system:
High Memory
[ Process D ]
[ Process C ]
[ Process B ]
[ Command Interpreter ]
[ Kernel ]
Low Memory (0)Virtual Memory
Many modern OSes use virtual memory (paging) to allow processes to use more memory than physically available.
Device Management
Request and Release: The OS controls access to shared devices (e.g., printer, keyboard, display).
Only one process can use a device at a time; the OS queues requests.
Example: Printing from Word and Excel — the OS gives the printer to Word first, then releases it to Excel.
Device Drivers
Device drivers are software components that allow the OS to communicate with specific hardware.
Core drivers (keyboard, display) are often built-in.
Additional drivers (printer, scanner) can be loaded as modules.
File Attributes and Accounting
File Properties (e.g., Windows)
Name, type (extension), size, creation date/time
Permissions: read-only, hidden, system
Access rights: full control, modify, read & execute, write (for multiple users)
Accounting
The OS tracks resource usage (CPU time, memory, storage) to enforce quotas (e.g., university student storage limits) or to charge departments.
Operating System Examples and Comparisons
MS-DOS (Simple Structure)
Single-task, single-user.
No hardware protection.
Very limited.
Windows (Hybrid Kernel)
Multitasking, multiuser (with user profiles).
Graphical UI, CLI (Command Prompt / PowerShell).
Large kernel with modular extensions.
System call API: Win32 API.
Unix/Linux (Monolithic + Modules)
Multitasking, multiuser.
Strong hardware protection via kernel.
Variety of shells (ksh, bash, zsh).
System call API: POSIX.
Example commands:
ls,pwd,ping,ps.
macOS (Hybrid Kernel)
Based on Unix (XNU).
Microkernel elements (Mach) + BSD.
Aqua GUI.
Supports loadable modules.
Android (Linux-based)
Modified Linux kernel with power management (critical for mobile devices).
Dalvik Virtual Machine (replaced by ART in later versions) runs Android apps.
Dalvik allows Java programs to run on a virtual machine, making apps compatible across Android versions.
The kernel provides services like process, memory, device management.
Application framework exposes APIs for phone, web, buttons, etc.
Booting the Operating System
Steps in the Boot Process
Power-on self-test (POST): Hardware checks (screen, keyboard, memory).
Boot loader locates the OS on disk (e.g., MBR or UEFI).
Kernel is loaded into memory.
Control is transferred to the OS kernel.
The OS initializes core subsystems, loads necessary device drivers, and starts user-space services.
Dual Boot / Boot Selection
Some setups allow choosing between OSes at startup (e.g., Windows vs. Linux).
Summary of Operating System Design Trade-offs
Structure | Advantages | Disadvantages |
|---|---|---|
Monolithic (simple) | Fast (direct communication) | Large kernel, less secure, hard to extend |
Layered | Modular, easier to design | More overhead (layers communicate) |
Microkernel | Small security-critical base, extensible | IPC overhead can slow performance |
Modular (loadable modules) | Flexible, efficient (only needed parts loaded) | Complexity of managing modules |
Hybrid | Balance of performance and flexibility | Complex design |
Key concept: No single structure is perfect — choice depends on the system's purpose (e.g., embedded car OS vs. general-purpose desktop).
Final Note
Operating systems manage a vast range of tasks: running programs, handling I/O, controlling devices, enforcing security, allocating resources, and communicating between processes. Understanding the underlying structures (monolithic, microkernel, hybrid) helps in appreciating why different OSes behave differently and how they can be optimized for specific workloads.

Ask anything
We've read this whole study set, so questions about it get the best answers.