Computer Fundamentals and Introduction to Programming · Lecture Notes

Chapter 2.1: Software and Operating Systems

Hardware is useful only when a program tells it what to do. The most important of these programs is the operating system, which starts running when the computer is switched on and manages every resource until it is shut down. These notes first explain what software is, how it is classified, and how it talks to the hardware layer by layer. They then turn to the tasks of the operating system, the boot process, and the kernel. Process, memory, device, and file management are covered with step-by-step worked examples. Every intermediate step is shown for round-robin scheduling, virtual address translation, page replacement, and file reads. The last sections compare user interfaces, privilege management, types of operating systems, software licenses, updates, and virtualization.

Learning outcomes

Types of software
Distinguish system software, application software, programming tools, and firmware by their examples; explain the layers between software and hardware.
Operating system
Explain the role of the operating system between the user, applications, and hardware; describe the boot process, the kernel, and a system call step by step.
Resource management
Interpret process states and scheduling, memory allocation and protection, virtual memory, device drivers, and the file system; compute Gantt charts, address translations, and page replacement.
Choosing a system
Compare personal, mobile, server, embedded, and real-time operating systems against requirements; evaluate licensing, update, and virtualization options.

2.1.1Software

Hardware does nothing by itself; the processor, memory, and disk need instructions that tell them, step by step, what to do. All of these instructions together are called software.

2.1.1.1What is software?

In everyday speech, “software” usually brings to mind just a program. A software product, however, contains more than a program. A game ships with picture, sound, and map files alongside its code. An accounting program reads tax rates from a table file. Both have installation instructions and a user manual. If any of these parts is missing, the software either does not run or cannot be used correctly.

Definition 2.1.1

Software is the whole of the programs that define what a computer does, the data those programs use, and the related documentation. Hardware is the physical, tangible parts of the computer: the processor, memory, disk, keyboard, and screen.

The division of labor between hardware and software is clear. Hardware carries out operations physically: the processor adds, memory stores, the screen displays. Software decides which operation is performed, when, and how. The same hardware becomes a word processor one day and a game machine the next, depending on the software loaded onto it. This flexibility is the basic property that distinguishes a computer from single-purpose machines.

The creation of a piece of software also follows a chain: user requirement → algorithm → program code → running software → result. The requirement “calculate the semester average” becomes the algorithm “take the grades, multiply by their weights, add them up”; the algorithm is written in a programming language and, once compiled and run, produces the average. A mistake in one link, for example a misunderstood requirement, is carried into all the following links.

2.1.1.2Quality attributes of software

When choosing between two programs that do the same job, the question “does it work?” is not enough. Two calculator apps may both give the right answer, yet one makes you wait ten seconds at every launch while the other moves the keys around in every release. In software engineering, how good a piece of software is gets judged by six basic attributes.

Table 2.1.1: Quality attributes of software, with examples from a banking app.
AttributeMeaningExample in a banking app
FunctionalityPerforming the expected tasks correctlyA transfer amount is deducted from the account in full
UsabilityEasy to learn and effective to useSending money takes three taps
PerformanceUsing time and resources efficientlyThe account statement opens in one second
ReliabilityBehaving predictably when something failsIf the connection drops, a transaction is never left half-done: it either completes or is cancelled
SecurityProtection against unauthorized access and modificationEven if someone else knows the password, they cannot sign in without the code sent to the phone
MaintainabilityFixes and improvements can be managedA new tax rule is added in a few days

Table 2.1.1 shows these attributes in a familiar app. The attributes sometimes conflict: an extra verification step added for security reduces usability. Good design strikes the right balance for the intended use; in aircraft control software reliability comes first, in a photo app usability does.

Common mistake

Treating reliability and security as the same thing. Reliability means the software behaves consistently in the face of faults: data is not corrupted when the power goes out. Security means protection against someone with malicious intent: a person without authorization cannot reach the data. A very reliable program can be insecure, and the reverse is also possible.

2.1.1.3Layers between software and hardware

When a user presses the “Print” button in a word processor, they do not think about what voltage will drive the printer’s inkjet head. The word processor does not know it either. These details are hidden in lower layers. A computer system is organized as stacked layers, and each layer talks only to the one directly below it.

UserApplicationsOperating systemDriversHardwarerequestservice
Figure 2.1.1: Five layers from the user to the hardware. Requests travel from top to bottom; results, that is, the services offered by the lower layer, travel from bottom to top.

Figure 2.1.1 shows the five layers. At the top is the user, who interacts only with applications. Applications ask the operating system for their work. The operating system passes these requests to the drivers. Drivers in turn produce the commands specific to each piece of hardware. At the bottom sits the hardware, which does the work physically.

Definition 2.1.2

Abstraction means a layer hides the details beneath it and offers the layer above a simpler, common service. The upper layer knows how to use the service; it does not have to know how the service is carried out.

The biggest gain from abstraction is portability. The word processor just says “print this page.” Whether the printer is inkjet or laser, the request is the same. The driver layer absorbs the difference: each printer manufacturer writes a driver for its own device. Thanks to drivers, the same application runs on thousands of different hardware combinations. A programmer writing an application does not need to know every printer model.

2.1.1.4Types of software

Software running on a computer falls into four main groups by task. The criterion is whom the software serves: the hardware and other programs, the user’s work, the software developer, or a single device itself?

Definition 2.1.3

System software manages the hardware and provides a runtime environment for other software. Application software performs a specific task for the user. Programming tools support writing, translating, testing, and debugging code. Firmware is software embedded in a device’s permanent memory that manages the device’s basic functions.

SoftwareSystem softwareoperating system, driverApplication softwarebrowser, word processorProgramming toolscompiler, IDEFirmwareUEFI, router firmware
Figure 2.1.2: Types of software and their examples: system software (operating system, driver), application software (browser, word processor), programming tools (compiler, IDE), and firmware (UEFI, router firmware).

Figure 2.1.2 gathers the four types and their examples in a tree. The best-known example of system software is the operating system; device drivers and utilities such as disk cleanup and backup also belong to this group. Application software serves the user’s actual goal: a browser opens web pages, a word processor writes reports.

Programming tools are used to build new software. A compiler translates the source code a person writes into machine code the processor can run. An integrated development environment (IDE) combines a code editor, a compiler, and a debugger in one window.

Firmware sits where hardware and software meet. The UEFI on a motherboard, a router’s menu, and the code that handles a washing machine’s program dial are all of this kind. Firmware is stored not on the disk but in the device’s own permanent memory (ROM or flash memory). It starts running when the device is switched on, without anything being loaded. Users mostly do not notice it; they hear of it only when the manufacturer releases an update.

Example 2.1.1

Which type does each of the following software on a computer belong to? A printer driver, a Java compiler, a spreadsheet program, the software inside a smartwatch, a disk defragmentation tool.

  1. Printer driver: manages hardware together with the operating system → system software.
  2. Java compiler: translates source code so that new software can be produced → programming tool.
  3. Spreadsheet program: does the user’s calculation work → application software.
  4. Smartwatch software: embedded in the device’s permanent memory and manages its basic functions → firmware.
  5. Disk defragmentation tool: deals not with a user’s document but with the layout of the disk → system software (utility).

2.1.1.5System and application software

Besides these four types, one more type comes up often: middleware. Middleware makes it easier for applications to communicate with the operating system and with each other. For example, a school’s grading system reaches the database that holds its records through a connection layer; the programmer does not have to write out the details of the network connection.

Table 2.1.2: Examples and main purposes of the software types.
TypeExamplesMain purpose
SystemOperating system, driver, utilityManaging the computer and its resources
ApplicationWord processor, browser, gameDoing the user’s task
MiddlewareDatabase connection layer, message queueMaking it easier for applications to communicate with the system and each other
Programming toolsCompiler, integrated development environment (IDE), debuggerProducing new software

Table 2.1.2 summarizes the distinction. The boundaries are not always sharp. A browser behaves partly like a platform because it provides a runtime environment for web applications. Even so, the basic question is useful: is the software doing the user’s work, or enabling other software to run? In the first case it is application software; in the second, system software.

2.1.2The operating system

Dozens of programs run on a computer at the same time, and all of them want to use the same processor, memory, and disk. The software that brings order to this crowd is the operating system.

2.1.2.1What is an operating system?

Definition 2.1.4

An operating system (OS) is the core system software that manages hardware resources and offers common services to applications. It is the first large piece of software loaded when the computer starts, and it keeps running until shutdown.

BrowserWord processorGameOperating systemprocess · memory · file · device · user managementCPURAMDiskNetwork cardapplicationshardware
Figure 2.1.3: The operating system sits between applications (browser, word processor, game) and hardware (CPU, RAM, disk, network card). Process, memory, file, device, and user management are the job of this layer.

Figure 2.1.3 shows where the operating system sits. The applications above cannot reach the hardware without the operating system. The hardware below cannot choose by itself which application to serve. Between these two worlds the operating system does three basic jobs.

  • It abstracts hardware details. An application says “open the file”; it does not need to know whether the file is on an SSD, a USB drive, or a server on the network.
  • It shares resources safely. Many programs use the same processor and memory. The operating system gives each a turn and a region, and stops one program from writing into another’s memory.
  • It offers the user an interface. A graphical interface with windows, or a command line driven by text commands, is the way the user talks to the computer.

2.1.2.2Tasks of the operating system

The work of the operating system divides into six main tasks. Each task manages one kind of resource.

OperatingsystemProcess managementGives running programsCPU time.Memory managementGives programs memoryand keeps them isolated.File managementOrganizes data in filesand folders.Device managementManages peripheralsthrough drivers.User managementAccounts, authentication,and permissions.Network servicesProvides the connection andcommunication infrastructure.
Figure 2.1.4: The six tasks of the operating system: process, memory, file, device, and user management, and network services.

Figure 2.1.4 shows these tasks together.

  • Process management: gives running programs processor time. It decides which program uses the processor, when, and for how long.
  • Memory management: gives programs memory and isolates them from one another. One program crashing does not corrupt another’s data.
  • File management: organizes data in files and folders, and keeps track of where files sit on the disk and who may read them.
  • Device management: manages peripherals such as the keyboard, printer, and graphics card through drivers.
  • User management: manages accounts, authentication, and permissions.
  • Network services: provides the infrastructure needed to establish connections and exchange data.

2.1.2.3Booting: how does a computer start?

The operating system sits on the disk, but who loads it from the disk into memory? When the computer is off, RAM is empty. The moment the power button is pressed, there is no program in memory to run. The process that solves this “chicken-and-egg” problem is called booting.

Definition 2.1.5

Booting is the start-up process that runs from the moment power is applied until the operating system is ready for use, with each stage loading the next. The small program that moves the operating system from disk into RAM is called the boot loader.

The solution is a small memory that keeps its contents even when the power is off. The permanent memory on the motherboard (ROM or flash memory) holds firmware written by the manufacturer. When the processor receives power, it always starts running from a fixed address in this memory. Start-up proceeds in six stages.

PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?ROM (motherboard)Control: firmware
PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?disk → RAMControl: OS kernel
Figure 2.1.5: Boot stages. (a) At the start, control is with the firmware and the running code is in the ROM on the motherboard. (b) The boot loader has loaded the kernel from disk into RAM and handed control to it; the running code is now the operating system kernel in RAM.
Table 2.1.3: Where the running code is and who has control at each boot stage.
StageWhat happens?Where is the running code?Who has control?
1. PowerWhen the voltages are stable, the power supply sends the motherboard a “power good” signal. RAM is empty.—User
2. FirmwareThe processor starts running the UEFI (formerly called the BIOS) on the motherboard.ROM (motherboard)Firmware
3. POSTPower-on self-test: basic hardware such as memory, keyboard, and disk is checked.ROM (motherboard)Firmware
4. Boot loaderThe boot loader is loaded into RAM from the first suitable device in the boot order.Disk → RAMBoot loader
5. KernelThe kernel is loaded into RAM; it starts the drivers, the first processes, and the system services.Disk → RAMOS kernel
6. Sign-inOnce identity is verified, the desktop and start-up applications open.RAMOperating system

Table 2.1.3 follows the six stages with two questions: where is the code running at that moment, and who has control? Figure 2.1.5 shows two intermediate moments of this journey.

Power and firmware. The power button sends a run signal to the power supply. When the supply’s voltages become stable, it sends a “power good” signal to the motherboard. On that signal the processor runs the firmware held in the permanent memory on the motherboard. In today’s computers this firmware is UEFI (Unified Extensible Firmware Interface). In older computers the same job was done by the BIOS (Basic Input/Output System).

