Chapter 2.1: Software and Operating Systems

Computer Fundamentals and Introduction to Programming
SoftwareOperating systemResource managementKinds of systemsLicensing
Sercan KÜLCÜ · Giresun University

Introduction

Learning Outcomes

Kinds of software

Tell system software from application software.

Operating system

Explain how the OS sits between the user, applications and hardware.

Resource management

Interpret process, memory, file and device management.

Choosing a system

Compare kinds of operating systems against requirements.

Software

What Is Software?

Software is the set of programs, data and documentation that defines what a computer does.

User need
Algorithm
Program code
Running software
Result
Hardware physically carries out the work; software decides what is done, when, and how.

Software

Software Quality Attributes

Functionality

Does the expected tasks correctly.

Usability

Easy to learn and effective to use.

Performance

Uses time and resources efficiently.

Reliability

Behaves predictably when things go wrong.

Security

Resists unauthorized access and changes.

Maintainability

Fixes and improvements stay manageable.

Software

Software and Hardware

UserApplicationsOperating systemDriversHardwarerequestservice
  • The user only interacts with the top layers.
  • Each layer hides the details below it and offers simpler services to the layer above (abstraction).
  • Thanks to drivers, the same application runs on different hardware.

Requests travel down; results (services) travel back up.

Software

Kinds of Software

System software

Manages the hardware and provides a platform for other software.

Application software

Does specific jobs for the user.

Programming tools

Support writing, translating, testing and debugging code.

Firmware

Embedded software that runs a device's basic functions.

SoftwareSystem softwareoperating system, driverApplication softwarebrowser, word processorProgramming toolscompiler, IDEFirmwareUEFI, router firmware

Software

System and Application Software

TypeExamplesMain purpose
SystemOperating system, driver, utilityManage the computer and its resources
ApplicationWord processor, browser, gameCarry out the user's task
MiddlewareDatabase access layer, message queueHelp applications talk to the system and to each other
Programming toolsCompiler, integrated development environment (IDE), debuggerBuild new software

Operating System

What Is an Operating System?

An operating system is the core system software that manages hardware resources and provides common services to applications.

BrowserWord processorGameOperating systemprocess · memory · file · device · user managementCPURAMDiskNetwork cardapplicationshardware
  • Hides hardware details from applications.
  • Lets several programs share resources safely.
  • Gives the user a graphical or command-line interface.

Operating System

What an Operating System Does

OperatingsystemProcess managementGives running programstheir CPU time.Memory managementGives programs memoryand isolates them.File managementOrganizes data infiles and folders.Device managementRuns peripheralsthrough drivers.User managementAccounts, authenticationand permissions.Network servicesProvides the connectionand communication layer.

Operating System · Step by step

How Does a Computer Start? Booting Step by Step

PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?—In control: user

The power button is pressed; once voltages settle, the power supply sends the motherboard a “power good” signal. RAM is empty; the OS is still sitting on disk.

PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?ROM (motherboard)In control: firmware

The CPU starts running the firmware (UEFI, or the older BIOS) stored in non-volatile memory (ROM/flash) on the motherboard.

PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?ROM (motherboard)In control: firmware

POST (power-on self-test): basic hardware such as memory, keyboard and disk is checked. Errors are reported with beeps or a message.

PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?disk → RAMIn control: boot loader

The boot order from the settings is tried (e.g. USB first, then SSD); missing devices are skipped. The boot loader (e.g. Windows Boot Manager: bootmgfw.efi, or GRUB) is loaded into RAM from the small EFI system partition (FAT32) on the disk.

PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?disk → RAMIn control: OS kernel

The boot loader loads the kernel into RAM (on Windows, ntoskrnl.exe via winload.efi) and hands over control. The kernel loads drivers and starts the first processes and system services.

PowerbuttonFirmwareUEFI / BIOSPOSThardware testBoot loaderdisk → RAMKerneldrivers, servicesSign-indesktopWhere is the running code?RAMIn control: operating system

The sign-in screen appears; once the user is authenticated, their desktop and startup apps open.

Operating System · Security

Secure Boot and TPM

UEFI firmware✓Boot loader✓Kernel✓Operating systemTPM 2.0: each stage is measured · if measurements match, the BitLocker key is released
UEFI

