Operating Systems Fundamentals
How an Operating System Connects Applications to Hardware
The layers of a computer system
A computer can be understood as a set of layers, with each layer built on the capabilities of the one beneath it.
At the physical foundation are transistors, commonly CMOS transistors in modern computers. Transistors can be arranged to form logic gates, such as AND, OR, and XOR gates. Other basic structures, including memory cells, flip-flops, and registers, are built from these electronic components. These structures are then organized into larger units such as memory, instruction-fetch circuits, and decoding units. Together, these units form the computer’s hardware: the physical components that can be purchased and assembled into a system.
Above the hardware are the programs that people use, called applications. A web browser, office program, or game is an application. Between applications and the physical hardware sits the operating system, or OS.
The OS provides a common layer through which applications can use the computer. It has two central responsibilities:
- Hardware abstraction: making hardware easier for applications to use.
- Resource management: sharing limited hardware resources among applications.
These responsibilities are closely connected. Abstraction hides hardware-specific complexity; resource management makes sure that the hardware is shared and used appropriately.
The operating system acts as an intermediary: applications request services, and the OS arranges for the hardware to provide them.
Think About It: Why might an application need an intermediary between itself and a physical device such as a monitor?
Hardware abstraction: making devices easier to use
Consider a simple C program intended to display the words “Hello World” on a monitor. The program might call printf with a pointer to the text. That looks like one simple action, but displaying the text requires many steps beneath the surface.
The characters are stored in main memory, also called RAM. To display them, the computer must read the characters from memory, process them, and provide the graphics hardware with the information needed to show them. That information may include where the text should appear on the screen, its color, and other display attributes. The graphics hardware then uses that information to produce the image on the monitor.
Without an operating system, each application would have to handle many of these details itself. It would need to know how text is represented in memory, how the relevant hardware works, and how to provide display instructions in the format required by a particular graphics card and monitor. A change in the processor, graphics hardware, or display could require changes to the program.
The OS hides much of this complexity. An application can request a service, such as displaying text, rather than directly controlling every hardware detail. A program’s request can pass through a system call, which is a way for an application to ask the operating system to perform a service. The OS then manages the steps needed to communicate with the hardware.
In this way, the operating system abstracts the hardware. An abstraction presents a simpler way to use something while concealing many of its underlying details. The application can work with a convenient service instead of needing to understand the hardware’s implementation.
Why abstraction matters
Abstraction provides several important benefits.
Simpler programming. Programmers can use operating-system services instead of writing hardware-specific instructions for common tasks. This reduces the amount of low-level detail that each application must handle.
Reusable functionality. Many applications can use the same operating-system services. For example, different programs can request that text be displayed, while the OS provides the shared mechanism for handling those requests. The functionality does not need to be independently recreated in every application.
Portability. A program that relies on operating-system services rather than directly controlling hardware is less tied to one particular machine. With suitable compilation and operating-system support, the same application may run on different kinds of computers, such as desktops, servers, laptops, or some embedded devices. The OS accounts for differences between the hardware and provides the appropriate underlying service.
Portability does not mean that a program will run on every device without any changes under all circumstances. It means that an application can be less dependent on particular hardware when it uses a common operating-system interface.
Think About It: If every application had to control a monitor directly, what kinds of changes might be needed when a computer’s display hardware changed?
Resource management: sharing limited hardware
A computer often runs several applications at nearly the same time. A browser might be open while another program is compiling code, a presentation is running, and a communication application is active. Yet the computer’s resources are limited. It may have only a small number of processors, a finite amount of RAM, and a limited number of storage and network devices.
The operating system manages these resources so that multiple applications can use the same computer. Its responsibilities can involve the CPU, main memory, network hardware, secondary storage such as a hard disk, and display devices. The OS must coordinate access because these resources cannot be used without limit.
Sharing the CPU
A CPU executes program instructions. If several applications need processor time, the OS must decide how their work is arranged.
One simple approach is to let one application run until it finishes, then start the next. In this arrangement, the first application may occupy the processor for a long time before another gets a turn. Although straightforward to implement, this can be inefficient when several applications need to make progress. The OS therefore plays a key role in scheduling applications on the processor. More efficient ways of sharing processor time are a central topic in operating-system design.
Sharing main memory
Applications also require main memory to run. Since RAM is limited, the OS must manage how it is shared among the applications that are active.
Memory management is not just a matter of dividing up space. The operating system also needs to keep applications isolated from one another. Each application should operate in a protected environment rather than being able to inspect or interfere with another application’s information.
Isolation and protection
Isolation matters for both reliability and security. Suppose one application is a browser being used for a banking transaction, while another is a malicious game. If the game could freely inspect the browser’s activity, it might obtain sensitive information such as passwords or credit-card details.
The OS is responsible for protecting applications from this kind of access. It manages the system so that one application cannot simply read or alter another application’s data. This protection is part of making shared use of a computer safe: applications can use the same underlying machine without automatically gaining access to one another.
Resource sharing and isolation must work together. The OS must allow multiple applications to use limited hardware while also preventing them from interfering with each other.
Think About It: Why is it not enough for an operating system merely to give every application access to the hardware it requests?
Operating systems designed for different needs
Operating systems share broad responsibilities, but they are not all designed for the same environments. Different kinds of computers have different constraints and priorities, so an OS is shaped by the applications and devices it is intended to support.
Embedded operating systems
An embedded operating system is designed for devices with limited resources, such as wireless sensor nodes used in the Internet of Things. These devices may have little memory and must use power carefully. An OS for this environment must manage resources and provide hardware services while helping keep overall power consumption low. Contiki is an example of an operating system designed for embedded settings.
Mobile operating systems
A mobile operating system is designed for devices such as smartphones. Like embedded systems, mobile devices need to conserve power so that their batteries last as long as possible. Mobile operating systems also need to support user interaction through devices such as touchscreens, displays, and keypads. Android, iOS, Ubuntu Touch, and Windows Touch are examples mentioned for this category.
Real-time operating systems
A real-time operating system, or RTOS, is used when the timing of an operation is essential. In machine-critical settings—such as rockets, automobiles, or nuclear plants—a delay in a critical operation could have catastrophic consequences.
An RTOS is designed so that critical operations are guaranteed to finish within specified time limits. The key requirement is not merely that an operation eventually completes, but that it completes on time. QNX, VxWorks, and RT Linux are examples of real-time operating systems.
Operating systems for secure environments
Some operating systems are designed for settings where security is especially important. Such systems may be used in environments such as web servers hosting banking software. SELinux and seL4 are examples associated with secure environments.
Server and desktop operating systems
Server and desktop operating systems support broader computing environments. Examples include Red Hat, Ubuntu, and Windows Server for servers, and macOS, Windows, and Ubuntu for desktops. Server and desktop systems can share many general features, while differing in how they manage applications and system demands.
The important point is that operating systems are adapted to their intended use. Power efficiency, user interaction, timing guarantees, security, and general-purpose application support can place different demands on the OS.
Think About It: Why would an operating system for a battery-powered sensor have different priorities from one used in a machine where precise timing is critical?
Learning operating-system principles through xv6
The operating system used for study in this material is xv6, a small system designed for teaching. It is documented and comparatively easy to understand, which makes its organization useful for learning.
xv6 is designed to resemble UNIX version 6. Studying it can therefore provide insight into how UNIX-like operating systems work, including systems such as Linux. Its value is not that every modern operating system is identical to xv6, but that a small, understandable system can make important operating-system ideas easier to examine.
Comprehensive review
A computer is built in layers, from transistors and logic gates to organized hardware, applications, and the operating system that connects applications to that hardware. The OS serves two essential purposes. First, it provides hardware abstraction, so applications can request services without managing every device-specific detail. This makes programming simpler, enables common functionality to be reused, and can make applications more portable across different hardware.
Second, the OS manages limited resources such as processor time, RAM, storage, and network devices. It coordinates access so that multiple applications can share the same computer. At the same time, it provides isolation, helping protect applications from one another. Different operating systems emphasize different needs, including low power use, user interaction, guaranteed timing, security, or general-purpose computing. Understanding these responsibilities in a small teaching system such as xv6 provides a foundation for understanding operating systems more broadly.

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