POST. The firmware’s first job is the power-on self-test (POST). It checks that the memory modules are installed and working and that the keyboard and disks are connected. If something is wrong, the computer emits a series of beeps or prints a message on screen. If no RAM module is installed at all, start-up stops here, because every later stage requires loading something into RAM.

Boot loader. The firmware settings contain a boot order, for example “USB first, then SSD.” The firmware tries the devices in this order and skips any that are not attached. When it finds a suitable device, it looks at the small EFI system partition on the disk. The boot loader program sits in this partition, which is formatted with FAT32. On Windows the boot loader is called Windows Boot Manager (the file is bootmgfw.efi); on Linux the most common boot loader is GRUB. The boot loader is loaded into RAM and control passes to it.

Kernel. The boot loader finds the operating system kernel, loads it into RAM, and hands control to it. On Windows this takes two steps: the boot loader runs the program winload.efi, which in turn loads the kernel file ntoskrnl.exe. Once the kernel starts running, it loads the device drivers and starts the first processes and the system services that run in the background.

2.1.2.4Secure Boot, TPM, and disk partitioning

Every link in the boot chain trusts the next one. The firmware runs the boot loader it finds on the disk, and the boot loader runs the kernel. If a malicious program can put itself in place of the boot loader, it runs before the operating system. From that point even antivirus scanners cannot see it, because they are loaded after it. Modern computers use two tools against this danger.

Definition 2.1.6

Secure Boot means that UEFI runs only a boot loader and kernel that carry a trusted digital signature. TPM (Trusted Platform Module) is a security chip that stores encryption keys and boot measurements. A TPM can be a separate chip on the motherboard, a unit inside the processor, or a component within the firmware.

UEFI firmware✓Boot loader✓Kernel✓Operating systemTPM 2.0: a measurement of each stage is recorded · if the measurements are correct, the BitLocker key is released
Figure 2.1.6: The chain of trust. The UEFI firmware checks the boot loader’s digital signature, and the boot loader checks the kernel’s (✓). The TPM records a measurement of each stage; if the measurements are correct, the disk-encryption (BitLocker) key is released.

Figure 2.1.6 shows the chain of trust from left to right. The first link in the chain is the firmware, which the manufacturer writes at the factory together with trusted keys. Before running the next link, each link checks its signature. A digital signature is a mathematical stamp showing that a file was produced by a particular organization and has not been modified since. If even a single byte of the file changes, the signature no longer matches. Because the signature of a modified boot loader cannot be verified, UEFI does not run it and start-up halts.

At every stage the TPM computes and records a short fingerprint of the loaded code. The disk-encryption tool BitLocker keeps its decryption key in the TPM; the TPM releases the key only if the measurements match the expected values. If the disk is moved to another computer or the boot chain is altered, the data cannot be read.

Example 2.1.2

On a computer with Secure Boot enabled, malware changes a few bytes of the boot loader file on disk. What happens at the next start-up?

  1. UEFI runs and completes POST.
  2. UEFI finds the boot loader in the EFI system partition and checks its signature before running it.
  3. Because the file has changed, the computed value does not match the value in the signature. The signature cannot be verified.
  4. UEFI does not run the boot loader and shows a security violation message. The malicious code never gets a chance to run.

Installing Windows 11 requires UEFI with Secure Boot support and TPM 2.0.

A closely related topic is how the disk is divided. A disk can be split into partitions, each used like a separate drive. A table at the start of the disk records where the partitions are. The format of this table is called the partitioning scheme, and two schemes are common.

Table 2.1.4: Comparison of the MBR and GPT partitioning schemes.
AttributeMBRGPT
Firmware used with itBIOSUEFI
Largest diskUp to 2 TBFar above 2 TB
Number of partitionsAt most 4 primary partitionsMany partitions

MBR (Master Boot Record) is the older scheme. It stores locations on disk as 32-bit sector numbers. Since a sector is 512 bytes, the largest addressable space is calculated as follows:

232 × 512 bytes = 4,294,967,296 × 512 = 2,199,023,255,552 bytes ≈ 2.2 TB

This number equals 2 TiB, that is, 2 × 1,0244 bytes; this is where the “2 TB limit” comes from. GPT (GUID Partition Table) uses 64-bit numbers, so the limit effectively disappears. Table 2.1.4 compares the two schemes.

Example 2.1.3

Windows 11 will be installed on a 4 TB disk, and the disk will be split into five partitions for the system, programs, data, backup, and recovery. Which partitioning scheme should be chosen?

  1. Disk size: 4 TB exceeds the roughly 2.2 TB limit of MBR. With MBR, nearly half of the disk (about 1.8 TB) would be unusable.
  2. Number of partitions: five partitions exceed the MBR limit of four primary partitions.
  3. Operating system: Windows 11 requires UEFI, and the scheme used with UEFI is GPT.

All three criteria give the same answer: GPT + UEFI.

2.1.3The kernel

At the center of the operating system sits a small but critical part that has the authority to touch the hardware directly: the kernel.

2.1.3.1The kernel and privileged execution

Definition 2.1.7

The kernel is the privileged core of the operating system. The processor can run in two modes: in kernel mode it can execute every instruction and access the hardware directly; in user mode, instructions that touch the hardware are forbidden. Applications run in user mode and request services from the kernel with a system call.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmt.Memory mgmt.File systemDevice driversHardwareCPURAMDisk
Figure 2.1.7: Applications in user mode (text editor, browser) reach kernel mode through the system call interface. The kernel’s process, memory, file system, and device driver subsystems manage the hardware (CPU, RAM, disk).

Figure 2.1.7 draws the two modes as two floors. On the upper floor are the applications, with a boundary line beneath them. Applications can cross this line only through a single door, the system call interface. On the lower floor, the kernel’s four subsystems talk to the hardware.

The reason for this separation is security and stability. If every program could write to the disk directly, a faulty program could overwrite another program’s files and a malicious one could read other people’s passwords. When the processor meets an instruction in user mode that touches the hardware, it does not execute it and hands control to the kernel. The kernel usually terminates that program. This way an application’s bug affects only itself.

There is a cost too. A bug in the kernel can affect the whole system, because nothing above the kernel has the authority to stop it. The blue screen on Windows and the “kernel panic” message on Linux indicate an error that cannot be fixed at the kernel level. This is why every piece of code that enters the kernel, especially device drivers, is carefully tested and signed.

Common mistake

Thinking that “a program opened with an administrator account runs in kernel mode.” An administrator account increases the privileges inside the operating system: changing system files, installing programs. But a program opened as administrator also runs in the processor’s user mode and still reaches the hardware through system calls. Kernel mode is only for the code of the kernel and the drivers.

2.1.3.2A system call step by step

Following how a system call works in a concrete example lets us see all the subsystems of the kernel together. A text editor wants to read the file rapor.txt on disk.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmt.Memory mgmt.File systemDevice driversHardwareCPURAMDisk
User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmt.Memory mgmt.File systemDevice driversHardwareCPURAMDisk
Figure 2.1.8: Two moments of a file-read system call. (a) The processor has switched from user mode to kernel mode; only kernel code runs now. (b) The disk driver has issued a read command to the disk; when the disk finishes, it notifies the processor with an interrupt.
Example 2.1.4

The text editor reads the file rapor.txt. In which mode is the processor at each step, and which subsystem runs?

StepWhat happens?Processor modeRunning part
1The editor cannot reach the disk itself; it makes the read system call.UserEditor
2The processor switches to kernel mode; control is handed to the kernel.KernelSystem call interface
3The file’s location on disk is found; the user’s read permission is checked.KernelFile system
4A read command is issued to the disk; when the disk finishes, it notifies with an interrupt.KernelDevice driver
5The data that was read is copied into the editor’s own memory region in RAM.KernelMemory management
6The call returns; the processor switches to user mode. The editor shows the data on screen.UserEditor

The editor runs only in the first and sixth steps. All four steps in between are in kernel mode. The editor never sees the hardware directly.

Figure 2.1.8 shows two of these steps. The permission check in the third step shows the security value of the design: if the editor asks for a file it has no right to read, the call returns with an error code and the disk is never touched.

Two important concepts appear in the fourth step. The disk is very slow compared with the processor; an SSD read takes as long as tens of thousands of processor instructions. The processor does not sit idle during this time; it moves on to other work. When the disk finishes, it sends the processor a signal.

Definition 2.1.8

An interrupt is a signal by which a device or timer tells the processor about an event. When an interrupt arrives, the processor briefly drops what it is doing, runs the relevant code in the kernel, and then resumes where it left off.

Thanks to interrupts, the processor does not keep asking “is the disk done yet?” Pressing a key, a packet arriving from the network, and the timer’s “time slice expired” notice are all interrupts too.

2.1.3.3Kernel types

What to put inside the kernel is a design decision. Putting everything in the kernel is fast, because no mode switch is needed between subsystems. But the larger the kernel grows, the greater the chance of bugs inside it. Keeping the kernel small improves security, but frequent mode switches reduce speed. Between these two extremes, three designs are common.

Table 2.1.5: Kernel types.
TypeIdeaExample
Monolithic kernelProcess, memory, file system, and drivers in a single privileged kernel; fast but largeLinux (modules can be loaded)
MicrokernelOnly the essentials in the kernel; drivers and file system in user mode; strong isolationMINIX 3, QNX
Hybrid kernelTakes the microkernel design but keeps some services in the kernel for speedWindows NT kernel, macOS/iOS (XNU)

Table 2.1.5 compares the three designs. In a monolithic kernel all subsystems are one big program. Linux is built this way, but it allows drivers to be loaded as modules that can be added to and removed from the kernel when needed. In a microkernel the kernel does only the most basic work, such as interprocess communication, basic scheduling, and memory protection. Drivers and the file system run in user mode like ordinary programs. If a driver crashes, only that program is restarted; the system stays up. This is why QNX is common in cars and medical devices. A hybrid kernel sits between the two. Windows and Apple’s systems follow this path.

The difference between a kernel and an operating system is best shown by Linux and Android. Linux, strictly speaking, is only a kernel. The “Linux” installed on a computer is in fact a Linux distribution: a package in which command-line tools, a desktop environment, and applications are added on top of the Linux kernel. Ubuntu, Fedora, and Debian are such distributions. Android also uses the Linux kernel, but the layers above it are entirely Android’s own.

Table 2.1.6: The Android software stack (top to bottom).
LayerRole
ApplicationsPrograms the user runs: messaging, maps, games
Android framework and runtimeCommon services used by applications and the environment that runs application code
Linux kernelProcess, memory, driver, and power management
HardwareProcessor, touchscreen, camera, sensors

Table 2.1.6 lists the layers of Android. A Linux desktop program does not run on an Android phone, and an Android app does not open directly on Ubuntu. Although the two share the same kernel, their upper layers differ.

2.1.4Process management

A single-core processor executes the instruction of only one program at any given moment. Even so, it is possible to type while playing music on such a computer, because the operating system shares the processor among programs very quickly.

2.1.4.1Concepts of process management

Process management is built on six concepts. The first three describe the things being managed, the last three the means of managing them.

Definition 2.1.9

A program is the whole of the instructions and data stored on disk. A process is a running instance of a program. A thread is a single flow of execution within a process. Scheduling is deciding which process gets the processor and when; the part of the kernel that makes this decision is called the scheduler. A context switch is saving the processor’s state from one process and loading the state of another. Concurrency is the management of several tasks making progress in the same time interval.

Process P1OSProcess P2P1 runsP2 runsP1 resumestimecontext switchcontext switchsave P1load P2save P2load P1
Figure 2.1.9: A context switch on a single CPU. P1 runs; the operating system saves P1’s state and loads P2’s state; P2 runs; another switch lets P1 continue where it left off.

Figure 2.1.9 shows the context switch on a time axis. A process’s “context” is all the information the processor holds for that process: the values of the registers, the address of the next instruction, and the location of the process’s memory table. When switching from P1 to P2, the operating system writes P1’s context into a record in memory set aside for that process. It then loads P2’s previously saved context into the processor. P2 continues from the instruction where it stopped, as if it had never paused.

During a context switch the processor advances no user program; it only does bookkeeping. A single switch takes a few microseconds, but when it happens thousands of times a second the loss becomes noticeable.

Common mistake

Thinking of concurrency as “running at the same time.” On a single-core processor two processes never run at the same time; they run in turn, at very short intervals, and from the outside they appear to run simultaneously. Running truly at the same time is possible only with more than one core, and that is called parallelism.

2.1.4.2Program, process, and thread

The difference between a program and a process is like the difference between a recipe and the dish cooking in a pot. Two dishes can be cooked in two separate pots from the same recipe; each pot has its own ingredients and its own stage. A program is a passive file sitting on disk; a process is a running instance of it in memory.