Modern firmware that replaces BIOS: large disks, fast startup and signature checking.

Secure Boot

Only a boot loader and kernel with a trusted digital signature may run; forged or tampered boot code is blocked.

TPM 2.0

A security chip (on the motherboard, in the CPU or in firmware) that stores encryption keys and boot measurements; used by tools such as BitLocker.

Windows 11

Requires UEFI with Secure Boot and TPM 2.0 to install; see Microsoft's current requirements page for details.

There are two partitioning schemes. MBR: goes with BIOS, disks up to 2 TB, at most 4 primary partitions. GPT: goes with UEFI, disks over 2 TB, many partitions.

OS Components

The Kernel

The kernel is the privileged core of the operating system. Applications don't touch the hardware directly; they ask the kernel for services through system calls.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmtMemory mgmtFile systemDevice driversHardwareCPURAMDisk
A bug in the kernel can bring down the whole system, which is why access control and isolation matter.

OS Components · Step by step

A System Call Step by Step: Reading a File

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmtMemory mgmtFile systemDevice driversHardwareCPURAMDisk

A text editor wants to read report.txt. It cannot access the disk itself, so it makes the read system call.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmtMemory mgmtFile systemDevice driversHardwareCPURAMDisk

The CPU switches from user mode to kernel mode. Now only kernel code runs.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmtMemory mgmtFile systemDevice driversHardwareCPURAMDisk

The file system finds where the file lives on disk and checks that the user has read permission.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmtMemory mgmtFile systemDevice driversHardwareCPURAMDisk

The disk driver sends a read command to the disk. When the disk is done, it notifies the CPU with an interrupt.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmtMemory mgmtFile systemDevice driversHardwareCPURAMDisk

Memory management: the kernel copies the data into the editor's own memory area in RAM.

User modeText editorBrowsersystem call interfaceKernel mode (privileged)KernelProcess mgmtMemory mgmtFile systemDevice driversHardwareCPURAMDisk

The call returns and the CPU switches back to user mode. The editor shows the data. The application never touched the hardware.

OS Components

Kinds of Kernels

TypeIdeaExample
Monolithic kernelProcesses, memory, file system and drivers all in one privileged kernel; fast but largeLinux (loadable modules)
MicrokernelOnly the essentials in the kernel; drivers and file system run in user mode; strong isolationMINIX 3, QNX
Hybrid kernelStarts from a microkernel design but keeps some services in the kernel for speedWindows NT kernel, macOS/iOS (XNU)
ApplicationsAndroid framework and runtimeLinux kernelHardware

The Android stack

Linux is just a kernel; a Linux distribution is the kernel plus tools plus a desktop. Android uses the Linux kernel, but the layers above it are Android's own.

Resource Management

Process Management

Program

Instructions and data stored on disk.

Process

A running instance of a program.

Thread

A flow of execution inside a process.

Scheduling

Decides which process gets the CPU and when.

Context switch

Moves the CPU state from one process to another.

Concurrency

Lets several jobs make progress together.

Process P1Op. systemProcess P2P1 runsP2 runsP1 resumestimecontext switchcontext switchsave P1load P2save P2load P1

Resource Management

Program, Process and Thread

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

A program is a file sitting on disk; a process is a running instance of it, identified by a process ID (PID). Each process has its own memory space, while threads share the memory of their process.

Resource Management

Process States

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaiting
  • On a single core, only one process is Running at a time; the other ready processes wait their turn.
  • A Waiting process never gets the CPU; when the event it waits for (disk, keyboard, network) happens, it becomes Ready again.

Resource Management · Step by step

Process State Transitions Step by Step

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Process P1 is being created (e.g. the user double-clicked a program): state New.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

New → Ready: the OS admits the process; memory is allocated and it joins the ready queue.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Ready → Running: the scheduler picks P1; its context is loaded and the CPU executes P1's instructions.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Running → Waiting: P1 asks for data from the disk. Rather than hold the CPU idle until it arrives, it moves to Waiting.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Waiting → Ready: the disk is done (an interrupt arrives). P1 doesn't run right away; it goes back to the Ready queue first.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Ready → Running: when its turn comes, P1 is picked again and continues where it left off.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Running → Ready: P1's time slice is up; a timer interrupt gives the CPU to another process.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Ready → Running: P1 is picked again and runs the rest of its work.

