Operating system - System Services and Interfaces
Understand file system structures and operations, the basics of the OS networking stack, and the types of user interfaces with their input devices.
Summary
Read Summary
Flashcards
Save Flashcards
Quiz
Take Quiz
Quick Practice
What abstraction does a file system provide to applications?
1 of 12
Summary
Operating Systems: File Systems, Networking, and User Interfaces
Introduction
Modern operating systems serve as intermediaries between users and hardware. They organize data storage in human-readable ways, enable network communication, and provide interfaces through which users can interact with computers. This section covers three fundamental aspects of how operating systems present their capabilities to applications and users: how files are organized and accessed, how networks are supported, and what methods users have to interact with the system.
File System Organization
Understanding the File System Abstraction
The file system is one of the most important abstractions that an operating system provides. Without it, users would have to think about data in terms of raw disk blocks—numeric addresses with no meaningful organization. Instead, the file system presents an elegant abstraction: humans work with files (named collections of data) and directories (containers that list filenames and other directories), while the operating system handles the complex task of mapping these human-readable names to actual storage locations.
Think of a file system like a filing cabinet. Instead of remembering "the spreadsheet data is on disk blocks 1,523 through 1,891," you simply remember the file is named "budget.xlsx" and lives in your "Finance" folder.
Paths: Locating Files
Files are located using paths, which describe their position within the directory hierarchy:
Absolute paths start from the root directory (the topmost level) and list each subdirectory down to the file. For example, /Users/sarah/Documents/budget.xlsx begins at the root (/), descends through Users, then sarah, then Documents, and finally reaches the file budget.xlsx.
Relative paths describe a file's location relative to a current working directory. If you're currently in /Users/sarah/, you can refer to that same file simply as Documents/budget.xlsx. The operating system automatically resolves this relative path based on your current location.
Understanding the difference between absolute and relative paths is important: absolute paths work the same regardless of where you are in the file system, while relative paths are more convenient when you're already in a directory.
File Operations and System Calls
Applications never directly access storage hardware. Instead, they request the operating system to perform file operations on their behalf through system calls—special requests that transition from the application into the kernel (the core of the operating system).
The fundamental file operations are:
Create: Establish a new file with a given name
Delete: Remove a file from the file system
Open: Prepare a file for reading or writing (the OS locates the file and readies it for access)
Close: Finish with a file and release associated resources
Read: Retrieve data from a file
Write: Store data into a file
Link: Create an additional name that refers to the same file (allowing one file to be known by multiple names)
Most applications don't call these system calls directly. Instead, they use libraries that wrap these calls in more convenient functions. For example, a program might use a file library's open() function, which internally calls the operating system's file system code. This layering keeps applications simpler while ensuring that all file access goes through the operating system, which can enforce security and maintain consistency.
The diagram above shows how this layering works: applications sit at the top, libraries provide convenient wrappers, and system calls form the boundary between user applications and the kernel.
Caching and Prefetching: Optimizing Performance
Disk access is slow compared to CPU operations. To reduce this latency, operating systems employ two strategies:
Caching stores recently accessed data blocks in faster memory (RAM). When an application requests a file block that was recently read, the OS can return it from cache instead of accessing the disk. This is especially effective because applications often re-read the same data multiple times.
Prefetching anticipates what data an application will need next and loads it before the application explicitly requests it. For instance, if an application is reading a file sequentially, the OS might notice this pattern and automatically load the next several blocks into cache. When the application requests them, they're already available.
Both strategies exploit common access patterns: applications tend to re-access data they've recently used, and sequential file access is common. These optimizations can dramatically reduce perceived latency.
Reliability: Protecting Against Failures
File writing must be reliable. If a system crashes while writing to disk, the file could be left in an inconsistent state—perhaps halfway through an update. To prevent this:
Atomic operations ensure that file modifications complete as a single, indivisible action. Either the operation finishes completely or doesn't happen at all. The OS uses techniques like journaling (recording the intended changes before making them) or writing to temporary files (then renaming them only when complete) to achieve this.
Redundant storage provides recovery from hardware failures. Techniques include:
RAID (Redundant Array of Inexpensive Disks): Spreading data across multiple disks so that failure of one disk doesn't cause data loss
Checksums: Computing a numerical summary of data and storing it alongside the data; if either the data or checksum becomes corrupted, the mismatch is detected and the error can be recovered from backup
These mechanisms ensure that even if hardware fails, data remains consistent and recoverable.
Managing Free Space and Reducing Fragmentation
The operating system must track which storage blocks are available for new data. A free space map, often implemented as a bitmap, marks each block as either in-use or available. Bitmaps are efficient because they're compact: a single bit represents one block.
As files are created and deleted over time, free blocks become scattered throughout the disk. A file might be stored in non-contiguous blocks far apart from each other. This fragmentation makes file access slower because the disk head must seek between many locations.
To improve performance, operating systems may:
Cluster files from the same directory together, so related files are physically near each other
Periodically defragment, reorganizing files to make them more contiguous and moving related files closer together
The image above shows a modern file manager interface, where the system has organized files into a visual representation of the file system hierarchy.
Networking Support
The Network Stack
Modern operating systems include a network stack—built-in software that implements the TCP/IP suite (Transmission Control Protocol/Internet Protocol). This is what enables computers to communicate over networks.
The network stack handles the complexity of sending data across networks reliably. TCP ensures that data arrives in order and without errors, while IP handles routing data across the Internet. Applications don't need to understand these details; they simply request network communication through system calls, and the OS's network stack manages the complex protocol interactions.
<extrainfo>
The network stack is a substantial piece of OS functionality, but in an introductory operating systems course, you typically need to know that it exists and what it enables (network communication) rather than the implementation details of how it works.
</extrainfo>
User Interface
Command Line Interface (CLI)
A command line interface (CLI) requires users to type commands to interact with the computer. The user types a command, presses Enter, and the system executes it and displays results.
The image above shows a classic CLI: a text-based interface where users type directory listings and file commands.
CLIs are powerful and efficient for users who know the command syntax. Experienced users can accomplish complex tasks quickly through command sequences. However, CLIs have a steep learning curve—users must memorize commands and syntax.
Graphical User Interface (GUI)
A graphical user interface (GUI) presents a visual environment using WIMP (Windows, Icons, Menus, Pointers). Instead of typing commands, users click on visual elements.
The image above shows a modern graphical file manager, where folders and files appear as visual objects that users can interact with by clicking and dragging.
GUIs are more intuitive for new users—you can explore the interface visually without memorizing commands. The tradeoff is that some advanced tasks that are quick in a CLI may require multiple clicks in a GUI.
Most modern systems provide both: a GUI for everyday tasks and a CLI available for advanced users who need it.
Input Devices
Operating systems receive user input through several hardware devices:
Keyboard: Used for typing commands (CLI) or activating GUI elements
Mouse: Allows pointing and clicking on GUI elements; essential for traditional graphical interfaces
Trackpad: Built into laptops; functions like a mouse but uses finger gestures
Touchscreen: Allows direct manipulation by touching the screen; common on mobile devices and tablets
Specialized software drivers handle each input device, translating hardware signals into events that the operating system can understand and pass to applications. For instance, when you click a mouse button, the driver detects this hardware event and notifies the OS that a click occurred at a specific position.
The image above shows vintage computing hardware, illustrating how much input and interface technology has evolved over time.
Summary
File systems abstract storage into human-readable filenames and directories, managed through system calls. Operating systems optimize file access through caching and prefetching while ensuring reliability through atomic operations and redundancy. Networks are supported by a built-in TCP/IP stack. Users interact with systems through command-line interfaces (powerful but text-based) or graphical interfaces (intuitive but sometimes slower for advanced tasks), with input from keyboards, mice, and other devices. These components work together to create a complete computing environment that balances ease of use with power and reliability.
Flashcards
What abstraction does a file system provide to applications?
Human-readable filenames and directories
What is the definition of a file in a file system?
A named collection of data of arbitrary size
Where does an absolute file path begin?
At the root directory
How is a relative file path defined?
Relative to a current directory
Which entity performs all file operations on behalf of an application?
The operating system
What is the purpose of prefetching data in an operating system?
To provide data an application is likely to request next
Why do file writing protocols use atomic operations?
To avoid leaving storage in a partially written, inconsistent state after a crash
Which redundant storage structures allow for recovery from hardware failures?
Redundant array of inexpensive disks (RAID)
Multiple layers of checksums
What is the function of a free space map?
To track which storage blocks are available
How is a free space map often implemented?
As a bitmap
Which suite of protocols does a modern operating system's network stack implement?
Transmission Control Protocol/Internet Protocol (TCP/IP)
What visual environment does a graphical user interface (GUI) provide?
Windows, icons, menus, and pointers (WIMP)
Quiz
Operating system - System Services and Interfaces Quiz Question 1: What functionality does the modern operating system network stack implement?
- The TCP/IP suite for network communication (correct)
- A graphical interface for configuring networks
- Local file permission management
- Power management for peripheral devices
Operating system - System Services and Interfaces Quiz Question 2: Which description best characterizes a graphical user interface (GUI)?
- A visual environment with windows, icons, menus, and pointers (correct)
- A command line where users type commands line by line
- An interface that only displays plain text output
- A specialized interface used solely for server administration
Operating system - System Services and Interfaces Quiz Question 3: Which of the following operations is commonly provided by file system system calls?
- open (to create or access a file) (correct)
- fork (to create a new process)
- exec (to replace a process image)
- signal (to send a signal to a process)
Operating system - System Services and Interfaces Quiz Question 4: Which of the following is NOT a typical input device for a personal computer?
- Printer (correct)
- Keyboard
- Mouse
- Touchscreen
What functionality does the modern operating system network stack implement?
1 of 4
Key Concepts
File Management
File system
File caching
Defragmentation
User Interfaces
Command line interface (CLI)
Graphical user interface (GUI)
RAID (Redundant Array of Inexpensive Disks)
System Operations
System call
TCP/IP
Definitions
File system
An organized method for storing, naming, and retrieving files and directories on storage media.
System call
A programming interface through which an application requests services from the operating system kernel.
File caching
The practice of keeping recently accessed data blocks in fast memory to reduce read latency.
RAID (Redundant Array of Inexpensive Disks)
A storage technology that combines multiple physical disks for redundancy and/or performance.
Defragmentation
The process of reorganizing scattered file fragments on a disk to improve access speed and reduce fragmentation.
TCP/IP
The core suite of communication protocols (Transmission Control Protocol and Internet Protocol) that enable networked data exchange.
Command line interface (CLI)
A text‑based user interface where commands are entered line by line to control the computer.
Graphical user interface (GUI)
A visual interface that allows users to interact with the system via windows, icons, menus, and pointers.