Diskbrowser.exeprogram (passive)Memory (RAM)Process (PID 101)code + data + stackopen files, permissionsthread 1thread 2Process (PID 102)code + data + stackopen files, permissionsthread 1run twice→ 2 separate processes
Figure 2.1.10: When the program tarayici.exe on disk is run twice, two separate processes appear in memory (PID 101 and PID 102). Each process has its own code, data, stack, open files, and permissions. The first process has two threads, the second one.

Figure 2.1.10 shows this relationship. The operating system identifies each process by a process ID (PID). The PID is a number that does not change as long as the process lives. In Task Manager, or in the output of the ps command on Linux, each row is a process with its PID beside it.

Each process has a separate memory region. This region holds the program’s code, a data area where variables are kept, and a stack that tracks function calls. The process also carries a list of the files it has opened and its permissions. Two processes cannot see each other’s memory. When one browser window crashes, the other window usually keeps working; this is why modern browsers open each tab in a separate process.

Threads, by contrast, are flows of execution within the same process that run sharing that process’s memory. A word processor can handle letters coming from the keyboard in one thread while running a spell check in the background in another. Both see the same document, that is, the same memory region. Sharing makes communication easy but needs care: if two threads try to change the same data at the same time, the data can be corrupted.

2.1.4.3Process states

A process does not run all the time from the moment it is created until it ends. Sometimes it waits for its turn, sometimes for data to arrive from the disk. The operating system keeps the answer to “what state are you in right now?” for every process.

Definition 2.1.10

A process state is one of the following five. New: the process is being created. Ready: ready to run, waiting for its turn on the processor. Running: its instructions are executing on the processor right now. Waiting: waiting for an event, for example a disk read to finish or a key to be pressed. Terminated: it has finished its work. The list in which ready processes are lined up is called the ready queue.

admittedscheduler dispatchtime slice expired (interrupt)waits for I/O or eventwait is overexitNewReadyRunningTerminatedWaiting
Figure 2.1.11: The process state diagram. Arrows show the allowed transitions and the cause of each: admitted, scheduler dispatch, time slice expired (interrupt), waits for I/O or event, wait is over, exit.

Figure 2.1.11 shows the five states and the six transitions between them. The transitions that are missing from the diagram are just as instructive as those that are present.

  • New → Ready (admitted): the operating system allocates memory to the process and puts it in the ready queue.
  • Ready → Running (scheduler dispatch): the process gets the processor.
  • Running → Ready (time slice expired): the process’s share of the processor ends; a timer interrupt hands control to the kernel and the process returns to the end of the queue.
  • Running → Waiting (waits for I/O or event): the process asks for data from the disk, a key from the keyboard, or a packet from the network.
  • Waiting → Ready (wait is over): the awaited event occurs and the process joins the queue again.
  • Running → Terminated (exit): the process finishes its work.

Here I/O is the abbreviation for input/output operations. The diagram has no Waiting → Running arrow. A process whose wait is over does not get the processor directly; it first joins the ready queue and waits for its turn. There is no Ready → Waiting arrow either: a process can ask for something only while it is running, and therefore can move to waiting only while running.

On a single-core system, at most one process is in the Running state at any moment. The other ready processes wait in the queue. A process in the Waiting state is not even in the queue; the scheduler never picks it, because even if it got the processor there would be nothing it could do.

Common mistake

Confusing the Ready and Waiting states. Both mean “not running,” but for different reasons. A ready process could run at once if given the processor; the only thing it lacks is the processor. A process in the Waiting state cannot make progress even if given the processor, because it is waiting for an external event.

2.1.4.4State transitions step by step

Following the state diagram through the life of a single process makes concrete which events trigger the transitions.

Example 2.1.5

The user double-clicks a program and process P1 is created. P1 computes for a while, then reads data from disk, then computes again; meanwhile its time slice expires, and finally it finishes.

StepEventTransitionState of P1
1The user double-clicks the program—New
2The operating system admits the process and allocates memoryNew → ReadyReady
3The scheduler picks P1 and its context is loadedReady → RunningRunning
4P1 asks for data from the diskRunning → WaitingWaiting
5The disk finishes and an interrupt arrivesWaiting → ReadyReady
6Its turn comes and it is picked againReady → RunningRunning
7The time slice expires, timer interruptRunning → ReadyReady
8Picked againReady → RunningRunning
9It finishes and exits; its resources are reclaimedRunning → TerminatedTerminated

In nine steps P1 enters the Running state three times. Before every entry it always passes through the Ready state.

admittedscheduler dispatchtime slice expired (interrupt)waits for I/O or eventwait is overexitNewReadyRunningTerminatedWaitingP1
admittedscheduler dispatchtime slice expired (interrupt)waits for I/O or eventwait is overexitNewReadyRunningTerminatedWaitingP1
Figure 2.1.12: Two steps of Example 2.1.5. (a) Step 4: because P1 asks for data from the disk, it moves from Running to Waiting. (b) Step 5: when the disk finishes, P1 does not run at once; it first returns to the Ready state.

Figure 2.1.12 shows the two steps of the table that are most often confused. In the fourth step P1 gives up the processor of its own accord, because it has nothing to do until the data arrives. If it held the processor needlessly, other processes would be kept waiting too. In the fifth step the disk interrupt arrives, but at that moment another process may be running on the processor. P1 therefore returns to the queue. The transition in the seventh step does not happen at P1’s request: the timer interrupt takes the processor away from P1 by force. This distinction is the basis of systems that can take the processor from a process by force.

2.1.4.5Two processes, one CPU

When a process moves to the Waiting state, the processor becomes free. If the operating system fills that gap with another process, the total work finishes in less time. This idea is called multiprogramming. Its effect can be measured on a timeline.

Example 2.1.6

There are two processes on a single-core processor. P1 will first compute for 3 ms, then read from disk (the disk takes 3 ms), then compute for 2 ms more. P2 will compute for only 4 ms. Both are ready at t = 0; the scheduler picks P1 first. Each process gives up the processor only when it moves to waiting or when it finishes.

Time (ms)CPUDiskP1P2
0–3P1idleRunningReady
3P1 asks to read, context switchWaitingRunning
3–6P2P1’s dataWaitingRunning
6Disk finishes, interrupt arrivesReadyRunning
6–7P2idleReadyRunning
7P2 completes its 4 msRunningTerminated
7–9P1idleRunningTerminated
9P1 finishesTerminatedTerminated

Both processes finish in 9 ms in total. Between 0 and 9 ms the processor is never idle: 3 ms of P1, 4 ms of P2, and 2 ms of P1 again, and 3 + 4 + 2 = 9.

CPUDisk0123456789msP1P2P1 I/OP2P1
Figure 2.1.13: The timeline of Example 2.1.6. The top row shows the CPU, the bottom row the disk. Between 3 and 6 ms the CPU runs P2 while the disk reads P1’s data; the two work in parallel.

Figure 2.1.13 makes the key point of the example visible: between 3 and 6 ms two separate pieces of hardware work at the same time. While the CPU runs P2, the disk does the read for P1. What would happen if the operating system did not exploit this overlap? If the CPU sat idle while P1 waited for the disk, that is, if the processes ran one after the other, the total time would be:

3 (P1 compute) + 3 (disk wait) + 2 (P1 compute) + 4 (P2 compute) = 12 ms

Multiprogramming saves 3 ms, and the total time drops from 12 ms to 9 ms. In sequential execution the CPU is working for only 9 of the 12 ms, so it is busy 75% of the time; with overlap that ratio is 100%. In real systems I/O waits are much longer, so the gain is much larger too.

There is one more detail in the example. P1’s disk operation finishes at t = 6, but P1 runs only at t = 7. It spends the 1 ms in between in the ready queue, because P2 is on the processor and in this scheduling the running process is not taken off the processor by force.

2.1.4.6Time sharing and round-robin scheduling

In the previous example, processes gave up the processor only when they moved to waiting. A process that does no I/O and runs a long computation could hold the processor for minutes under this arrangement; meanwhile the screen would not respond even if the user moved the mouse. Interactive systems therefore hand out the processor to processes in short slices.

Definition 2.1.11

Time sharing is distributing the processor among processes in rotation at short intervals. Round-robin scheduling gives each process in the ready queue, in turn, at most one time slice (quantum) of processor time. If the process does not finish within the slice, it goes to the end of the queue and a context switch takes place. The time slice is usually written with the letter q.

The rule of round-robin scheduling is simple: take the process at the head of the queue, run it for at most q, and if it is not finished, put it at the end of the queue. To see the consequences of the rule, the calculation has to be done step by step. For such calculations a Gantt chart is used: horizontal bars on a time axis showing which process the processor is on during each interval.

Example 2.1.7

Three processes are in the ready queue at t = 0, in the order P1, P2, P3. Their processor times are P1 = 5 ms, P2 = 3 ms, P3 = 2 ms. The time slice is q = 2 ms. Let us find each process’s finish time.

Interval (ms)CPUWhat happens?Remaining (P1, P2, P3)Queue (after)
start—All three ready5, 3, 2P1, P2, P3
0–2P1Slice expires, P1 goes to the end3, 3, 2P2, P3, P1
2–4P2Slice expires, P2 goes to the end3, 1, 2P3, P1, P2
4–6P3P3 finishes (t = 6)3, 1, 0P1, P2
6–8P1Slice expires, P1 goes to the end1, 1, 0P2, P1
8–9P2P2 uses 1 ms, finishes (t = 9)1, 0, 0P1
9–10P1P1 uses 1 ms, finishes (t = 10)0, 0, 0idle

Finish times: P3 = 6 ms, P2 = 9 ms, P1 = 10 ms. Since the total work is 5 + 3 + 2 = 10 ms, the last process finishes at t = 10.

CPU timeline (Gantt)P1P2P3P1P2P1012345678910msReady queue:idleRemaining time:P1: 0 (done t=10)P2: 0 (done t=9)P3: 0 (done t=6)
Figure 2.1.14: The completed Gantt chart of Example 2.1.7: P1, P2, P3, P1, P2, P1. The ready queue is empty; P3 finished at t = 6, P2 at t = 9, and P1 at t = 10.

Two details of the table need attention. First, the intervals 8–9 and 9–10 are one millisecond each. A process that finishes before its slice ends does not wait out the rest of the slice; the processor moves to the next one at once. Second, the queue column shows who goes to the end at each step, and this column determines the correctness of the calculation. If the queue order is skipped, all the following rows come out wrong.

Figure 2.1.14 gives the result as a chart. The chart has six bars, so the processor was given to a process six times. When two consecutive bars belong to different processes, a context switch falls between them; in this example there are 5 context switches. Thanks to the fast switches, all three processes seem to progress “at the same time.” In real systems the time slice is between a few milliseconds and a few tens of milliseconds; a person does not notice switches that short.

Choosing the time slice is a balance. As the slice shrinks, processes get turns more often, but the number of context switches grows. If the slice is chosen too large (q = 5), every process finishes on its first turn and short jobs wait behind the long one.

Table 2.1.7: Scheduling the same three processes (P1 = 5, P2 = 3, P3 = 2 ms) with different time slices.
Time sliceFinish times (P1, P2, P3)Context switches
q = 110, 8, 68
q = 210, 9, 65
q = 55, 8, 102

Table 2.1.7 shows the effect with numbers; the duration of a context switch is taken as zero in these calculations.

Common mistake

Assuming that a process whose slice expires returns to the head of the queue. The process always goes to the end of the queue; otherwise the same process would never have given up the processor. The second common mistake is to give a full slice again to a process whose remaining time is shorter than the slice: in the interval 8–9 P2 has 1 ms left, and the processor moves to P1 at t = 9.

2.1.4.7Comparing scheduling algorithms

Round-robin scheduling is not the only option. In the process scheduling simulator, four algorithms can be compared. This section calculates three of them on the same example. Two measures are used for the comparison.

Definition 2.1.12

A process’s turnaround time is the time from when it arrives in the ready queue to when it finishes: turnaround time = finish − arrival. Waiting time is the part of that time spent in the ready queue rather than running on the processor: waiting time = turnaround time − processor time.

The three algorithms work as follows. FCFS (first come, first served) runs processes in order of arrival, each to completion. SJF (shortest job first) picks, when the processor becomes free, the ready process with the shortest time and runs it to completion. Round-robin scheduling distributes the processor in slices, as in Example 2.1.7.

Example 2.1.8