admittedscheduler dispatchtimeout (interrupt)waits for I/O or eventwait overexitNewReadyRunningTerminatedWaitingP1

Running → Terminated: P1 finishes and exits; the OS reclaims its memory and resources.

Resource Management · Step by step

Two Processes, One CPU: Tracing States

CPUDisk0123456789ms

Two processes, one core. P1 will compute for 3 ms, read from disk (3 ms), then compute 2 ms more. P2 just computes for 4 ms. Both are Ready; the scheduler picks P1.

CPUDisk0123456789msP1

t = 0–3: P1 is Running; P2 waits in the ready queue.

CPUDisk0123456789msP1

t = 3: P1 asks to read from disk (a system call). The disk is slow, so P1 goes to Waiting and gives up the CPU. Context switch.

CPUDisk0123456789msP1P2P1 I/O

t = 3–6: P2 is Running while the disk reads P1's data. CPU and disk work in parallel.

CPUDisk0123456789msP1P2P1 I/O

t = 6: the disk finishes and signals with an interrupt. P1 becomes Ready but doesn't run yet: P2 has the CPU.

CPUDisk0123456789msP1P2P1 I/OP2

t = 7: P2 completes its 4 ms and is Terminated. Only P1 is left in the ready queue.

CPUDisk0123456789msP1P2P1 I/OP2P1

t = 7–9: P1 is Running; it finishes its last 2 ms and is Terminated.

CPUDisk0123456789msP1P2P1 I/OP2P1

Total: 9 ms, and the CPU was never idle. Had the CPU sat idle while P1 waited for the disk, it would have taken 3 + 3 + 2 + 4 = 12 ms. Running another process during I/O (multiprogramming) saves time.

P1: compute 3 ms
P1: read disk (I/O 3 ms)
P1: compute 2 ms, exit
P2: compute 4 ms, exit

Resource Management · Step by step

Time Sharing: Round-Robin CPU Allocation

CPU timeline (Gantt)012345678910msReady queue:P1P2P3Time left:P1: 5P2: 3P3: 2

Three processes are ready: P1 needs 5 ms, P2 3 ms, P3 2 ms. Round-robin scheduling gives each one at most 2 ms in turn.

CPU timeline (Gantt)P1012345678910msReady queue:P2P3P1Time left:P1: 3P2: 3P3: 2

t = 0–2: the CPU runs P1. Its time slice expires; P1 goes to the back of the queue (3 ms left). Context switch.

CPU timeline (Gantt)P1P2012345678910msReady queue:P3P1P2Time left:P1: 3P2: 1P3: 2

t = 2–4: the CPU runs P2. Its time slice expires; P2 goes to the back of the queue (1 ms left). Context switch.

CPU timeline (Gantt)P1P2P3012345678910msReady queue:P1P2Time left:P1: 3P2: 1P3: 0 (done t=6)

t = 4–6: the CPU runs P3. P3 finishes (t = 6) and leaves the system.

CPU timeline (Gantt)P1P2P3P1012345678910msReady queue:P2P1Time left:P1: 1P2: 1P3: 0 (done t=6)

t = 6–8: the CPU runs P1. Its time slice expires; P1 goes to the back of the queue (1 ms left). Context switch.

CPU timeline (Gantt)P1P2P3P1P2012345678910msReady queue:P1Time left:P1: 1P2: 0 (done t=9)P3: 0 (done t=6)

t = 8–9: the CPU runs P2. P2 finishes (t = 9) and leaves the system.

CPU timeline (Gantt)P1P2P3P1P2P1012345678910msReady queue:idleTime left:P1: 0 (done t=10)P2: 0 (done t=9)P3: 0 (done t=6)

t = 9–10: the CPU runs P1. P1 finishes (t = 10) and leaves the system. Completion: P3 = 6, P2 = 9, P1 = 10 ms. Because switches are fast, all three seem to run “at the same time”.

Resource Management · Step by step

Deadlock

Process AProcess BPrinterFileholdssolid arrow: process holds the resource · dashed arrow: process waits for it

Process A has acquired the printer and is using it (solid arrow).

