Prof. Dr. Larry AdamsAcademic, Author & Researcher

Chapter 20: Operating Systems and Networks

Operating systems

An operating system (OS) manages hardware and provides services to programs and users. Its main functions are process management, memory management, file management, device management, security, and the user interface. Examples: Windows, Linux, macOS, Android.

Processes. A process is a program in execution. Its states are new, ready, running, waiting (blocked), and terminated. The scheduler decides which ready process runs next. Common algorithms:

AlgorithmRuleRemark
FCFS (first come, first served)In order of arrivalSimple; long jobs delay short ones
SJF (shortest job first)Shortest burst firstMinimises average waiting time but needs burst estimates
Round robinEach process gets a time quantum in turnGood for time-sharing
PriorityHighest priority firstRisk of starvation, solved by aging

Example (round robin, quantum 2): processes P1, P2, P3 arrive at time 0 with burst times 5, 3, 1. Execution: P1 (0–2), P2 (2–4), P3 (4–5), P1 (5–7), P2 (7–8), P1 (8–9). Completion times: P3 = 5, P2 = 8, P1 = 9. Waiting time = completion − burst: P1 = 4, P2 = 5, P3 = 4, so the average is .

Memory management. Memory is divided into pages (and frames in physical memory); virtual memory lets programs use more memory than is physically present by moving pages to disk. Page-replacement algorithms (FIFO, LRU) decide which page to remove. Deadlock occurs when processes wait for each other’s resources. It requires four conditions together: mutual exclusion, hold and wait, no pre-emption, and circular wait; removing any one prevents it. File systems organize data in files and directories with permissions.

Networks

A network connects computers to share data and resources. By size: PAN, LAN, MAN, WAN; the Internet is a network of networks. Topologies: bus, star, ring, mesh. Transmission media: twisted pair, coaxial, fibre optic, and wireless (radio, microwave, infrared, satellite). Devices: hub, switch (forwards by MAC address), router (forwards by IP address), access point, modem, firewall.

Layered models. The OSI model has seven layers (physical, data link, network, transport, session, presentation, application). The TCP/IP model has four (link, internet, transport, application). Each layer provides services to the one above, and data are encapsulated with headers as they go down the stack.

Layer (TCP/IP)RoleExamples
ApplicationUser-level servicesHTTP/HTTPS, SMTP, DNS, FTP, DHCP
TransportEnd-to-end deliveryTCP (reliable, connection-oriented), UDP (fast, connectionless)
InternetAddressing and routingIP, ICMP
LinkDelivery within a networkEthernet, Wi-Fi, MAC addresses

IP addressing and subnetting

An IPv4 address has 32 bits written as four decimal numbers (for example, 192.168.10.0). A subnet mask (or prefix length /n) separates the network and host parts. For a network with prefix length , the number of host addresses is , of which two are reserved (network and broadcast), so usable hosts .

Worked example. Divide 192.168.10.0/24 into four equal subnets. Borrow 2 bits: new prefix /26, mask 255.255.255.192, block size addresses, usable hosts . The subnets are 192.168.10.0 (hosts .1–.62, broadcast .63), .64 (hosts .65–.126, broadcast .127), .128 (.129–.190, broadcast .191), and .192 (.193–.254, broadcast .255). IPv6 uses 128-bit addresses to solve the shortage of IPv4 addresses. DHCP assigns addresses automatically; DNS translates domain names to addresses; NAT lets many private hosts share one public address.

Network security

Key ideas are confidentiality, integrity, and availability (the CIA triad). Threats include malware, phishing, denial of service, and unauthorized access. Defences include firewalls, antivirus software, updates, strong passwords with multi-factor authentication, and encryption. Symmetric encryption uses one shared key (AES); asymmetric encryption uses a public and a private key (RSA) and enables digital signatures; hash functions (SHA-256) check integrity. HTTPS uses TLS to protect web traffic. Users should also understand privacy, data protection laws, and safe online behaviour.

Common mistakes

Forgetting to subtract 2 when counting usable hosts.

Mixing up the functions of switches and routers.

Computing average waiting time from completion time instead of subtracting the burst time.

Practice questions

How many usable host addresses are in a /27 network? [30]

For a /28 subnet, give the mask and block size. [255.255.255.240; 16]

List the four conditions for deadlock.

Explain the difference between TCP and UDP.