Again P1 = 5, P2 = 3, P3 = 2 ms; all three arrived at t = 0, queue order P1, P2, P3. Let us find the average waiting time for each algorithm. Since arrival is 0, turnaround time equals the finish time.

  1. FCFS. Schedule: P1 0–5, P2 5–8, P3 8–10. Finish times 5, 8, 10. Waiting: P1 = 5 − 5 = 0, P2 = 8 − 3 = 5, P3 = 10 − 2 = 8. Average (0 + 5 + 8) / 3 = 13 / 3 ≈ 4.33 ms.
  2. SJF. The shortest job is P3, then P2, then P1. Schedule: P3 0–2, P2 2–5, P1 5–10. Waiting: P3 = 0, P2 = 5 − 3 = 2, P1 = 10 − 5 = 5. Average (0 + 2 + 5) / 3 = 7 / 3 ≈ 2.33 ms.
  3. Round-robin (q = 2). Finish times P1 = 10, P2 = 9, P3 = 6. Waiting: P1 = 10 − 5 = 5, P2 = 9 − 3 = 6, P3 = 6 − 2 = 4. Average (5 + 6 + 4) / 3 = 15 / 3 = 5 ms.

Average waiting is lowest with SJF (≈ 2.33 ms) and highest with round-robin scheduling (5 ms).

Table 2.1.8: Results of the three algorithms on the same example (P1 = 5, P2 = 3, P3 = 2 ms; all at t = 0).
AlgorithmFinish times (P1, P2, P3)Average turnaroundAverage waiting
FCFS5, 8, 1023 / 3 ≈ 7.67 ms13 / 3 ≈ 4.33 ms
SJF10, 5, 217 / 3 ≈ 5.67 ms7 / 3 ≈ 2.33 ms
Round-robin (q = 2)10, 9, 625 / 3 ≈ 8.33 ms15 / 3 = 5 ms

Table 2.1.8 puts the results side by side. The purpose of round-robin scheduling is not to minimize the average time but to leave no process without the processor for long. Under FCFS, P3 runs for the first time at t = 8; under round-robin it starts running at t = 4. In an interactive system, responding quickly to the user’s click matters more than a slightly longer average time.

SJF minimizes the average waiting time, but it has two problems. First, how long a job will take is often not known in advance; the operating system can only estimate it from past behavior. Second, if short jobs keep arriving, a long job may never get its turn. A process that can wait forever for its turn is said to suffer starvation.

Common mistake

Thinking of waiting time as “the moment the process first starts running.” Waiting time is the sum of all the intervals the process spends in the ready queue. In the round-robin example P1 runs during 0–2, then waits 4 ms during 2–6 and 1 ms during 8–9; the total waiting is 5 ms, which agrees with the formula 10 − 5.

2.1.4.8Deadlock

Processes share not only the processor but also resources such as printers, files, or database records. Most of these resources can be used by only one process at a time. If two processes wrote to a printer at the same time, the pages would come out with the lines of two documents mixed together. For this reason a process “holds” a resource before using it and releases it when done. Under certain conditions, this arrangement can lead to processes waiting for one another forever.

Definition 2.1.13

A deadlock is a situation in which each process in a group is waiting for a resource held by another process in the group, and none of them can make progress.

Process AProcess BPrinterFileholdsholdsrequestsrequestscycle = deadlocksolid arrow: process holds the resource · dashed arrow: process is waiting for the resource
Figure 2.1.15: A resource allocation graph. A solid arrow shows that a resource is held by a process, a dashed arrow that the process is waiting for that resource. A holds the printer and waits for the file, B holds the file and waits for the printer; the arrows form a cycle.
Example 2.1.9

Process A will print a report and, while printing, write an entry to a file. Process B will update the file and then get a summary from the printer. The events occur in this order:

  1. A takes the printer and uses it.
  2. B locks the file and uses it.
  3. A requests the file without releasing the printer. The file is held by B, so A waits.
  4. B requests the printer without releasing the file. The printer is held by A, so B waits.

The waiting chain closes as A → File → B → Printer → A. Since neither releases what it holds, both wait forever.

Figure 2.1.15 shows the situation after the fourth step. The visible sign of a deadlock in a graph is a cycle in the arrows. Every process in the cycle holds one resource and waits for the next resource in the cycle.

A deadlock arises only if four conditions hold at the same time. These conditions were defined in 1971 by Coffman and colleagues; deadlock is still explained by these four conditions today.

Theorem 2.1.1 (The four conditions of deadlock)

For a deadlock, all of the following four conditions are necessary:

  1. Mutual exclusion: a resource can have only one owner at a time.
  2. Hold and wait: a process waits for another resource without releasing the one it holds.
  3. No preemption: a resource cannot be taken from its owner by force; it becomes free only when the owner releases it.
  4. Circular wait: the waiting processes are linked to one another in a ring.

If even one of the conditions is broken, a deadlock cannot occur.

Theorem 2.1.1 also points to the solution: breaking any one of the four conditions is enough. In practice the easiest condition to break is circular wait. It is made a rule that all processes request resources in the same order, for example the printer first, then the file. If B in Example 2.1.9 also has to request the printer first, then while the printer is with A, B waits without holding anything. A also gets the file, finishes its work, releases both resources, and B continues. The ring cannot form.

Breaking mutual exclusion is often not possible: a printer is by nature single-owner.

2.1.5Memory management

The processor reads instructions and data only from RAM; so every program has to be loaded into memory to run. The operating system must find room for each process, keep processes from entering one another’s space, and offer a way out when RAM is not enough.

2.1.5.1Tasks of memory management

Table 2.1.9: The six tasks of memory management.
RoleMeaning
AllocationProviding each program with a memory region according to its needs
ProtectionPreventing one process from changing another process’s memory without permission
Virtual memoryGiving programs an address space independent of physical RAM
PagingManaging memory in fixed-size pieces
SwappingTemporarily moving some data to disk when necessary
SharingOpening common code or data to several processes in a controlled way

Table 2.1.9 lists the tasks. The first two, allocation and protection, are essential to every memory manager. Virtual memory and paging are today’s way of doing these two tasks flexibly. Swapping comes into play when RAM is not enough. Sharing serves to use memory efficiently. For example, five processes started from the same browser keep the program’s code in RAM once, not five times; sharing is safe because the code is only read. Each process’s own data, however, stays separate.

2.1.5.2Allocation, protection, and swapping step by step

The basic ideas of memory management show up clearly in a model simpler than real systems. In this model each process is given a single contiguous region in RAM, and the region is described by two numbers.

Definition 2.1.14

The base register holds the starting address of the process’s region in RAM, and the limit register holds the length of the region. The process works with logical addresses that treat the start of its own region as 0. On every access the hardware compares the logical address with the limit. If the address is less than the limit, physical address = base + logical address; otherwise the access is blocked.

These two registers are inside the processor, and the hardware uses them automatically on every memory access. When the process changes, the operating system loads the new process’s base and limit values into the registers; this is part of the context switch. A process cannot change these registers itself, because the instructions that write to them run only in kernel mode.

Example 2.1.10

RAM is 640 KB, and the first 100 KB is used by the operating system. Processes A (200 KB) and B (150 KB) are loaded in turn, A makes two memory accesses, and then process C arrives asking for 250 KB. Addresses are in KB.

StepEventCalculationResult
1Start640 − 100 = 5400–100 operating system, 540 KB free
2A is loadedbase = 100, limit = 200; 100 + 200 = 300A: 100–300; 340 KB free
3B is loadedbase = 300, limit = 150; 300 + 150 = 450B: 300–450; 640 − 450 = 190 KB free
4A requests address 150150 < 200 ✓; 100 + 150 = 250Goes to physical address 250
5A requests address 250250 ≥ 200 ✗Access blocked; control passes to the kernel
6C asks for 250 KB190 < 250No room; the waiting B is written to disk, leaving 640 − 300 = 340 KB of contiguous free space
7C is loadedbase = 300, limit = 250; 300 + 250 = 550C: 300–550; 640 − 550 = 90 KB free; B on disk
RAM (640 KB)Disk (swap space)OperatingsystemProcess A200 KBProcess B150 KB190 KB free0100300450640150 → 100 + 150 = 250 ✓A is running, logical address 150 requested150 < limit (200) → physical address = base + 150 = 250 ✓
RAM (640 KB)Disk (swap space)OperatingsystemProcess A200 KBProcess B150 KB190 KB free0100300450640250 → 100 + 250 = 350 ✗ (B’s region)A is running, logical address 250 requested250 ≥ limit (200) → violation ✗: hardware interrupt, access blocked
RAM (640 KB)Disk (swap space)Process B (150 KB)OperatingsystemProcess A200 KBProcess C250 KB90 KB free0100300550640Process C → base = 300, limit = 250B waits on disk; it is brought back when it is about to run (swap in).
Figure 2.1.16: Three steps of Example 2.1.10. (a) Step 4: A’s address 150 is below the limit and is translated to physical address 250. (b) Step 5: address 250 exceeds the limit; if allowed, it would reach B’s region at 350. (c) Step 7: B has been written to disk and C is loaded at 300–550.

Figure 2.1.16 shows the important moments of the table on a strip of RAM. In allocation (steps 1–3) each new process takes its place at the start of the free area, and the regions do not overlap. In a valid access (step 4) A asks for address 150 from its own point of view; A does not know that its region starts at 100 in RAM. The hardware first compares 150 with the limit, then adds the base: 100 + 150 = 250.

Protection violation (step 5). This time A asks for address 250. 250 is not less than 200; the address is outside A’s region. The hardware does not perform the access; it raises an interrupt and hands control to the kernel. In a real system the operating system would terminate A with an “access violation” (segmentation fault) error; to continue the example, A’s region is left in place here. Had the hardware not blocked it, the physical address would have been 100 + 250 = 350, that is, a write into B’s region. Thanks to protection, B’s memory is not corrupted.

Swapping (steps 6–7). C asks for 250 KB. RAM has 190 KB free between 450 and 640; since 190 < 250, C does not fit. At that moment B is waiting for a disk operation and will not run for a while. The operating system writes all of B’s memory to the swap space on disk. This operation is called swapping out. A contiguous free area of 340 KB appears between 300 and 640, and C is loaded at 300–550, leaving 90 KB. When B is about to run again, it is brought back into RAM. If there is no room, another process is written to disk this time.

Definition 2.1.15

Swapping is temporarily writing the memory of a process, or part of it, to disk to free up RAM, and reading it back when needed. The area set aside on disk for this is called the swap space.

Swapping increases capacity but has a heavy price: the disk is much slower than RAM. The next section puts numbers on this difference.

Common mistake

Thinking that the limit register holds the region’s end address. The limit is the length of the region. For A the limit is 200, not an end address of 300. This is why the comparison is made with the logical address (150 < 200), not with the physical address. Valid logical addresses run from 0 to 199; even address 200 is outside the region.

This simple model has a weakness: as processes come and go, small gaps appear in RAM, and even when the total free space is enough, a contiguous piece may not be found. Virtual memory and paging solve this problem.

2.1.5.3Virtual memory and paging

Definition 2.1.16

Virtual memory is the arrangement that gives each process its own virtual address space, starting at 0 and independent of physical RAM. In paging, the virtual address space is divided into equal-sized pages and physical RAM into frames of the same size. Each process has a page table, which records whether each page is in a frame or on disk. A common page size is 4 KB (4,096 bytes).

Process A (virtual)Process B (virtual)Physical memory (RAM)frame 0: A3frame 1: B0frame 2: A0frame 3: freeframe 4: B1frame 5: A1Diskswap space: A2, B2page 0page 1page 2page 3page 0page 1page 2page =frame= 4 KB
Figure 2.1.17: The virtual pages of two processes are mapped to physical frames or to disk. A’s pages 0, 1, and 3 are in frames 2, 5, and 0 respectively, and its page 2 is in the swap space on disk. B’s pages 0 and 1 are in frames 1 and 4, and its page 2 is on disk. Frame 3 is free.

Figure 2.1.17 shows three important consequences of paging.

  • Each process sees its own world. Both A and B start at page 0. The “address 0” of the two processes is in different places in RAM: A’s in frame 2, B’s in frame 1. A process cannot generate an address into another’s page at all, because that frame is not in its own table. Protection comes automatically.
  • Pages need not be consecutive in RAM. A’s pages are scattered across frames 2, 5, and 0. Every free frame fits any page; the problem of searching for contiguous space disappears.
  • Rarely used pages can be moved out to disk. A2 and B2 wait on disk. They take no room in RAM until the process needs them. Swapping is now done not with the whole process but page by page.