Process AProcess BPrinterFileholdsholdssolid arrow: process holds the resource · dashed arrow: process waits for it

Process B has locked the file and is using it.

Process AProcess BPrinterFileholdsholdswantssolid arrow: process holds the resource · dashed arrow: process waits for it

Process A wants the file without releasing the printer (dashed arrow); B has the file, so A waits.

Process AProcess BPrinterFileholdsholdswantswantssolid arrow: process holds the resource · dashed arrow: process waits for it

Process B wants the printer without releasing the file; A has the printer, so B waits.

Process AProcess BPrinterFileholdsholdswantswantscycle = deadlocksolid arrow: process holds the resource · dashed arrow: process waits for it

A → File → B → Printer → A: a circular wait. Neither lets go, so both wait forever: deadlock.

Mutual exclusion one owner
Hold and wait waits while holding
No preemption can't be taken away
Circular wait forms a ring
All four conditions are needed. One fix: everyone requests resources in the same order (printer first, then file), so no circular wait can form.

Resource Management

Memory Management

Allocation

Gives each program the memory it needs.

Protection

Stops one process from changing another's memory.

Virtual memory

Gives programs an address space independent of physical RAM.

Paging

Manages memory in fixed-size pieces.

Swapping

Moves some data to disk temporarily when needed.

Sharing

Lets processes share code or data.

Resource Management · Step by step

Memory Management Step by Step: Allocation, Protection, Swapping

RAM (640 KB)Disk (swap space)Operatingsystemfree 540 KB0100640Base / limit registers: no user process yetThe start of RAM is reserved for the kernel; the rest is free.

Start: the operating system (kernel) sits at the start of RAM; the rest is free.

RAM (640 KB)Disk (swap space)OperatingsystemProcess A200 KBfree 340 KB0100300640Process A → base = 100, limit = 200Base: start of the region. Limit: its length (KB).

Allocation: 200 KB from 100 to 300 is set aside for A. In this simple model a region is described by base and limit registers (real systems use paging).

RAM (640 KB)Disk (swap space)OperatingsystemProcess A200 KBProcess B150 KBfree 190 KB0100300450640A: base = 100, limit = 200 B: base = 300, limit = 150Each process has its own region; regions never overlap.

B gets 150 KB from 300 to 450. Each process has its own register pair; the OS loads it on every switch.

RAM (640 KB)Disk (swap space)OperatingsystemProcess A200 KBProcess B150 KBfree 190 KB0100300450640150 → 100 + 150 = 250 ✓A is running and asks for logical address 150150 < limit (200) → physical address = base + 150 = 250 ✓

Valid access: A's address 150 is below the limit (200), so the hardware goes to physical address base + 150 = 250.