The swap space is called the page file on Windows and swap on Linux and macOS. The price of virtual memory is speed. A RAM access takes about 50–100 nanoseconds (ns); a read from an SSD takes about 0.1 milliseconds (ms). Let us compare the two times by converting them to the same unit:

0.1 ms = 100,000 ns; 100,000 ÷ 100 = 1,000 and 100,000 ÷ 50 = 2,000

Reading a page from disk takes 1,000 to 2,000 times longer than one RAM access. As long as swapping is rare, this difference is not noticed. But if RAM is badly insufficient, the operating system starts to write and read pages constantly, the disk light flickers, and the computer slows down noticeably. This is why a shortage of RAM causes slowness even when the disk has plenty of free space.

2.1.5.4Address translation step by step

When a process generates a virtual address, the memory management unit (MMU) inside the processor translates it into a physical address. Translation has two stages: first the address is split into a page number and an offset within the page, then the page number is looked up in the table.

page = virtual address ÷ page size (integer quotient); offset = virtual address mod page size

physical address = frame × page size + offset

Here “mod” means the remainder of the division. The offset never changes in translation: because the page is moved to a frame as a whole, byte 4 of the page is also byte 4 of the frame. All that changes is that the frame number takes the place of the page number.

Example 2.1.11

The page size is 4,096 bytes. The page table of process A: page 0 → frame 2, page 1 → frame 5, page 2 → on disk, page 3 → frame 0. Frame 3 is free. A first reads virtual address 4100, then 8200.

  1. Division. 4100 ÷ 4096 = 1, remainder 4. That is, 4100 = 1 × 4096 + 4: page 1, offset 4.
  2. Table. Page 1 → frame 5. The page is in RAM.
  3. Physical address. 5 × 4096 + 4 = 20,480 + 4 = 20,484. The read is made from this address.
  4. Division. 8200 ÷ 4096 = 2, remainder 8. That is, 8200 = 2 × 4096 + 8: page 2, offset 8.
  5. Table. Page 2 is not in RAM but on disk. The MMU raises a page fault; the instruction is halted and the operating system steps in.
  6. Loading. The operating system reads page 2 from disk into the free frame 3 and updates the table: page 2 → frame 3.
  7. Retry. 3 × 4096 + 8 = 12,288 + 8 = 12,296. This time the translation succeeds.
Virtual address4100page 1+44100 = 1×4096 + 4Page table (Process A)0frame 21frame 52on disk (absent)3frame 0RAM0: A31: B02: A03: free4: B15: A1Disk (swap)Physical address = 5 × 4096 + 4 = 20484
Virtual address8200page 2+88200 = 2×4096 + 8Page table (Process A)0frame 21frame 52on disk (absent)3frame 0RAM0: A31: B02: A03: free4: B15: A1Disk (swap)PAGE FAULT
Virtual address8200page 2+88200 = 2×4096 + 8Page table (Process A)0frame 21frame 52frame 33frame 0RAM0: A31: B02: A03: A24: B15: A1Disk (swap)Physical address = 3 × 4096 + 8 = 12296
Figure 2.1.18: Three moments of Example 2.1.11. (a) 4100 = 1 × 4096 + 4; page 1 is in frame 5, physical address 20484. (b) The page of address 8200 (page 2) is on disk: page fault. (c) Page 2 has been loaded into frame 3; physical address 3 × 4096 + 8 = 12296.
Definition 2.1.17

A page fault is the MMU’s report that the page the process accessed is not in RAM at that moment. The operating system loads the page from disk into a frame, updates the page table, and re-executes the interrupted instruction.

Figure 2.1.18 shows three moments of the translation. Despite its name, a page fault is mostly not a programming error; it is the normal operation of virtual memory. When a program starts, most of its pages are still on disk and arrive in RAM one by one through page faults on their first accesses. The program never notices; only that access takes a little longer. A real error appears only when the process accesses an address that does not belong to it and is not in the table at all; then the operating system terminates the process with an access violation.

Division and remainder become even easier with binary numbers. Since 4096 = 212, the last 12 bits of a virtual address give the offset and the remaining bits give the page number. The hardware does no division; it just splits the bits. In hexadecimal each digit is 4 bits, so the last three hexadecimal digits are the offset:

Table 2.1.10: Address translation in hexadecimal: the last three digits (12 bits) are preserved unchanged.
Virtual addressHexadecimalPage · offsetFramePhysical address (hexadecimal)Physical address
41001004₁₆1 · 00455004₁₆20484
82002008₁₆2 · 00833008₁₆12296

Table 2.1.10 shows this shortcut. 4100 is 1004₁₆ in hexadecimal. The leading 1 is the page number, and the trailing 004 is the offset. Since page 1 is in frame 5, the leading 1 is replaced by 5: 5004₁₆ = 20484. The decimal calculation gave the same result.

Common mistake

Adding the offset directly to the frame number when finding the physical address: 5 + 4 = 9. The frame number is a sequence number; to get the frame’s starting address it must be multiplied by the page size: 5 × 4096 = 20,480. The offset is added to that start.

2.1.5.5Page replacement: LRU and FIFO

When a page fault occurs and there is a free frame, the job is easy. If RAM is full, the operating system has to move one page out to disk and load the new one in its place. Deciding which page to evict is called page replacement. A wrong choice causes a new page fault for the same page right afterwards. Every fault also means a slow disk read.

Definition 2.1.18

The LRU (least recently used) rule evicts the page whose last use is the oldest. The FIFO (first in, first out) rule evicts the page that was loaded into RAM first. When the requested page is already in RAM, it is called a hit.

The idea behind LRU is this: programs tend to reuse soon the pages they used recently. A loop runs the same instructions again and again; a function accesses the same variables again and again. A page that has not been touched for a long time is less likely to be needed soon.

Example 2.1.12

The process has only 3 frames in RAM. The process requests pages in the order 7, 0, 1, 2, 0, 3, 0, 4. How many page faults occur under the LRU rule?

Request no.PageResultEvictedPages in RAM (last use)
17fault—7 (1)
20fault—7 (1), 0 (2)
31fault—7 (1), 0 (2), 1 (3)
42fault72 (4), 0 (2), 1 (3)
50hit—2 (4), 0 (5), 1 (3)
63fault12 (4), 0 (5), 3 (6)
70hit—2 (4), 0 (7), 3 (6)
84fault24 (8), 0 (7), 3 (6)

Of the 8 requests, 6 are page faults and 2 are hits. The first three faults are loads into free frames; at each of the next three faults, a page is evicted.

requests70120304framespage 2last use: request 4page 0last use: request 2page 1last use: request 3evicted: page 7page fault
requests70120304framespage 2last use: request 4page 0last use: request 5page 3last use: request 6evicted: page 1page fault
Figure 2.1.19: Two eviction moments of Example 2.1.12. (a) Request 4: there is no room for page 2; page 7, with the oldest last use (request 1), is evicted. (b) Request 6: for page 3 the oldest use is on page 1 (request 3); page 0 is kept because it was used just now, at request 5.

Figure 2.1.19 shows two of the eviction decisions. The numbers in parentheses in the table are the information LRU keeps for its decision: the request at which each page was last used. The page to evict is the one with the smallest number. When page 0 is a hit at the fifth request, only its last-use time is updated, from 2 to 5. This small update saves page 0 from being evicted at the sixth request.

What happens if the same request sequence is processed with FIFO? FIFO looks only at the order in which pages entered RAM; hits do not change the order.

Table 2.1.11: Processing the same sequence (7, 0, 1, 2, 0, 3, 0, 4; 3 frames) with FIFO. The RAM column shows the order of entry: the leftmost is the oldest.
Request no.PageResultEvictedRAM (oldest to newest)
1–37, 0, 13 faults—7, 0, 1
42fault70, 1, 2
50hit—0, 1, 2
63fault01, 2, 3
70fault12, 3, 0
84fault23, 0, 4

Table 2.1.11 shows that FIFO gives 7 page faults, one more than LRU. The difference arises at the sixth request. FIFO does not take into account that page 0 was just used; because 0 is the page that entered earliest, it evicts it. Right after that, the seventh request asks for page 0 again, and an unnecessary fault occurs. LRU had kept the frequently used page 0.

If each page fault requires an SSD read of about 0.1 ms, LRU’s 6 faults cost about 0.6 ms and FIFO’s 7 faults 0.7 ms; hits finish within nanoseconds.

LRU is not better than FIFO on every sequence, but it gives fewer faults on most real programs. Exact LRU is expensive because it needs a timestamp on every access; operating systems use cheaper rules that approximate it.

Common mistake

Taking LRU and FIFO to be the same because both evict an “old” page. FIFO evicts the page whose entry into RAM is the oldest, LRU the page whose last use is the oldest. A hit changes nothing in FIFO, while in LRU it refreshes the page’s last-use time.

2.1.6Device and file management

The user talks to the computer through the keyboard, screen, printer, and disks. The operating system manages these devices with drivers and organizes the raw data on the disk as files that have a name, a location, and an owner.

2.1.6.1Devices and drivers

A laser printer and an inkjet printer expect completely different commands for the same “print page” request. Graphics cards from two manufacturers have different registers. If the operating system held all these differences inside itself, the operating system would have to change for every new device.

Definition 2.1.19

A device driver is software that translates the operating system’s common requests into operations specific to a particular piece of hardware. The driver is usually written by the device’s manufacturer and is added to the operating system later.

Application“print”, “display”Operating systemcommon interfacePrinter driverPrinterGraphics card driverGraphics cardUSB driverUSB driveinterrupt: “job done / data arrived”
Figure 2.1.20: The application issues common requests such as “print” or “display.” The operating system passes them through a common interface to the right driver (printer, graphics card, USB). When the device finishes, it reports “job done / data arrived” with an interrupt.

Figure 2.1.20 shows where drivers sit: between the operating system and the hardware, a separate interpreter for each device. Three more concepts of device management are part of this arrangement.

  • Plug and play: the operating system detects a newly attached compatible device, reads its identity, and loads and configures the right driver automatically. This is why a USB drive appears in File Explorer within a few seconds of being plugged in.
  • Interrupt: a device reports an event to the processor. A key press on the keyboard, a printer finishing a job, and a packet arriving from the network are all interrupts.
  • Buffer: a memory area that temporarily holds data between components of different speeds.
Example 2.1.13

A 20-page document is sent to a printer that prints 10 pages per minute. Without a buffer, the word processor would wait for the printer on every page and look frozen for 2 minutes. With a buffer, the operating system puts all 20 pages into the print queue quickly and the word processor is freed at once. The driver sends the pages from the buffer at the printer’s speed; when each page is done, the printer reports that it is ready with an interrupt. Printing still takes 2 minutes, but the user keeps working in the meantime.

2.1.6.2The file system

A disk on its own is a large store made of millions of numbered blocks. No one can remember something like “my homework starts at block 18,452.” Users and programs refer to files by name. The file system builds the bridge between the name and the block number.

Definition 2.1.20

A file system is the arrangement that defines how data is named, organized, and located on a storage device. A file is a unit of data with a name and contents. A folder (directory) groups files and subfolders. A path specifies a file’s location in the folder structure. Metadata is a file’s properties other than its contents: size, date, owner, and permissions. Permissions determine the rights to read, write, and execute. Journaling helps the file system stay consistent after unexpected interruptions.

rapor.txtfolder entryMetadatasize: 9 KBmodified: 10.10.2026owner: ayse · permissions: rw-blocks: 12, 13, 40Disk blocks (4 KB)891011121314154041424344454647⋮9 KB → 3 blocks (12 KB of space)
Figure 2.1.21: The rapor.txt entry in the folder points to the file’s metadata: size 9 KB, modified 10.10.2026, owner ayse, permissions rw-, blocks 12, 13, and 40. The disk is divided into 4 KB blocks; a 9 KB file takes 3 blocks, that is, 12 KB of space.

Figure 2.1.21 shows how a file is found on disk as a chain of three links. The folder holds the name of each file in it and the location of that file’s metadata record. The metadata record states all the file’s properties and which disk blocks hold the contents. The contents themselves are in those blocks. The blocks need not be consecutive: the first two pieces of rapor.txt are in blocks 12 and 13, and the third piece is in block 40.

Example 2.1.14

The block size is 4 KB. How many blocks and how much space does the 9 KB rapor.txt take on disk? How much space does a 1-byte file take on the same disk?

  1. 9 ÷ 4 = 2.25. Since there are no fractional blocks, round up: 3 blocks.
  2. Space used: 3 × 4 = 12 KB. In the last block 12 − 9 = 3 KB is left empty; this space cannot be given to another file.
  3. A 1-byte file also needs at least one block: it takes 4 KB of space.

This is why a file’s Properties window in Windows shows two separate values, “Size” and “Size on disk.”

Journaling means the file system writes what it is about to do to a separate journal area before making a change. Saving a file takes several steps: the contents are written to blocks, the metadata is updated, and the free-block list changes. If the power is cut in the middle of these steps, the file system may be left inconsistent: for example, a block may appear both free and in use. A journaling file system checks the journal at start-up and either completes or rolls back the unfinished work. This way a long disk scan is not needed.

2.1.6.3File system types

Each operating system family has developed its own file system. Which computers can read and write a USB drive depends on the file system it was formatted with. Formatting means writing an empty file system structure to a partition, and it erases the partition’s old contents.

Table 2.1.12: Common file systems.
File systemPlatformJournalingWhen is it used?
NTFSWindows (macOS read-only)YesWindows system disk; when large files, permissions, and encryption are needed
FAT32Almost every device and operating systemNoOlder devices, cameras, simple memory cards; a single file can be at most 4 GB
exFATWindows, macOS, and current LinuxNoUSB drives and SD cards with large files; moving data between platforms
ext4LinuxYesLinux system and data disks
APFSmacOS, iOS, iPadOSNo classic journal; consistency through copy-on-writeDefault file system of Apple devices

Table 2.1.12 compares five common file systems. The most practical limit in the table is FAT32’s file size limit. FAT32 stores a file’s size as a 32-bit number. The largest number that 32 bits can write is 232 − 1 = 4,294,967,295; so a single file can be at most one byte short of 4 GiB. APFS’s “copy-on-write” method, on the other hand, writes changed data not over the old data but to a new place; when the operation completes, it switches the pointer to the new place. If an interruption occurs, the old version stays intact.

Example 2.1.15

A 3 GB film and a 5 GB video (1 GB = 109 bytes) are to be copied to a FAT32-formatted USB drive. The limit is 4,294,967,295 bytes. Since 3,000,000,000 bytes is below the limit, the film is copied; since 5,000,000,000 bytes exceeds the limit, the video cannot be copied even if there is room on the drive. If the drive will be written on both Windows and macOS, exFAT is chosen, because macOS can only read NTFS. Since formatting erases the contents, a backup is made first.

2.1.6.4The file system tree and paths

Because folders can contain folders, the file system has the shape of a tree. At the top of the tree sits the root folder. Folders are the branches of the tree and files are its leaves.

/binetchomeaysealibelgelerrapor.txtnotlar.txtresimlertmp
Figure 2.1.22: A Linux file tree. The path from the root folder (/) to rapor.txt is highlighted: / → home → ali → belgeler → rapor.txt.

Figure 2.1.22 shows the tree on a Linux system. The root has the folders bin, etc, home, and tmp. Users’ personal folders are under home. The highlighted path shows how a file’s address is formed by writing folder names one after another.

Definition 2.1.21

An absolute path starts at the root and gives the file’s full address: /home/ali/belgeler/rapor.txt. A relative path is written relative to the current directory, that is, the folder you are in at that moment. .. denotes the parent folder and . the current folder itself.

Example 2.1.16

In the tree of Figure 2.1.22, how is rapor.txt reached by a relative path from three different current directories?

  1. Current directory /home/ali: belgeler/rapor.txt. Go down one folder.
  2. Current directory /home/ali/belgeler: rapor.txt. The file is already here.
  3. Current directory /home/ayse: ../ali/belgeler/rapor.txt. First go up to the parent folder (home), then down into ali and belgeler.

All three relative paths point to the same file, and the absolute equivalent of each is /home/ali/belgeler/rapor.txt.

On Windows the same idea is written with two differences. There is not a single root; each drive has its own root, and a drive is shown with a letter (C:, D:). The folder separator is a backslash instead of a forward slash: C:\Users\Ali\Documents\rapor.txt. On Linux and macOS names are case-sensitive (Rapor.txt and rapor.txt are two different files); on Windows by default they are not.

2.1.6.5Opening and reading a file step by step

When a program reads a file, it makes a series of system calls to the kernel in the background: first it opens the file, then reads it piece by piece, and finally closes it. These three calls show how the file system and process management work together.

Definition 2.1.22

A file descriptor (fd) is the small integer the kernel gives a process for an open file. In later read and write calls the process refers to the file by this number, not by its name. In every process, 0 is open from the start for standard input, 1 for standard output, and 2 for standard error. On Windows the same idea is called a handle.

Example 2.1.17

An editor opens the 150-byte file /home/ali/rapor.txt and reads it to the end in pieces of 100 bytes. What happens at each call?

CallWhat the kernel doesReturn valuePosition
openResolves the path piece by piece: / → home → ali → rapor.txt. Checks the metadata: size 150 bytes, read permission present. Creates an open-file record.fd = 30
read (100)Reads bytes 0–99n = 100100
read (100)Only 50 bytes remain; reads 100–149n = 50150
read (100)No bytes left to readn = 0 (end of file)150
closeDeletes the record; number 3 becomes free again0 (success)—

The editor gets 100 + 50 = 150 bytes with three read calls. The third call returning 0 tells the program that it should stop reading.

file descriptor table0standard input1standard output2standard error3rapor.txt, position 0path resolution/homealirapor.txtrapor.txt (150 bytes)position 00100150
file descriptor table0standard input1standard output2standard error3rapor.txt, position 150path resolution/homealirapor.txtrapor.txt (150 bytes)position 1500100150
Figure 2.1.23: Two moments of Example 2.1.17. (a) After open: entry 3 in the file descriptor table points to rapor.txt, position 0. (b) After the second read: the position has reached 150, the end of the file.

Figure 2.1.23 shows the file descriptor table and the position in the file. Let us follow the table step by step.

Path resolution. In the open call the kernel resolves the path one component at a time from the start. First it reads the root folder and looks for the name home in it. When it finds it, it reads the home folder and looks for ali. Each folder is a list of the names in it and where those names are on disk. Finally rapor.txt is found and its metadata is examined. If the user has no read permission, open returns an error and the file is not opened. On later reads the path does not have to be resolved again; this work is done only at open time.

File descriptor and position. The kernel gives the process the smallest unused number; since 0, 1, and 2 are taken, the first file opened gets 3 and the second gets 4. Each read advances the position automatically by the number of bytes it read; the application never knows block numbers.

Closing. close deletes the record and the number becomes free. When a process ends, the operating system itself closes any files it left open. But if a long-running server program does not close the files it opens, the number of descriptors allowed per process eventually runs out and the program can no longer open new files.

2.1.7User interfaces

The place where the user meets the operating system is the interface: windows, gestures on a touchscreen, or a command line.

2.1.7.1Interface types

Definition 2.1.23

A graphical user interface (GUI) is based on windows, icons, menus, and interaction with a mouse. A command-line interface (CLI) is an interface in which the user types text commands and sees the results as text. A touch interface works with taps, swipes, and finger gestures.

Command PromptC:\> dir rapor.docx notlar.txtC:\> copy rapor.docx E:\ 1 file(s) copied.C:\> _File Explorerrapornotlarresimler
Figure 2.1.24: The same job in two interfaces. On the left, in Command Prompt, dir lists the folder and copy rapor.docx E:\ copies the file. On the right, File Explorer shows the same folder with icons.

Figure 2.1.24 shows the same folder in two interfaces. In the graphical interface the files appear as icons and the file is dragged to copy it. At the command line, the contents of the folder are listed with the dir command and the file is copied with the copy command. Both ways end in the same system calls; the difference is only in how the user conveys the request.

A graphical interface is easy to learn: menus show what can be done. The command line is fast, repeatable, and suited to automation. Renaming 500 photos one by one with the mouse takes hours; at the command line a short script finishes the job in seconds and can be run automatically every night. This is why most servers have no graphical interface installed at all.

Every interface is also supported by accessibility tools: a screen reader reads the text aloud, a magnifier enlarges the screen, and a high-contrast theme makes text stand out.

2.1.7.2Command-line basics

At the command line each command is one line: first the name of the command, followed by arguments separated by spaces. In the command copy a.txt b.txt, copy is the name of the command and a.txt and b.txt are the arguments. Commands always run in the current directory; relative paths are interpreted relative to that folder. The shell on Linux and macOS and Command Prompt (cmd) on Windows use different command names for the same jobs.

Table 2.1.13: Equivalents of basic commands on Linux/macOS and Windows (cmd).
TaskLinux / macOSWindows (cmd)
Show the current folderpwdcd (no arguments)
List the contents of a folderlsdir
Change foldercd foldercd folder
Create a foldermkdir newmkdir new
Copy a filecp a.txt b.txtcopy a.txt b.txt
Delete a filerm a.txtdel a.txt

Table 2.1.13 compares the six most common tasks in the two worlds. pwd takes its name from “print working directory.” cd means “change directory.” Using commands and paths together makes it possible to move around the file tree.

Example 2.1.18

On Linux the current directory is /home/ali. In the tree, belgeler and resimler are under /home/ali, and notlar.txt is under /home/ayse. How does the current directory change as the following commands are run in order?

CommandExplanationNext current directoryOutput
cd belgelerRelative path: one folder down/home/ali/belgeler—
cd ../resimlerOne up (ali), then resimler/home/ali/resimler—
cd ../../ayseTwo up (ali, home), then ayse/home/ayse—
lsLists the contents/home/aysenotlar.txt
cd /tmpStarts with “/”: absolute path/tmp—
pwdPrints the current directory/tmp/tmp

Each .. goes one folder up. A path that starts with / starts from the root no matter what the current directory is.

Common mistake

Thinking that a file deleted with rm or del goes to the Recycle Bin. These commands delete the file directly; there is no easy way to get it back. Before running the command, make sure that the current directory and the file name are correct.

2.1.7.3File permissions and chmod

On Linux and macOS, each file’s permissions are kept separately for three groups of users: the file’s owner, the group the owner belongs to, and others. For each group there are three permissions: r (read), w (write), and x (execute). A file’s permissions are thus written with nine characters: rw-r--r--. A dash in place of a letter means that permission is absent.

Permissions are changed with the chmod command and are usually given as a three-digit number. Each digit stands for one group. The value of a digit is found by adding the weights of the permissions in that group: r = 4, w = 2, x = 1.

ownerr14w12-014+2 = 6groupr14-02-014otherr14-02-014permissionbitvaluesum
Figure 2.1.25: chmod 644: owner rw- (110 → 4 + 2 = 6), group r-- (100 → 4), other r-- (100 → 4).

Figure 2.1.25 shows where 644 comes from. Since the weights are 4, 2, and 1, each group’s three permissions are really a three-bit binary number. The owner’s permission rw- is binary 110, and 110₂ = 6. r-- is 100₂ = 4. Since three bits can express eight values from 0 to 7, each digit lies between 0 and 7.

Table 2.1.14: Commonly used permission digits.
DigitBinaryPermissionMeaning
7111rwxRead, write, execute
6110rw-Read, write
5101r-xRead, execute
4100r--Read only
0000---No permissions
Example 2.1.19

(a) What are the permissions after the command chmod 755 yedekle.sh? (b) A log file should be readable and writable only by its owner, with no one else having access. Which number should be used? (c) Which number writes the permission rw-rw-r--?

  1. (a) 7 = 4 + 2 + 1 → rwx; 5 = 4 + 1 → r-x; 5 → r-x. The result is rwxr-xr-x: the owner can do everything, while the group and others can read and execute but not modify.
  2. (b) Owner: rw- = 4 + 2 = 6. Group: --- = 0. Other: --- = 0. The number is 600.
  3. (c) rw- = 6, rw- = 6, r-- = 4. The number is 664.

Three groups with three permissions each make nine bits in total; so there are 29 = 512 different permission combinations. Since each digit has 8 values, the same number comes out as 8 × 8 × 8 = 512.

Common mistake

Reading permission digits like a decimal number: “644 is greater than 600, so it grants more permissions.” Each digit stands for a separate group. With 644, the group and others can read; with 600 they cannot. Also, giving chmod 777 just because a problem is not getting solved makes the file modifiable by everyone and is a serious security hole.

2.1.8User and privilege management

A computer can be used by several people; thousands of people can connect to a server. The operating system asks two questions at every operation: who is performing the operation, and does this person have the right to do it? These two questions are answered in two separate stages.

Definition 2.1.24

Authentication checks that the user is who they claim to be: “Who?” It is done with a password, a PIN, or biometric data such as a fingerprint. Authorization determines what the authenticated user may do: “What can they do?” Permissions and account type are checked at this stage.