RAM (640 KB)Disk (swap space)OperatingsystemProcess A200 KBProcess B150 KBfree 190 KB0100300450640250 → 100 + 250 = 350 ✗ (B's area)A is running and asks for logical address 250250 ≥ limit (200) → violation ✗: hardware trap, access blocked

Protection fault: A asks for 250; since 250 ≥ 200, the hardware blocks the access and control passes to the kernel. A real system would kill A with an “access violation / segmentation fault”; in the example A's region stays put. B's memory is safe.

RAM (640 KB)Disk (swap space)Process B (150 KB)OperatingsystemProcess A200 KBfree 340 KB (B left)0100300640swap: B written to diskNew process C needs 250 KB; largest free block is 190 KBB is waiting → written to disk (swap out); 150 KB more is freed.

Swapping: there is no room for C (190 KB < 250 KB). The waiting process B is written to disk, leaving 340 KB of contiguous free RAM. Disk is far slower than RAM.

RAM (640 KB)Disk (swap space)Process B (150 KB)OperatingsystemProcess A200 KBProcess C250 KBfree 90 KB0100300550640Process C → base = 300, limit = 250B waits on disk; it is loaded back when it runs (swap in).

C is loaded at 300–550. B waits on disk and is brought back into RAM when it runs again; if there is no room, some other process is swapped out.

Resource Management

Virtual Memory and Paging

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
  • Each process sees its own virtual address space starting at 0; memory is split into 4 KB pages, and a page table records which frame holds each page.
  • Pages need not be contiguous in RAM; rarely used pages can be moved out to disk (swapped).
  • The swap area is called the page file on Windows and swap on Linux and macOS. Reading from disk (SSD ≈ 0.1 ms) is orders of magnitude slower than RAM (50–100 ns); heavy swapping makes a computer noticeably slow.

Resource Management · Step by step

Address Translation Step by Step: 4100 and 8200

Virtual address4100Page table (Process A)0frame 21frame 52on disk (absent)3frame 0RAM0: A31: B02: A03: free4: B15: A1Disk (swap)

Process A wants to read the data at virtual address 4100. The CPU's memory management unit (MMU) has to translate it.

Virtual address4100page 1+44100 = 1×4096 + 4Page table (Process A)0frame 21frame 52on disk (absent)3frame 0RAM0: A31: B02: A03: free4: B15: A1Disk (swap)

The address splits in two: page = 4100 / 4096 = 1, offset = 4100 mod 4096 = 4.

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

Table: page 1 → frame 5. Physical address = 5 × 4096 + 4 = 20484.

Virtual address8200Page table (Process A)0frame 21frame 52on disk (absent)3frame 0RAM0: A31: B02: A03: free4: B15: A1Disk (swap)

Process A wants to read the data at virtual address 8200. The CPU's memory management unit (MMU) has to translate it.

Virtual address8200page 2+88200 = 2×4096 + 8Page table (Process A)0frame 21frame 52on disk (absent)3frame 0RAM0: A31: B02: A03: free4: B15: A1Disk (swap)

The address splits in two: page = 8200 / 4096 = 2, offset = 8200 mod 4096 = 8.

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

The table says page 2 is not in RAM → page fault. The program is paused and the OS steps in.

Virtual address8200page 2+88200 = 2×4096 + 8Page table (Process A)0frame 21frame 52frame 33frame 0RAM0: A31: B02: A03: A24: B15: A1Disk (swap)

The OS loads the page from disk into free frame 3 and updates the page table.

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

Table: page 2 → frame 3. Physical address = 3 × 4096 + 8 = 12296. The instruction is restarted and succeeds this time.

Resource Management · Step by step

Page Replacement (LRU) Step by Step

requests70120304frames

The process has only 3 frames in RAM and requests pages in the order 7, 0, 1, 2, 0, 3, 0, 4. When RAM is full, which page goes to disk? The LRU (least recently used) rule.

requests70120304framespage 7last used: request 1page fault

Page 7 is not in RAM → page fault; there is a free frame, so it is loaded there from disk.

requests70120304framespage 7last used: request 1page 0last used: request 2page fault

Page 0 is not in RAM → page fault; there is a free frame, so it is loaded there from disk.

requests70120304framespage 7last used: request 1page 0last used: request 2page 1last used: request 3page fault

Page 1 is not in RAM → page fault; there is a free frame, so it is loaded there from disk.

requests70120304framespage 2last used: request 4page 0last used: request 2page 1last used: request 3evicted: page 7page fault

Page 2 is missing → page fault; no free frame. Page 7 was used longest ago → evict it, load 2.

requests70120304framespage 2last used: request 4page 0last used: request 5page 1last used: request 3hit

Page 0 is already in RAM → hit; only its last-use time is updated.

requests70120304framespage 2last used: request 4page 0last used: request 5page 3last used: request 6evicted: page 1page fault

Page 3 is missing → page fault; no free frame. Page 1 was used longest ago → evict it, load 3.

requests70120304framespage 2last used: request 4page 0last used: request 7page 3last used: request 6hit

Page 0 is already in RAM → hit; only its last-use time is updated.

requests70120304framespage 4last used: request 8page 0last used: request 7page 3last used: request 6evicted: page 2page fault

Page 4 is missing → page fault; no free frame. Page 2 was used longest ago → evict it, load 4.

requests70120304framespage 4last used: request 8page 0last used: request 7page 3last used: request 6

6 page faults in 8 requests. FIFO (first in, first out) gives 7 faults on the same string: it evicts the busy page 0 too when its turn comes. Every fault means a slow disk read.

page in RAM?  Yes → hit
No → page fault
  free frame?  Yes → load
  No → evict least recent, load

Resource Management

Devices and Drivers

Hardware devices differ in their commands and features. A device driver translates the OS's generic requests into device-specific operations.

Application“print”, “display”Operating systemcommon interfacePrinter driverPrinterGraphics driverGraphics cardUSB driverUSB flash driveinterrupt: “done / data ready”
Plug and play

Detects a compatible device and sets up the right driver.

Interrupt

A device signals an event to the CPU.

Buffer

Holds data temporarily between parts running at different speeds.

Resource Management

File System

A file system defines how data on a storage device is named, organized and found.

File

A unit of data with a name and contents.

Folder

Groups files and subfolders.

Path

Gives a file's location in the folder tree.

Metadata

Properties such as size, date, owner and permissions.

Permissions

Read, write and execute rights.

Journaling

Helps keep things consistent after a crash or power loss.

report.txtfolder entryMetadatasize: 9 KBmodified: 10.10.2026owner: ayse · perm: rw-blocks: 12, 13, 40Disk blocks (4 KB)891011121314154041424344454647⋮9 KB → 3 blocks (12 KB used)

Resource Management

Kinds of File Systems

File systemPlatformJournalingWhen to use it
NTFSWindows (macOS read-only)YesWindows system drive; when you need large files, permissions or encryption
FAT32Almost every device and OSNoOlder devices, cameras, simple memory cards; 4 GB maximum file size
exFATWindows, macOS and recent LinuxNoUSB drives and SD cards with large files; moving data across platforms
ext4LinuxYesLinux system and data disks
APFSmacOS, iOS, iPadOSNo classic journal; copy-on-write keeps it consistentDefault file system on Apple devices
Example: a 5 GB video cannot be copied to a FAT32 USB drive; the drive must be formatted as exFAT or NTFS (formatting erases its contents).

Resource Management

The File System Tree and Paths

/binetchomeaysealidocumentsreport.txtnotes.txtpicturestmp
/home/ali/documents/report.txt
  • A file system is a tree: the root at the top, folders as branches, files as leaves.
  • An absolute path starts at the root; a relative path starts at the current folder (from ali: documents/report.txt).
  • Windows writes the same idea with a drive letter: C:\Users\Ali\Documents\report.txt.

Resource Management · Step by step

Opening and Reading a File Step by Step

file descriptor table0standard input1standard output2standard error3path resolution/homealireport.txtreport.txt (150 bytes)0100150

The editor makes the open system call. The kernel resolves the path one piece at a time, starting at the root folder /.

file descriptor table0standard input1standard output2standard error3path resolution/homealireport.txtreport.txt (150 bytes)0100150

It looks for home in the root, then for ali inside it. Each folder is a list of the names it contains and where they live on disk.

file descriptor table0standard input1standard output2standard error3path resolution/homealireport.txtreport.txt (150 bytes)0100150

report.txt is found in ali. The metadata says: size 150 bytes; does the user have read permission? Yes. (Otherwise open returns an error and the file stays closed.)

file descriptor table0standard input1standard output2standard error3report.txt, offset 0path resolution/homealireport.txtreport.txt (150 bytes)offset 00100150

The kernel creates an open-file entry and gives the process the lowest free number: fd = 3. Numbers 0, 1 and 2 are always open in every process for standard input, output and error.

file descriptor table0standard input1standard output2standard error3report.txt, offset 100path resolution/homealireport.txtreport.txt (150 bytes)offset 1000100150

read asks for 100 bytes; bytes 0–99 are read, n = 100. The offset moves to 100 on its own; the application never sees addresses, only the fd.

file descriptor table0standard input1standard output2standard error3report.txt, offset 150path resolution/homealireport.txtreport.txt (150 bytes)offset 1500100150

Again 100 bytes are requested, but only 50 are left: n = 50, offset 150.

file descriptor table0standard input1standard output2standard error3report.txt, offset 150path resolution/homealireport.txtreport.txt (150 bytes)offset 1500100150

The third read returns n = 0: end of file. The program stops reading here.

file descriptor table0standard input1standard output2standard error3path resolution/homealireport.txtreport.txt (150 bytes)0100150

close: the entry is removed and number 3 is free again. The OS closes any files left open when the process ends, but a long-running program can run out of descriptors. Windows calls the same idea a handle.

fd = open("/home/ali/report.txt", O_RDONLY)
n = read(fd, buf, 100)
n = read(fd, buf, 100)
n = read(fd, buf, 100)
close(fd)

OS Components

User Interfaces

Command PromptC:\> dir report.docx notes.txtC:\> copy report.docx E:\ 1 file(s) copied.C:\> _File Explorerreportnotespictures
GUI (graphical user interface)

Windows, icons, menus and a mouse.

CLI

Text commands: fast, repeatable, easy to automate.

Touch interface

Taps, swipes and gestures.

Accessibility

Screen reader, magnifier, high contrast.

OS Components

Command-Line Basics

TaskLinux / macOSWindows (cmd)
Show current folderpwdcd (no arguments)
List folder contentslsdir
Change foldercd foldercd folder
Create foldermkdir newmkdir new
Copy filecp a.txt b.txtcopy a.txt b.txt
Delete filerm a.txtdel a.txt
chmod permission format

For each of three groups, add r=4 (read), w=2 (write), x=1 (execute): owner · group · others.

chmod 644 file
6 = rw- (owner) · 4 = r-- (group) · 4 = r-- (others)

ownerr14w12-014+2 = 6groupr14-02-014othersr14-02-014permbitvaluesum
rm and del don't send files to the Recycle Bin; check the path and name before you run them.

Security

Users and Permissions

User1 · Authentication“Who?” password, PIN, biometrics2 · Authorization“What can they do?” permissions, account type✓ own files✗ system settingwritten to the event log
  • A standard account limits system changes in everyday use; an administrator account can make system-wide changes.
  • Least privilege: give users only the rights their job needs.
  • Logging lets important events be reviewed later.
  • In the example, a standard user can open their own file but cannot change a system setting.

Kinds of Operating Systems

Personal Computer Systems

Windows

Huge hardware and software ecosystem.

macOS

Desktop system integrated with Apple hardware.

Linux distributions

Systems tailored to different desktops and uses.

ChromeOS

Built around web and cloud use.

Kinds of Operating Systems

Mobile Operating Systems

Android

A broad mobile ecosystem running on many makers' devices.

iOS / iPadOS

Integrated system for Apple mobile devices.

Mobile priorities

Touch interface, power management, sensors and wireless connectivity.

App isolation

Limits what apps can reach with permissions and sandboxes.

Mapssandbox · own dataNotepadsandbox · own dataGamesandbox · own data✕✕asks for locationasks for contactsPermission check (OS) · user consentLocationCameraMicrophoneContactsallowed ✓denied ✕

Kinds of Operating Systems

Server Operating Systems

Multi-user operation

Serves many users and services at once.

Network services

Provides web, database, file and identity services.

Availability

Built to run for long periods without interruption and be managed remotely.

Security

Permissions, logging, updates and network control come first.

Examples

Linux distributions, Windows Server and Unix variants.

Automation

Repeatable administration with the command line and configuration tools.

BrowserMobile appOffice PCrequestrequestrequestServer operating systemWeb serviceDatabaseFile sharingAuthenticationmulti-user · always on · logging and permissions

Kinds of Operating Systems

Embedded and Real-Time Systems

Embedded operating system

Runs a specific device task with limited CPU, memory and power.

Examples: router, car control unit, medical device.

Real-time operating system

Must deliver the right result within a set deadline.

Examples: industrial control and safety systems.

System A6 mson time ✓System B14 mslate: counts as failure ✗deadline: 10 mst = 0: brake signal

Kinds of Operating Systems

Choosing an Operating System

RequirementWhat to evaluate
ApplicationWhether the required software and versions are available
HardwareDriver and architecture support
SecurityUpdate lifetime, permission model and management tools
UsabilityInterface, accessibility and learning curve
CostLicensing, support, training and maintenance combined

Licensing

Open-Source Software

Source code

Can be studied under the license terms.

Modification

Can be adapted to your needs if the license allows.

Distribution

Sharing original or modified versions depends on the license.

Community

Development and support can come from individuals, institutions and companies.

Study the sourceModifyDistribute / shareContribute backimproved version returns to all · the license sets the terms of each step
Open source doesn't automatically mean free of charge or unsupported. The license defines the rights and obligations.

Licensing

Commercial and Closed-Source Software

Right of use

You don't buy the software itself; usually you get a license to use it under certain terms.

Source code

Usually kept closed by the developer.

Support

Official support and service-level agreements may be offered.

Cost

There may be license, subscription, maintenance and upgrade fees.

vendor (source code closed)Source codesecretCompileProgram (.exe)+ license agreementUserright to usepurchase / subscription

Licensing

Comparing License Models

CriterionOpen sourceProprietary (closed source)
Source accessOpen under the licenseUsually closed
CustomizationPossible within the licenseLimited to the vendor's options
SupportCommunity or paid providerVendor or authorized partner
CostLicense may be free; running costs remainLicense or subscription may be required
Example licenseGPL, MIT, ApacheEnd-user license agreement (EULA)
Example productLinux, Firefox, LibreOfficeWindows, Microsoft Office, Adobe Photoshop
Not every free program is open source; the license terms are what count. Commercial and open source are separate dimensions: commercial products such as Red Hat Enterprise Linux can be open source too.

Maintenance

Updates and Support

Security update

Closes known vulnerabilities.

Feature update

Brings new functions and interface changes.

Driver update

Can improve hardware compatibility or stability.

Support lifecycle

The period during which the vendor ships updates.

Backup

Makes major changes reversible.

Testing

In organizations, updates are tested before wide rollout.

support period: vendor ships updatesend of supportno updatesholes stay openreleasetimesecurity updatefeature updatee.g. Windows 10: 14 October 2025

Operating System

Virtualization and Containers

Virtual machine

Runs isolated operating system instances on one physical computer.

Hypervisor

Gives virtual machines CPU, memory and device resources.

Container

Isolates applications and their dependencies at the process level; shares the kernel.

Uses

Testing, server consolidation, cloud and portable app deployment.

Operating System

Virtual Machines vs Containers

Virtual machinesHardwareHypervisorGuest OS 1Guest OS 2Guest OS 3librarieslibrarieslibrariesApp 1App 2App 3ContainersHardwareHost operating system (one kernel)Container enginelibrarieslibrarieslibrariesApp 1App 2App 3
Virtual machine

Carries a full guest OS: strong isolation, but more memory and slower startup.

Container

Just the app and its dependencies on a shared kernel: light and fast, weaker isolation.

Summary

Chapter Summary

  • Software defines the work the hardware carries out.
  • The operating system is a management and abstraction layer between applications and hardware.
  • The kernel manages process, memory, device and file resources.
  • Personal, mobile, server, embedded and real-time systems have different priorities.
  • Choosing an OS means weighing applications, hardware, security, support and total cost together.
  • The license sets the rights for open and closed source.

Summary

Review Questions

  1. What is the difference between system software and application software?
  2. Why does the kernel run in privileged mode?
  3. How do a program and a process differ?
  4. What problem does virtual memory solve?
  5. How do the priorities of server and mobile operating systems differ?
  6. Why isn't open-source software always free of charge?

Summary

Exercises

  1. Round-robin scheduling, time slice 2 ms: P1 = 4, P2 = 2, P3 = 3 ms. Draw the Gantt chart and find each process's completion time.
  2. Page size is 4096 bytes. Which page and offset does virtual address 12300 fall in? If page 3 is in frame 1, what is the physical address?
  3. What state is a process in while it waits for keyboard input? Which state does it move to when a key is pressed, and then which? Show the transitions on the diagram.
  4. Why won't a modified boot loader run when Secure Boot is on? Explain using the signature checks in the chain of trust.
  5. For a test setup that needs both Windows and Linux, would you choose virtual machines or containers? Explain in terms of kernel sharing.
  6. Walk through an application writing to a file, step by step: system call, kernel mode, file system, disk driver.

Summary

References

  • Silberschatz, Galvin and Gagne, Operating System Concepts.
  • Tanenbaum and Bos, Modern Operating Systems.
  • License resources from The Linux Foundation and the Free Software Foundation.

The End

Chapter 2.1: Software and Operating Systems
Previous: Chapter 1.5: Computation and Computational Thinking · Next: Chapter 2.2: The Windows Operating System
1 / 1Sercan KÜLCÜ. All rights reserved.