User1 · Authentication“Who?” password, PIN, biometrics2 · Authorization“What can they do?” permissions, account type✓ own files✗ system settingwritten to the event log
Figure 2.1.26: The authentication and authorization flow. A standard user can open their own files (✓) but cannot change a system setting (✗). Allowed and denied accesses are written to the event log.

Figure 2.1.26 shows the two stages in order. The user first proves their identity. After that, an authorization check is made separately for every operation. In the example, the same user can open their own file but cannot change a system setting. Both results are written to the event log.

Accounts are generally of two kinds. A standard account is for everyday use and limits changes that affect the system. An administrator account can make system-wide changes such as installing programs, changing system settings, or accessing other users’ files. On Windows even an administrator account shows a confirmation window before such an operation; on Linux the same operation is done by typing sudo before the command, and a password is requested.

Definition 2.1.25

The principle of least privilege: each user and each program is given only as much authority as needed to do its job, and no more.

The value of this principle shows up during an attack. Malware in an e-mail attachment opened with a standard account runs only with that user’s privileges. It can harm the user’s own files, but it cannot change system files and cannot reach other users. If the same attachment were opened on the computer of someone who always works with an administrator account, it could take over the whole system.

Logging allows important events to be examined afterwards: if hundreds of failed password attempts appear in the log at midnight, the administrator learns of the attack.

Example 2.1.20

A student with a standard account signs in with a password, opens their own homework file, then tries to change the system clock and is blocked. At which stage is each step?

  1. Signing in: the password is correct → authentication succeeds.
  2. Opening the homework file: the file’s owner is the student and read permission exists → authorization succeeds (✓).
  3. Changing the clock: a system-wide setting is closed to the standard account → authorization denied (✗); written to the event log.

The obstacle is in authorization, not in authentication. The student has proven who they are; they simply lack the privilege for that one operation.

2.1.9Types of operating systems

A smartphone, a web server, and a car’s brake unit use operating systems that do the same basic jobs, but their priorities differ: battery life stands out on the phone, uninterrupted operation on the server, and timely response in the brake unit.

2.1.9.1Personal computer systems

On desktop and laptop computers, four families stand out.

  • Windows: the system with the widest range of hardware and applications. It runs on computers from many manufacturers; most games and business software are written for Windows first.
  • macOS: runs only on Apple computers. Because the same company makes the hardware and the software, the two are tightly integrated.
  • Linux distributions: can be customized for different desktop environments and purposes. Most are free and can run well even on older hardware.
  • ChromeOS: focuses on web- and cloud-based use. Because most applications and data live on the internet, it starts quickly even on low-spec devices; offline use is limited.

2.1.9.2Mobile operating systems

There are two systems in the mobile world. Android is a broad ecosystem that runs on devices from different manufacturers. iOS and iPadOS are the integrated systems Apple developed for its phones and tablets. The priorities of mobile systems differ from the desktop: a touch interface, power management that extends battery life, sensors such as location and acceleration, and constantly changing wireless connections. Applications running in the background are tightly restricted, because every running process drains the battery.

Definition 2.1.26

A sandbox is an isolated runtime environment in which an application can access only its own data. Access to resources such as location, camera, microphone, and contacts has to pass through the operating system’s permission check and often through the user’s approval.

Mapssandbox · own dataNotessandbox · own dataGamesandbox · own data✕✕requests locationrequests contactsPermission check (operating system) · user approvalPositionCameraMicrophoneContactsallowed ✓denied ✕
Figure 2.1.27: The maps, notes, and game apps run in their own sandboxes and cannot reach each other’s data (✕). The maps app asks for location and the game asks for the contacts list; the requests pass through the operating system’s permission check and the user’s approval.

Figure 2.1.27 shows application isolation. Each application lives in its own box. The notes app cannot read the maps app’s saved addresses. When an application wants to reach the phone’s shared resources, the operating system steps in and asks the user. A maps app asking for location is an expected request, and the user grants it. A game asking for the contacts list is suspicious, and the user can refuse. This way a malicious app cannot collect personal data without the user noticing.

2.1.9.3Server operating systems

A server is a computer that provides services to other computers over a network. Server operating systems are shaped by this job.

BrowserMobile appOffice computerrequestrequestrequestServer operating systemWeb serviceDatabaseFile sharingAuthenticationmulti-user · continuous operation · logging and permissions
Figure 2.1.28: Requests from clients such as a browser, a mobile app, and an office computer go to the web, database, file sharing, and authentication services of the server operating system. The server is multi-user and runs continuously; it keeps logs and checks permissions.

Figure 2.1.28 shows that a server serves many clients at the same time. The priorities of server operating systems are as follows:

  • Multi-user operation: managing many users and services at the same time.
  • Network services: web, database, file sharing, and authentication services.
  • Continuity: months of uninterrupted operation and remote management. When a server restarts, all the services that depend on it are interrupted.
  • Security: permission, logging, updating, and network control.
  • Automation: repeatable management with the command line and configuration tools. Instead of configuring a hundred servers by hand one by one, the same script is run on all of them.

Common examples are Linux distributions, Windows Server, and Unix derivatives. The great majority of web servers on the internet use Linux.

2.1.9.4Embedded and real-time systems

Definition 2.1.27

An embedded operating system is an operating system that runs with limited processor, memory, and energy for a specific device task; it is found in routers, car control units, and medical devices. A real-time operating system aims for an operation to produce not just the correct result but the result within a set time, that is, before the deadline.

System A6 mson time ✓System B14 mslate: counts as a failure ✗deadline: 10 mst = 0: brake signal
Figure 2.1.29: A deadline in a real-time system. The brake signal arrives at t = 0 and the deadline is 10 ms. System A responds in 6 ms (on time ✓); system B responds in 14 ms (late: counts as a failure ✗).

Figure 2.1.29 shows the basic rule of a real-time system: a correct result that arrives late is also wrong. Both systems produce the right brake command, but B is counted as failed because it misses the deadline. In a desktop operating system no one notices a window opening 4 ms late. In a braking system the same delay means distance.

Example 2.1.21

In a car traveling at 100 km per hour, the brake signal arrives at t = 0. System A responds after 6 ms, system B after 14 ms. How far does the car travel in these times?

  1. Convert the speed to meters per second: 100 km/h = 100,000 m ÷ 3,600 s ≈ 27.78 m/s.
  2. System A: 27.78 × 0.006 ≈ 0.17 m.
  3. Deadline 10 ms: 27.78 × 0.010 ≈ 0.28 m.
  4. System B: 27.78 × 0.014 ≈ 0.39 m.

B misses the deadline by 4 ms; before braking begins, the car travels about 0.39 − 0.17 = 0.22 m farther than with A. A real-time system must guarantee that it will not exceed 10 ms even in the worst case.

In real-time systems being fast on average is not enough; the worst-case response time must also be known and bounded. This is why real-time schedulers interrupt a less important task at once when an urgent one arrives.

Common mistake

Using the phrase “real-time” to mean “very fast.” A real-time system does not have to be very fast; it has to be on time. A system with a deadline of 1 second that always meets it is real-time. A system that responds in 1 ms on average but can occasionally lag by 50 ms is not.

2.1.9.5Choosing an operating system

When choosing an operating system for a school laboratory, a software company, or a factory, no single criterion is enough. There is no such thing as “the best operating system”; there is only the one that best fits the requirements.

Table 2.1.15: Criteria to evaluate when choosing an operating system.
RequirementCriterion to evaluate
ApplicationAvailability of the required software and its versions
HardwareDriver and processor architecture support
SecurityUpdate period, privilege model, and management tools
UsabilityInterface, accessibility, and learning needs
CostThe sum of license, support, training, and maintenance

2.1.10Licensing

When software is bought, what is bought is often not the software itself but the right to use it under certain conditions. The license sets these conditions.

Definition 2.1.28

A license is the legal text that sets out which rights the software’s owner gives the user and under which conditions. Source code is the form of a program, written in a programming language, that a person can read and modify.

2.1.10.1Open-source software

In open-source software the source code is open to everyone, and the license grants rights in four areas.

  • Source code: can be examined within the terms of the license.
  • Modification: can be adapted to need if the license allows.
  • Distribution: the original or a modified version can be shared; the license sets the terms.
  • Community: development and support can be carried out together by individuals, institutions, and companies.
Examine the sourceModifyDistribute / shareContribute to the communitythe improved version returns to everyone · the license sets the terms of each step
Figure 2.1.30: The open-source cycle: examine the source, modify, distribute, and contribute to the community. The improved version returns to everyone; the license sets the terms of each step.

Figure 2.1.30 shows how open source grows as a cycle. A developer examines the code, fixes a bug or adds a feature, and sends the change back. If the change is accepted, it reaches everyone with the next release. The Linux kernel has grown this way, with the contributions of thousands of developers.

Open-source licenses fall into two main groups. Licenses such as the GPL (GNU General Public License) require that a modified version, if distributed, be distributed under the same license and together with its source code; this approach is called copyleft. Permissive licenses such as MIT and Apache allow the software to be used even inside a closed product; they generally ask only that the original license text and copyright notice be kept.

Common mistake

Equating “open source” with “free of charge” and “without support.” The license of an open-source program is generally free of charge, but many companies sell paid support, training, and maintenance for open-source products. Conversely, not every program distributed free of charge is open source: a free game’s source code may be closed. What matters is not the price but the rights the license grants.

2.1.10.2Commercial and closed-source software

In closed-source (proprietary) software the source code stays with the developing organization. The user is given only the compiled, executable program.

vendor (source code closed)Source codesecretCompileProgram (.exe)+ license agreementUserright to usepurchase / subscription
Figure 2.1.31: The closed-source model. The vendor keeps the source code secret and compiles it; the compiled program (.exe) is given to the user under a license agreement. The user obtains only the right to use it, by purchase or subscription.

Figure 2.1.31 shows this model. Four features of commercial software stand out.

  • Right to use: the software is not bought; what is usually obtained is a license to use it under certain conditions. The conditions are written in the end-user license agreement (EULA): how many devices it can be installed on, whether it can be used in business, whether reverse engineering is forbidden.
  • Source code: usually kept closed within the developing organization. The user cannot fix a bug themselves; they wait for the vendor’s fix.
  • Support: official support and service-level agreements can be offered. For example, how many hours it takes to respond when a problem is reported is guaranteed by contract.
  • Cost: there may be license, subscription, maintenance, and upgrade fees.

2.1.10.3Comparing license models

Table 2.1.16: Comparison of open-source and proprietary (closed-source) license models.
CriterionOpen sourceProprietary (closed source)
Source accessOpen under the licenseGenerally closed
CustomizationPossible within the scope of the licenseLimited to the options the vendor offers
SupportCommunity or paid providerVendor or authorized partner
CostThe license can be free; running costs remainA license or subscription may be required
License exampleGPL, MIT, ApacheEnd-user license agreement
Product exampleLinux, Firefox, LibreOfficeWindows, Microsoft Office, Adobe Photoshop

Table 2.1.16 compares the two models on six criteria. Being commercial and being open source are separate dimensions: commercial products such as Red Hat Enterprise Linux can also be open source. Both models have strengths. Open source is transparent because the code can be examined by anyone, and it reduces dependence on a single vendor. Closed source offers a single responsible vendor and contracted support. Many organizations use both: Linux on servers, Windows and Office on the desktop.

Example 2.1.22

A student club writes a program using an MIT-licensed library and another GPL-licensed library, and wants to distribute the program. What obligations arise?

  1. MIT library: the program can be distributed under any license desired. Only the library’s copyright notice and license text must be included with the distribution.
  2. GPL library: if a program containing GPL code is distributed, the whole program must be offered under the GPL together with its source code.
  3. Result: if the club wants to keep the program’s source code closed, it cannot use the GPL library; it should look for a permissively licensed alternative.

Being “open source” does not mean there are no obligations. The license text determines the rights and obligations in every case.

2.1.11Updates and support

An operating system does not stay as it was on the day it was installed. New security holes are found, hardware changes, and users want new features. The vendor answers these with updates.

Table 2.1.17: Update types and maintenance-related concepts.
ConceptMeaning
Security updateCloses known vulnerabilities
Feature updateBrings new functions and interface changes
Driver updateCan improve hardware compatibility or stability
Support periodThe time span in which the vendor provides updates
BackupProvides a way back before a major change
TestingIn enterprise environments, updates are tried out before wide rollout
support period: the vendor releases updatesend of supportno updatesvulnerabilities stay openreleasetimesecurity updatefeature updatee.g. Windows 10: 14 October 2025
Figure 2.1.32: During the support period regular security updates and occasional feature updates arrive. After end of support no updates arrive and newly found vulnerabilities are not closed. Example: support for Windows 10 ended on 14 October 2025.

Figure 2.1.32 shows the lifetime of a release. Security updates are frequent and regular; Microsoft releases them on the second Tuesday of every month. Feature updates are less frequent.

End of support does not mean the computer will stop working. A computer with Windows 10 installed still starts after 14 October 2025, but security holes found after that date are not closed. An unsupported system becomes more vulnerable with every passing month. A backup is made before a major update; organizations first try the update on a few test computers, then roll it out in stages.

2.1.12Virtualization and containers

Two technologies are used to try both Windows and Linux on the same computer, or to share a single powerful server among dozens of customers: virtual machines and containers. Both provide isolation, but they build the isolation at different layers.

2.1.12.1Virtual machines and hypervisors

Definition 2.1.29

Virtualization is sharing the resources of a single physical computer among several isolated environments. A virtual machine (VM) is a virtual computer created in software on a physical computer, with a full operating system running inside it. The system running in a virtual machine is called the guest operating system. A hypervisor is the software that provides processor, memory, and device resources to virtual machines and isolates them from one another.

The hypervisor does to operating systems, one level up, what the operating system does to processes. Each guest system believes it has its own processor, memory, and disk. In reality the hypervisor divides up the physical resources: on a server with 32 GB of RAM, four virtual machines can be given 8 GB each. If one virtual machine crashes or catches malware, the others are not affected.

2.1.12.2Containers

Definition 2.1.30

A container is a package that isolates an application and its dependencies, that is, the libraries and settings it needs to run, at the process level. Containers share the kernel of the host operating system. The software that starts and manages containers is called a container engine; the best-known example is Docker.

A container is a solution to the “it worked on my computer” problem. The application is packaged together with the library versions it needs; wherever the package is run, the environment inside it is the same. Because containers have no kernel of their own, they start in seconds and use little memory.

Virtualization and containers are common in four areas: testing software on different systems, consolidating many lightly used servers onto a single physical machine, cloud services, and distributing applications so that they are portable to any environment in the same form.

2.1.12.3Comparing virtual machines and containers

Virtual machinesHardwareHypervisorGuest OS 1Guest OS 2Guest OS 3librarieslibrarieslibrariesApp 1App 2App 3ContainersHardwareHost operating system (single kernel)Container enginelibrarieslibrarieslibrariesApp 1App 2App 3
Figure 2.1.33: Virtual machines on the left: above the hypervisor, each application has its own guest operating system and libraries. Containers on the right: the container engine runs on a host operating system with a single kernel; each container carries only its libraries and its application.

Figure 2.1.33 shows the layers of the two approaches side by side. The difference lies in the layer at which isolation is built.

Table 2.1.18: Comparison of a virtual machine and a container.
AttributeVirtual machineContainer
What does it carry?A full guest operating system and the applicationOnly the application and its dependencies
KernelEach virtual machine has its own kernelThe host operating system’s kernel is shared
IsolationStrongWeaker
Resource useMore memory, slower start-upLightweight, fast start-up
Different operating systemCan run (Windows on top of Linux)Needs the same kernel as the host
Example 2.1.23

A server running Linux has two needs: (a) 20 copies of a web application that runs on the same Linux version, (b) an accounting program that runs only on Windows. Which technology fits each need?

  1. (a) Web application: the application runs on the Linux kernel; it can share the host’s kernel. Installing 20 full operating systems for 20 copies would waste memory. Containers fit: each copy is lightweight and starts in seconds.
  2. (b) Accounting program: the program needs a Windows kernel. Containers share the host’s Linux kernel, so they cannot run this program. A virtual machine fits: a full Windows guest system is installed on top of the hypervisor.

2.1.13Summary

  • Software is the whole of programs, data, and documentation. System software manages the hardware, application software does the user’s work, programming tools produce software, and firmware is embedded in the device. Each layer abstracts the one beneath it.
  • The operating system manages processes, memory, files, devices, and users, and provides network services. Booting: power → UEFI → POST → boot loader → kernel → sign-in. Secure Boot checks signatures and the TPM stores measurements; MBR is limited to 2 TB and 4 primary partitions, GPT is not.
  • The kernel runs in privileged mode; applications request services from it with a system call. Kernels are monolithic, micro, or hybrid.
  • A process passes through the states New, Ready, Running, Waiting, and Terminated; a process whose wait is over becomes Ready first. Multiprogramming runs another process while one waits for I/O. Round-robin scheduling gives each process at most one time slice; SJF minimizes the average waiting time.
  • A deadlock requires all of mutual exclusion, hold and wait, no preemption, and circular wait.
  • The base/limit model protects memory; swapping frees up room but is slow. In virtual memory an address is split into a page and an offset; if the page is not in RAM, a page fault occurs. LRU evicts the page with the oldest last use, FIFO the page that entered earliest.
  • Drivers translate common requests into hardware operations; devices report with interrupts. The file system manages names, metadata, and blocks; an opened file is given a file descriptor.
  • The command line suits automation; chmod writes permissions with the weights r = 4, w = 2, x = 1. Authentication answers “who?” and authorization answers “what can they do?”
  • Personal, mobile, server, embedded, and real-time systems have different priorities. The license determines the rights; after support ends, no security updates arrive. A virtual machine gives strong isolation with its own kernel, a container gives lightness with a shared kernel.
Table 2.1.19: Calculation rules used in these notes.
QuestionRuleExample
Turnaround timefinish − arrivalP2 in RR: 9 − 0 = 9 ms
Waiting timeturnaround time − processor timeP2 in RR: 9 − 3 = 6 ms
Base/limitbase + address if address < limit150 < 200 → 100 + 150 = 250
Page and offsetaddress ÷ 4096 and address mod 40964100 → page 1, offset 4
Physical addressframe × 4096 + offset5 × 4096 + 4 = 20484
Disk blockssize ÷ block size, rounded up9 KB, 4 KB block → 3 blocks
chmod digitr = 4, w = 2, x = 1 added uprw- → 6; rw-r--r-- → 644
MBR limit232 sectors × 512 bytes≈ 2.2 TB

2.1.14Key terms

These are the key terms used in this chapter.

  • software
  • system software
  • application software
  • firmware
  • utility
  • middleware
  • operating system
  • boot
  • boot loader
  • boot order
  • UEFI / BIOS
  • power-on self-test (POST)
  • EFI system partition
  • Secure Boot
  • Trusted Platform Module (TPM)
  • partition / partitioning scheme
  • kernel
  • kernel mode / user mode
  • system call
  • interrupt
  • monolithic / micro / hybrid kernel
  • Linux distribution
  • process
  • process ID (PID)
  • thread
  • process state
  • ready queue
  • scheduling / scheduler
  • context switch
  • concurrency
  • multiprogramming
  • time sharing
  • round robin
  • time slice (quantum)
  • Gantt chart
  • deadlock
  • mutual exclusion
  • hold and wait
  • no preemption
  • circular wait
  • swapping / swap space
  • virtual memory
  • virtual address
  • page / frame
  • page table
  • offset
  • memory management unit (MMU)
  • page fault
  • page file
  • page replacement
  • least recently used (LRU)
  • segmentation fault
  • device driver
  • plug and play
  • buffer
  • file system
  • metadata
  • journaling
  • format
  • root / folder / subfolder
  • path / absolute / relative path
  • current directory
  • file descriptor
  • handle
  • end of file
  • graphical user interface (GUI)
  • command-line interface (CLI)
  • permission
  • authentication
  • authorization
  • principle of least privilege
  • sandbox
  • real-time system
  • license
  • open source / closed source
  • update
  • virtualization
  • virtual machine
  • hypervisor
  • guest / host operating system
  • container / container engine
  • dependency

2.1.15Test Yourself

  1. Three processes are ready at t = 0; the order is P1, P2, P3; the times are P1 = 3, P2 = 4, P3 = 1 ms. In round-robin scheduling the time slice is 2 ms. What are the Gantt chart, the finish times, and the number of context switches?

    Answer

    0–2 P1 (1 left), 2–4 P2 (2 left), 4–5 P3 (finishes), 5–6 P1 (finishes), 6–8 P2 (finishes). Finish times: P3 = 5, P1 = 6, P2 = 8 ms. There are 4 context switches. Waiting times are P1 = 6 − 3 = 3, P2 = 8 − 4 = 4, P3 = 5 − 1 = 4 ms.

  2. The page size is 4,096 bytes; the page table: 0 → frame 2, 1 → frame 5, 2 → on disk, 3 → frame 0. Which page and which offset does virtual address 13000 fall in? What is the physical address?

    Answer

    13000 ÷ 4096 = 3, remainder 13000 − 12288 = 712: page 3, offset 712. Page 3 is in frame 0: 0 × 4096 + 712 = 712. Since frame 0 is the very start of RAM, the physical address equals the offset.

  3. A process has 3 frames and requests pages in the order 1, 2, 3, 1, 4, 2, 5. How many page faults occur with LRU and with FIFO?

    Answer

    LRU: 1, 2, 3 fault; 1 hit; 4 faults (2, with the oldest last use, is evicted); 2 faults (3 is evicted); 5 faults (1 is evicted) → 6 faults. FIFO: 1, 2, 3 fault; 1 hit; 4 faults (1, the first in, is evicted); 2 hit; 5 faults (2 is evicted) → 5 faults. On this sequence FIFO does better; LRU is not superior in every case.

  4. Process C has base register 300 and limit register 250 (KB). C tries to access logical addresses 249 and 250. What does the hardware do for each?

    Answer

    Since 249 < 250, the access is valid: physical address 300 + 249 = 549, the last address of C’s region. Since 250 ≥ 250, the access is blocked, an interrupt is raised, and the operating system terminates C with an access violation.

  5. An operating system requires every process to request all the resources it needs at once, before it starts running. Which of the four deadlock conditions is eliminated? What is the cost of this method?

    Answer

    Hold and wait is eliminated: a process either gets everything or waits without getting anything; it never waits for another resource while holding one. The cost is that resources are held even during periods when they are not actually used; for example, a process that needs the printer only at the end of its work keeps the printer busy from the start.

  6. A 10,000-byte file is written to a disk with a block size of 4,096 bytes. How many blocks does the file occupy and how many bytes are wasted?

    Answer

    10000 ÷ 4096 ≈ 2.44; rounded up: 3 blocks. It occupies 3 × 4096 = 12288 bytes of space; 12288 − 10000 = 2288 bytes are wasted.

  7. (a) What are the permissions after chmod 700 anahtar.txt? (b) Which number gives the permission rwxr-xr-x?

    Answer

    (a) 7 = rwx, 0 = ---, 0 = --- → rwx------: only the owner can do everything. (b) rwx = 4 + 2 + 1 = 7, r-x = 4 + 1 = 5, r-x = 5 → 755.

  8. 50 copies of a web application running on the same Linux version are needed. Which is more suitable, a virtual machine or a container? Why?

    Answer

    A container. The application can share the host’s Linux kernel; each copy carries only the application and its libraries, starts in seconds, and uses little memory. 50 virtual machines, on the other hand, mean 50 full operating systems and need much more memory and start-up time.

2.1.16Further reading

  • R. H. Arpaci-Dusseau and A. C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces (Arpaci-Dusseau Books, 2018; free at ostep.org): covers processes, scheduling, virtual memory, and file systems under the headings of virtualization, concurrency, and persistence, in plain language and with plenty of examples.
  • A. Silberschatz, P. B. Galvin, and G. Gagne, Operating System Concepts (10th ed., Wiley, 2018): the standard textbook on operating systems; every topic in these notes, especially scheduling, deadlock, and page replacement, is treated in more detail.
  • A. S. Tanenbaum and H. Bos, Modern Operating Systems (5th ed., Pearson, 2022): examines the internals of Linux, Windows, and Android through case studies; its chapters on kernel types and virtualization are strong.
  • W. Shotts, The Linux Command Line (2nd ed., No Starch Press, 2019): teaches the command line, file permissions, and shell scripts from scratch.

2.1.17References

  1. A. Silberschatz, P. B. Galvin, G. Gagne, Operating System Concepts, Wiley.
  2. A. S. Tanenbaum, H. Bos, Modern Operating Systems, Pearson.
  3. The Linux Foundation and Free Software Foundation license resources.
  4. R. H. Arpaci-Dusseau, A. C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces, Arpaci-Dusseau Books.
  5. E. G. Coffman, M. Elphick, A. Shoshani, “System Deadlocks”, ACM Computing Surveys 3(2), 1971.

Related pages: Slides · Study questions · CPU Scheduling simulator · Glossary · © Sercan Külcü. All rights reserved.