How unit 1 is examined
This unit covers what an OS is and does, how it evolved, its types, its services and system calls; types, services and system calls carry most marks.
Function
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Medium weight</span>
Definition. <mark>An operating system is system software that acts as an intermediary between the user and the computer hardware, managing all resources and providing a convenient, efficient environment for running programs.</mark>
Key points.
- The OS is a resource manager: it allocates the CPU, memory, files and I/O devices among competing programs fairly and efficiently.
- It is an extended machine: it hides the ugly hardware details behind simple abstractions such as files, processes and windows.
- It is a control program: it supervises execution of user programs to prevent errors and improper use of the computer.
- Process management creates, schedules and ends processes; memory management allocates and reclaims RAM; file management stores and protects named files (example: saving a document); device management drives I/O through drivers (example: printing); protection and security stop unauthorised access (example: a password login); the user interface accepts commands (example: a shell or GUI).
- The primary goals are convenience for the user, efficiency of the hardware, and the ability to evolve without disturbing services.
- User goals are ease of use, reliability, speed and safety; system goals are easy design and maintenance, flexibility and efficient use of resources.
Example. A disk has tracks and sectors, but the OS shows the user named files and folders.
Diagram.
<figure class="ds-fig" style="margin:1.4rem 0;overflow-x:auto"><svg xmlns="http://www.w3.org/2000/svg" id="dsfig-u1-01" viewBox="0 0 87 338" width="87" height="338" role="img" aria-label="Layers of a computer system: user, application programs, operating system, hardware"><style>#dsfig-u1-01 .e{stroke:#454C5A;stroke-width:1.4;fill:none}#dsfig-u1-01 .e.hi{stroke:#2340B8;stroke-width:2.6}#dsfig-u1-01 .n{fill:#FFFFFF;stroke:#16181D;stroke-width:1.4}#dsfig-u1-01 .n.hi{fill:#E3E9FC;stroke:#2340B8;stroke-width:2.2}#dsfig-u1-01 .n.rb-b{fill:#16181D;stroke:#16181D}#dsfig-u1-01 .n.rb-r{fill:#BD3227;stroke:#BD3227}#dsfig-u1-01 text{font-family:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;font-size:13px}#dsfig-u1-01 .t{fill:#16181D;font-weight:500}#dsfig-u1-01 .t.inv{fill:#FFFFFF;font-weight:700}#dsfig-u1-01 .kd{stroke:#16181D;stroke-width:1.2}#dsfig-u1-01 .dot{fill:#16181D}#dsfig-u1-01 .ann{fill:#2340B8;font-size:11px;font-weight:700}#dsfig-u1-01 .lbl{fill:#6F7787;font-family:system-ui,-apple-system,sans-serif;font-size:12px;font-weight:700}#dsfig-u1-01 .ptr{fill:#2340B8;font-size:12px;font-weight:700}#dsfig-u1-01 .ah{fill:#454C5A}#dsfig-u1-01 .ah.hi{fill:#2340B8}#dsfig-u1-01 .wl rect{fill:#FFFFFF;stroke:#DCE0E7}#dsfig-u1-01 .wl .t{font-size:12px;font-weight:700}#dsfig-u1-01 .wl.hi rect{fill:#2340B8;stroke:#2340B8}#dsfig-u1-01 .wl.hi .t{fill:#FFFFFF}html.dark #dsfig-u1-01 .e{stroke:#B1B7C3}html.dark #dsfig-u1-01 .e.hi{stroke:#8FA3FF}html.dark #dsfig-u1-01 .n{fill:#161920;stroke:#E6E8ED}html.dark #dsfig-u1-01 .n.hi{fill:#1E2748;stroke:#8FA3FF}html.dark #dsfig-u1-01 .n.rb-b{fill:#E6E8ED;stroke:#E6E8ED}html.dark #dsfig-u1-01 .n.rb-r{fill:#FF7E71;stroke:#FF7E71}html.dark #dsfig-u1-01 .t{fill:#E6E8ED}html.dark #dsfig-u1-01 .t.inv{fill:#0F1115}html.dark #dsfig-u1-01 .kd{stroke:#E6E8ED}html.dark #dsfig-u1-01 .dot{fill:#E6E8ED}html.dark #dsfig-u1-01 .ann{fill:#8FA3FF}html.dark #dsfig-u1-01 .lbl{fill:#858D9C}html.dark #dsfig-u1-01 .ptr{fill:#8FA3FF}html.dark #dsfig-u1-01 .ah{fill:#B1B7C3}html.dark #dsfig-u1-01 .ah.hi{fill:#8FA3FF}html.dark #dsfig-u1-01 .wl rect{fill:#161920;stroke:#2A2E37}html.dark #dsfig-u1-01 .wl.hi rect{fill:#8FA3FF;stroke:#8FA3FF}html.dark #dsfig-u1-01 .wl.hi .t{fill:#0F1115}</style><defs><marker id="ah1" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah" d="M0,1 L9,5 L0,9 z"/></marker><marker id="ahh1" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah hi" d="M0,1 L9,5 L0,9 z"/></marker></defs><path class="e" d="M40,66 L40,105" marker-end="url(#ah1)"/><path class="e" d="M40,145 L40,191" marker-end="url(#ah1)"/><path class="e" d="M40,231 L40,277" marker-end="url(#ah1)"/><g class="wl"><rect x="19.6" y="74" width="40.8" height="18" rx="9"/><text class="t" x="40" y="83" dy=".35em" text-anchor="middle">runs</text></g><g class="wl"><rect x="16.5" y="160" width="47.1" height="18" rx="9"/><text class="t" x="40" y="169" dy=".35em" text-anchor="middle">calls</text></g><g class="wl"><rect x="5.6" y="246" width="68.7" height="18" rx="9"/><text class="t" x="40" y="255" dy=".35em" text-anchor="middle">controls</text></g><rect class="n" x="15" y="25" width="50" height="30" rx="15"/><text class="t" x="40" y="40" dy=".35em" text-anchor="middle">User</text><circle class="n" cx="40" cy="126" r="18"/><text class="t" x="40" y="126" dy=".35em" text-anchor="middle">App</text><circle class="n" cx="40" cy="212" r="18"/><text class="t" x="40" y="212" dy=".35em" text-anchor="middle">OS</text><circle class="n" cx="40" cy="298" r="18"/><text class="t" x="40" y="298" dy=".35em" text-anchor="middle">HW</text></svg><figcaption style="font-size:.82em;opacity:.72;margin-top:.45rem">Layers of a computer system: user, application programs, operating system, hardware</figcaption></figure>
Answer frame. Open with the definition; redraw the layered box; develop points 1-4 then goals 5-6; close by saying the OS makes the machine both easy to use and efficiently used.
Asked: [7 marks] (Jun 2023, Jun 2025) Define an operating system. What are the goals of an operating system? List the functions of OS. How does the operating system perform management tasks in a system?
Evolution
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Medium weight</span>
Definition. <mark>Evolution of operating systems is the progression from bare machines with no OS to modern multitasking, networked and mobile systems, driven by the need for better CPU use, convenience and resource management.</mark>
Key points.
- Serial processing (1940s-50s): the programmer operated the machine directly with switches and card decks, so setup time was long and the CPU sat idle.
- Batch systems (1950s-60s): similar jobs were grouped into a batch and run one after another by a resident monitor, a small program permanently in memory that automatically loads and starts the next job, cutting setup time but leaving the CPU idle during I/O.
- Spooling (Simultaneous Peripheral Operations On-Line) overlaps I/O with computation by copying input from cards to disk and output to a disk queue before printing, so the slow printer and card reader no longer stall the CPU.
- Multiprogramming (mid-1960s, IBM OS/360, 1964): several jobs are kept in memory and the CPU switches to another when one waits for I/O, raising CPU utilisation.
- Time-sharing (1960s-70s, CTSS 1961, Multics, UNIX 1969): the CPU is switched among users so rapidly that each gets an interactive response.
- Personal computer OS (1980s): single-user, GUI-driven systems such as MS-DOS (1981) and Windows put convenience ahead of utilisation.
- Parallel systems (1980s-90s) use several CPUs sharing memory; distributed systems (1990s) use networked computers acting as one; real-time systems guarantee response deadlines.
- Mobile OS (2007 onward) such as iOS (2007) and Android (2008) add touch interfaces, power management and app sandboxing; modern OS characteristics are resource management, concurrency, protection, portability and security.
Diagram.
<figure class="ds-fig" style="margin:1.4rem 0;overflow-x:auto"><svg xmlns="http://www.w3.org/2000/svg" id="dsfig-u1-02" viewBox="0 0 596 80" width="596" height="80" role="img" aria-label="Evolution timeline: serial, batch, multiprogramming, time-sharing, PC, distributed, mobile"><style>#dsfig-u1-02 .e{stroke:#454C5A;stroke-width:1.4;fill:none}#dsfig-u1-02 .e.hi{stroke:#2340B8;stroke-width:2.6}#dsfig-u1-02 .n{fill:#FFFFFF;stroke:#16181D;stroke-width:1.4}#dsfig-u1-02 .n.hi{fill:#E3E9FC;stroke:#2340B8;stroke-width:2.2}#dsfig-u1-02 .n.rb-b{fill:#16181D;stroke:#16181D}#dsfig-u1-02 .n.rb-r{fill:#BD3227;stroke:#BD3227}#dsfig-u1-02 text{font-family:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;font-size:13px}#dsfig-u1-02 .t{fill:#16181D;font-weight:500}#dsfig-u1-02 .t.inv{fill:#FFFFFF;font-weight:700}#dsfig-u1-02 .kd{stroke:#16181D;stroke-width:1.2}#dsfig-u1-02 .dot{fill:#16181D}#dsfig-u1-02 .ann{fill:#2340B8;font-size:11px;font-weight:700}#dsfig-u1-02 .lbl{fill:#6F7787;font-family:system-ui,-apple-system,sans-serif;font-size:12px;font-weight:700}#dsfig-u1-02 .ptr{fill:#2340B8;font-size:12px;font-weight:700}#dsfig-u1-02 .ah{fill:#454C5A}#dsfig-u1-02 .ah.hi{fill:#2340B8}#dsfig-u1-02 .wl rect{fill:#FFFFFF;stroke:#DCE0E7}#dsfig-u1-02 .wl .t{font-size:12px;font-weight:700}#dsfig-u1-02 .wl.hi rect{fill:#2340B8;stroke:#2340B8}#dsfig-u1-02 .wl.hi .t{fill:#FFFFFF}html.dark #dsfig-u1-02 .e{stroke:#B1B7C3}html.dark #dsfig-u1-02 .e.hi{stroke:#8FA3FF}html.dark #dsfig-u1-02 .n{fill:#161920;stroke:#E6E8ED}html.dark #dsfig-u1-02 .n.hi{fill:#1E2748;stroke:#8FA3FF}html.dark #dsfig-u1-02 .n.rb-b{fill:#E6E8ED;stroke:#E6E8ED}html.dark #dsfig-u1-02 .n.rb-r{fill:#FF7E71;stroke:#FF7E71}html.dark #dsfig-u1-02 .t{fill:#E6E8ED}html.dark #dsfig-u1-02 .t.inv{fill:#0F1115}html.dark #dsfig-u1-02 .kd{stroke:#E6E8ED}html.dark #dsfig-u1-02 .dot{fill:#E6E8ED}html.dark #dsfig-u1-02 .ann{fill:#8FA3FF}html.dark #dsfig-u1-02 .lbl{fill:#858D9C}html.dark #dsfig-u1-02 .ptr{fill:#8FA3FF}html.dark #dsfig-u1-02 .ah{fill:#B1B7C3}html.dark #dsfig-u1-02 .ah.hi{fill:#8FA3FF}html.dark #dsfig-u1-02 .wl rect{fill:#161920;stroke:#2A2E37}html.dark #dsfig-u1-02 .wl.hi rect{fill:#8FA3FF;stroke:#8FA3FF}html.dark #dsfig-u1-02 .wl.hi .t{fill:#0F1115}</style><defs><marker id="ah2" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah" d="M0,1 L9,5 L0,9 z"/></marker><marker id="ahh2" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah hi" d="M0,1 L9,5 L0,9 z"/></marker></defs><path class="e" d="M59,40 L105,40" marker-end="url(#ah2)"/><path class="e" d="M145,40 L191,40" marker-end="url(#ah2)"/><path class="e" d="M231,40 L277,40" marker-end="url(#ah2)"/><path class="e" d="M317,40 L363,40" marker-end="url(#ah2)"/><path class="e" d="M403,40 L449,40" marker-end="url(#ah2)"/><path class="e" d="M489,40 L535,40" marker-end="url(#ah2)"/><circle class="n" cx="40" cy="40" r="18"/><text class="t" x="40" y="40" dy=".35em" text-anchor="middle">Ser</text><circle class="n" cx="126" cy="40" r="18"/><text class="t" x="126" y="40" dy=".35em" text-anchor="middle">Bat</text><circle class="n" cx="212" cy="40" r="18"/><text class="t" x="212" y="40" dy=".35em" text-anchor="middle">MP</text><circle class="n" cx="298" cy="40" r="18"/><text class="t" x="298" y="40" dy=".35em" text-anchor="middle">TS</text><circle class="n" cx="384" cy="40" r="18"/><text class="t" x="384" y="40" dy=".35em" text-anchor="middle">PC</text><circle class="n" cx="470" cy="40" r="18"/><text class="t" x="470" y="40" dy=".35em" text-anchor="middle">Dis</text><circle class="n" cx="556" cy="40" r="18"/><text class="t" x="556" y="40" dy=".35em" text-anchor="middle">Mob</text></svg><figcaption style="font-size:.82em;opacity:.72;margin-top:.45rem">Evolution timeline: serial, batch, multiprogramming, time-sharing, PC, distributed, mobile</figcaption></figure>
Answer frame. Open by defining an OS and why it had to evolve; redraw the timeline arrow serial - batch/spooling - multiprogramming - time-sharing - PC - distributed/real-time - mobile; develop points 1-8 in that order; close with the goals of efficiency, convenience and resource management.
Asked: [7 marks] (Nov 2023, Jun 2026) Explain the evolution of operating system in detail. Explain the evolution and characteristics of modern operating systems.
Different Types
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">High weight</span>
Definition. <mark>Operating systems are classified by how they schedule jobs and serve users: batch, multiprogramming, time-sharing, real-time, network and distributed.</mark>
Key points.
- Batch processing groups similar jobs and runs them without user interaction; merits are high throughput and no operator idle time, demerits are no interaction, long turnaround and CPU idle in I/O. Example: IBM OS/360, payroll runs.
- Multiprogramming keeps many jobs in memory so the CPU never idles while one job waits for I/O; it needs memory management and CPU scheduling. Example: IBM OS/360 (MFT/MVT), and later UNIX and Windows.
- Time-sharing (multitasking) gives each user a small time slice or quantum on the CPU in round-robin fashion, so many users get quick interactive responses; its features are interactive terminals, a timer interrupt, round-robin scheduling, swapping and protection between users; its advantages are reduced idle time and good response, its demerits are overhead and security issues. Example: UNIX, Linux. 3a. Multiprogramming vs multitasking: multiprogramming switches jobs only when one waits for I/O, to keep the CPU busy; multitasking (time-sharing) switches on a timer slice, to give quick response.
- Real-time systems must respond within a fixed deadline: hard real-time (missile control, VxWorks) never misses it, soft real-time (video streaming) tolerates small misses.
- Network OS runs on a server and lets clients share files, printers and users over a LAN, while each machine stays independent and aware of the network; types are peer-to-peer and client-server. Example: Windows Server, Novell NetWare.
- Distributed OS makes a group of computers appear as a single system, sharing load and resources transparently; it gives speed and reliability. Example: LOCUS, Amoeba. 6a. Parallel OS runs on several CPUs sharing memory to finish one job faster (example: Linux on multicore SMP); embedded OS is a small fixed-function OS inside a device (example: FreeRTOS in a washing machine); mobile OS adds touch, battery management and app sandboxing (example: Android, iOS).
- Worm vs virus: a virus attaches to a host program or file and runs only when that host is executed, spreading when infected files are shared (example: ILOVEYOU 2000, spread as a mail attachment and overwrote files); a worm is a standalone program that copies itself across networks by exploiting security holes, needing no host (example: Morris worm 1988, which slowed about 6,000 Internet machines by consuming CPU and memory). Damage: viruses corrupt or delete files, worms exhaust bandwidth and CPU. Prevention: antivirus software, timely patches, a firewall, no unknown attachments, least privilege and backups.
- Demand paging (a lazy pager) brings a page into memory only when it is referenced. The page table has a valid/invalid bit per page: 1 means the page is in memory, 0 means it is on disk or illegal. Pure demand paging starts a process with no pages in memory, so its first instruction faults.
- Page-fault handling: (1) the CPU references a page and the valid bit is 0, causing a trap to the OS; (2) the OS checks an internal table and finds the reference legal but the page on disk; (3) it finds a free frame; (4) it schedules a disk read of the page into that frame; (5) it updates the page table with the frame number and valid bit 1; (6) the instruction restarts and now succeeds. If no frame is free, page replacement (FIFO, LRU, optimal) picks a victim page to write out first if it is modified.
- Effective access time: $EAT = (1-p)\times ma + p\times \text{fault time}$, where $p$ is the fault rate and $ma$ the memory access time. Example: $ma = 200$ ns, fault service 8 ms, $p = 1/1000$ gives $0.999\times200 + 0.001\times 8{,}000{,}000 = 8199.8$ ns, about 41 times slower than 200 ns. With 1 KB pages, logical address 3172 is page 3, offset 100; if page 3 is in frame 7 the physical address is $7\times1024+100 = 7268$.
<figure class="ds-fig" style="margin:1.4rem 0;overflow-x:auto"><svg xmlns="http://www.w3.org/2000/svg" id="dsfig-u1-03" viewBox="0 0 467 252" width="467" height="252" role="img" aria-label="Page fault: reference, invalid bit traps to OS, page read from disk into a free frame, table updated, instruction restarted"><style>#dsfig-u1-03 .e{stroke:#454C5A;stroke-width:1.4;fill:none}#dsfig-u1-03 .e.hi{stroke:#2340B8;stroke-width:2.6}#dsfig-u1-03 .n{fill:#FFFFFF;stroke:#16181D;stroke-width:1.4}#dsfig-u1-03 .n.hi{fill:#E3E9FC;stroke:#2340B8;stroke-width:2.2}#dsfig-u1-03 .n.rb-b{fill:#16181D;stroke:#16181D}#dsfig-u1-03 .n.rb-r{fill:#BD3227;stroke:#BD3227}#dsfig-u1-03 text{font-family:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;font-size:13px}#dsfig-u1-03 .t{fill:#16181D;font-weight:500}#dsfig-u1-03 .t.inv{fill:#FFFFFF;font-weight:700}#dsfig-u1-03 .kd{stroke:#16181D;stroke-width:1.2}#dsfig-u1-03 .dot{fill:#16181D}#dsfig-u1-03 .ann{fill:#2340B8;font-size:11px;font-weight:700}#dsfig-u1-03 .lbl{fill:#6F7787;font-family:system-ui,-apple-system,sans-serif;font-size:12px;font-weight:700}#dsfig-u1-03 .ptr{fill:#2340B8;font-size:12px;font-weight:700}#dsfig-u1-03 .ah{fill:#454C5A}#dsfig-u1-03 .ah.hi{fill:#2340B8}#dsfig-u1-03 .wl rect{fill:#FFFFFF;stroke:#DCE0E7}#dsfig-u1-03 .wl .t{font-size:12px;font-weight:700}#dsfig-u1-03 .wl.hi rect{fill:#2340B8;stroke:#2340B8}#dsfig-u1-03 .wl.hi .t{fill:#FFFFFF}html.dark #dsfig-u1-03 .e{stroke:#B1B7C3}html.dark #dsfig-u1-03 .e.hi{stroke:#8FA3FF}html.dark #dsfig-u1-03 .n{fill:#161920;stroke:#E6E8ED}html.dark #dsfig-u1-03 .n.hi{fill:#1E2748;stroke:#8FA3FF}html.dark #dsfig-u1-03 .n.rb-b{fill:#E6E8ED;stroke:#E6E8ED}html.dark #dsfig-u1-03 .n.rb-r{fill:#FF7E71;stroke:#FF7E71}html.dark #dsfig-u1-03 .t{fill:#E6E8ED}html.dark #dsfig-u1-03 .t.inv{fill:#0F1115}html.dark #dsfig-u1-03 .kd{stroke:#E6E8ED}html.dark #dsfig-u1-03 .dot{fill:#E6E8ED}html.dark #dsfig-u1-03 .ann{fill:#8FA3FF}html.dark #dsfig-u1-03 .lbl{fill:#858D9C}html.dark #dsfig-u1-03 .ptr{fill:#8FA3FF}html.dark #dsfig-u1-03 .ah{fill:#B1B7C3}html.dark #dsfig-u1-03 .ah.hi{fill:#8FA3FF}html.dark #dsfig-u1-03 .wl rect{fill:#161920;stroke:#2A2E37}html.dark #dsfig-u1-03 .wl.hi rect{fill:#8FA3FF;stroke:#8FA3FF}html.dark #dsfig-u1-03 .wl.hi .t{fill:#0F1115}</style><defs><marker id="ah3" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah" d="M0,1 L9,5 L0,9 z"/></marker><marker id="ahh3" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah hi" d="M0,1 L9,5 L0,9 z"/></marker></defs><path class="e" d="M57,48.4 Q104.5,72 150.2,49.3" marker-end="url(#ah3)"/><path class="e" d="M188,40 L277,40" marker-end="url(#ah3)"/><path class="e" d="M317,40 L406,40" marker-end="url(#ah3)"/><path class="e" d="M415.6,55.2 L310.6,195.2" marker-end="url(#ah3)"/><path class="e" d="M286.6,196.8 L181.6,56.8" marker-end="url(#ah3)"/><path class="e" d="M152,31.6 Q104.5,8 58.8,30.7" marker-end="url(#ah3)"/><g class="wl"><rect x="87.3" y="51.4" width="33.6" height="18" rx="9"/><text class="t" x="104.1" y="60.4" dy=".35em" text-anchor="middle">ref</text></g><g class="wl"><rect x="213.1" y="31" width="40.8" height="18" rx="9"/><text class="t" x="233.5" y="40" dy=".35em" text-anchor="middle">trap</text></g><g class="wl"><rect x="342.1" y="31" width="40.8" height="18" rx="9"/><text class="t" x="362.5" y="40" dy=".35em" text-anchor="middle">read</text></g><g class="wl"><rect x="342.1" y="117" width="40.8" height="18" rx="9"/><text class="t" x="362.5" y="126" dy=".35em" text-anchor="middle">load</text></g><g class="wl"><rect x="206.4" y="117" width="54.3" height="18" rx="9"/><text class="t" x="233.5" y="126" dy=".35em" text-anchor="middle">update</text></g><g class="wl"><rect x="81.4" y="10.6" width="47.1" height="18" rx="9"/><text class="t" x="104.9" y="19.6" dy=".35em" text-anchor="middle">retry</text></g><circle class="n" cx="40" cy="40" r="18"/><text class="t" x="40" y="40" dy=".35em" text-anchor="middle">CPU</text><circle class="n" cx="169" cy="40" r="18"/><text class="t" x="169" y="40" dy=".35em" text-anchor="middle">PT</text><circle class="n" cx="298" cy="40" r="18"/><text class="t" x="298" y="40" dy=".35em" text-anchor="middle">OS</text><circle class="n" cx="427" cy="40" r="18"/><text class="t" x="427" y="40" dy=".35em" text-anchor="middle">Dsk</text><circle class="n" cx="298" cy="212" r="18"/><text class="t" x="298" y="212" dy=".35em" text-anchor="middle">Mem</text></svg><figcaption style="font-size:.82em;opacity:.72;margin-top:.45rem">Page fault: reference, invalid bit traps to OS, page read from disk into a free frame, table updated, instruction restarted</figcaption></figure>
<figure class="ds-fig" style="margin:1.4rem 0;overflow-x:auto"><svg xmlns="http://www.w3.org/2000/svg" id="dsfig-u1-04" viewBox="0 0 949 134" width="949" height="134" role="img" aria-label="Types of operating system"><style>#dsfig-u1-04 .e{stroke:#454C5A;stroke-width:1.4;fill:none}#dsfig-u1-04 .e.hi{stroke:#2340B8;stroke-width:2.6}#dsfig-u1-04 .n{fill:#FFFFFF;stroke:#16181D;stroke-width:1.4}#dsfig-u1-04 .n.hi{fill:#E3E9FC;stroke:#2340B8;stroke-width:2.2}#dsfig-u1-04 .n.rb-b{fill:#16181D;stroke:#16181D}#dsfig-u1-04 .n.rb-r{fill:#BD3227;stroke:#BD3227}#dsfig-u1-04 text{font-family:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;font-size:13px}#dsfig-u1-04 .t{fill:#16181D;font-weight:500}#dsfig-u1-04 .t.inv{fill:#FFFFFF;font-weight:700}#dsfig-u1-04 .kd{stroke:#16181D;stroke-width:1.2}#dsfig-u1-04 .dot{fill:#16181D}#dsfig-u1-04 .ann{fill:#2340B8;font-size:11px;font-weight:700}#dsfig-u1-04 .lbl{fill:#6F7787;font-family:system-ui,-apple-system,sans-serif;font-size:12px;font-weight:700}#dsfig-u1-04 .ptr{fill:#2340B8;font-size:12px;font-weight:700}#dsfig-u1-04 .ah{fill:#454C5A}#dsfig-u1-04 .ah.hi{fill:#2340B8}#dsfig-u1-04 .wl rect{fill:#FFFFFF;stroke:#DCE0E7}#dsfig-u1-04 .wl .t{font-size:12px;font-weight:700}#dsfig-u1-04 .wl.hi rect{fill:#2340B8;stroke:#2340B8}#dsfig-u1-04 .wl.hi .t{fill:#FFFFFF}html.dark #dsfig-u1-04 .e{stroke:#B1B7C3}html.dark #dsfig-u1-04 .e.hi{stroke:#8FA3FF}html.dark #dsfig-u1-04 .n{fill:#161920;stroke:#E6E8ED}html.dark #dsfig-u1-04 .n.hi{fill:#1E2748;stroke:#8FA3FF}html.dark #dsfig-u1-04 .n.rb-b{fill:#E6E8ED;stroke:#E6E8ED}html.dark #dsfig-u1-04 .n.rb-r{fill:#FF7E71;stroke:#FF7E71}html.dark #dsfig-u1-04 .t{fill:#E6E8ED}html.dark #dsfig-u1-04 .t.inv{fill:#0F1115}html.dark #dsfig-u1-04 .kd{stroke:#E6E8ED}html.dark #dsfig-u1-04 .dot{fill:#E6E8ED}html.dark #dsfig-u1-04 .ann{fill:#8FA3FF}html.dark #dsfig-u1-04 .lbl{fill:#858D9C}html.dark #dsfig-u1-04 .ptr{fill:#8FA3FF}html.dark #dsfig-u1-04 .ah{fill:#B1B7C3}html.dark #dsfig-u1-04 .ah.hi{fill:#8FA3FF}html.dark #dsfig-u1-04 .wl rect{fill:#161920;stroke:#2A2E37}html.dark #dsfig-u1-04 .wl.hi rect{fill:#8FA3FF;stroke:#8FA3FF}html.dark #dsfig-u1-04 .wl.hi .t{fill:#0F1115}</style><defs><marker id="ah4" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah" d="M0,1 L9,5 L0,9 z"/></marker><marker id="ahh4" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah hi" d="M0,1 L9,5 L0,9 z"/></marker></defs><line class="e" x1="460.5" y1="39" x2="43.5" y2="103"/><line class="e" x1="460.5" y1="39" x2="134.5" y2="103"/><line class="e" x1="460.5" y1="39" x2="253" y2="103"/><line class="e" x1="460.5" y1="39" x2="371.5" y2="103"/><line class="e" x1="460.5" y1="39" x2="470.5" y2="103"/><line class="e" x1="460.5" y1="39" x2="577" y2="103"/><line class="e" x1="460.5" y1="39" x2="687.5" y2="103"/><line class="e" x1="460.5" y1="39" x2="786.5" y2="103"/><line class="e" x1="460.5" y1="39" x2="877.5" y2="103"/><circle class="n" cx="460.5" cy="39" r="17"/><text class="t" x="460.5" y="39" dy=".35em" text-anchor="middle">OS</text><rect class="n" x="14" y="88" width="59" height="30" rx="8"/><text class="t" x="43.5" y="103" dy=".35em" text-anchor="middle">Batch</text><rect class="n" x="89" y="88" width="91" height="30" rx="8"/><text class="t" x="134.5" y="103" dy=".35em" text-anchor="middle">Multiprog</text><rect class="n" x="196" y="88" width="114" height="30" rx="8"/><text class="t" x="253" y="103" dy=".35em" text-anchor="middle">Time-sharing</text><rect class="n" x="326" y="88" width="91" height="30" rx="8"/><text class="t" x="371.5" y="103" dy=".35em" text-anchor="middle">Real-time</text><rect class="n" x="433" y="88" width="75" height="30" rx="8"/><text class="t" x="470.5" y="103" dy=".35em" text-anchor="middle">Network</text><rect class="n" x="524" y="88" width="106" height="30" rx="8"/><text class="t" x="577" y="103" dy=".35em" text-anchor="middle">Distributed</text><rect class="n" x="646" y="88" width="83" height="30" rx="8"/><text class="t" x="687.5" y="103" dy=".35em" text-anchor="middle">Parallel</text><rect class="n" x="745" y="88" width="83" height="30" rx="8"/><text class="t" x="786.5" y="103" dy=".35em" text-anchor="middle">Embedded</text><rect class="n" x="844" y="88" width="67" height="30" rx="8"/><text class="t" x="877.5" y="103" dy=".35em" text-anchor="middle">Mobile</text></svg><figcaption style="font-size:.82em;opacity:.72;margin-top:.45rem">Types of operating system</figcaption></figure>
Comparison.
| Basis | Batch | Time-sharing | Real-time |
|---|---|---|---|
| User interaction | None | Interactive | Event-driven |
| Goal | Throughput | Response time | Meeting deadlines |
| Example | OS/360 | UNIX | VxWorks |
Security (Jun 2024). Two problems are unauthorised access to another user's files or memory, and data leakage or denial of service by a user hogging the CPU. Concrete mechanisms are authentication (passwords, biometrics), memory protection (base and limit registers, so a process cannot address outside its region), and access-control lists that name which users may read, write or execute each file. Dedicated vs time-shared: a dedicated machine has one user at a time, so there is no other user to leak data to, no shared memory or disk and no competing CPU use; a time-shared machine has many users at once sharing memory, files and CPU, so every sharing path is a possible leak. Further leaks are covert channels (users signal by modulating CPU load) and side channels (timing or cache behaviour reveals data); defences are encryption and virtual-memory isolation, where each process has its own page table. Base/limit check: base 3000, limit 1200; address 500 is legal (3500) but 1500 exceeds the limit, so hardware traps. Hence a shared machine can approach the security of a dedicated one but never equal it; the mechanisms above only reduce the risk.
Answer frame. Open with the classification; for "types" write points 1-6 with one example each; for a short note define, give features, merits and demerits, and an example; for worms give example, spread, damage and prevention; for demand paging give points 8-9 with the valid-bit table; for the security question give two problems, the protection mechanisms, and the conclusion that equal security is not possible.
Asked: [7 marks] (Jun 2020, Jun 2023, Nov 2023) Write short notes (any two): i) Time sharing ii) Network iii) Batch processing Asked: [7 marks] (May 2019) Discuss different types of operating system with examples of each. Asked: [14 marks] (Nov 2023) Write short notes: a) Worms and Virus b) Demand paging c) Batch processing d) Time-sharing Asked: [3 marks] (Jun 2023) Write short notes: Time Sharing Asked: [7 marks] (Jun 2024) In a multiprogramming and time sharing environment several users share the system simultaneously, which can cause security problems. i) What are two such problems? ii) Can we ensure the same degree of security in a time shared machine as in a dedicated machine? Explain.
Desirable Characteristics and features of an O/S
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Low weight</span>
Definition. <mark>Desirable characteristics are the qualities a good OS should have beyond basic resource management.</mark>
Key points.
- Reliability: the OS must keep working correctly and recover from errors without crashing the machine.
- Protection and security: one user or program must not be able to damage another or the OS itself.
- Efficiency: it must use CPU, memory and devices with minimum overhead and give good throughput.
- Portability and extensibility: it should run on different hardware and accept new features and drivers easily.
- Convenience: a simple user interface and fair, predictable sharing of resources.
- Goals: these qualities serve the three OS goals, convenience for the user, efficiency of the hardware and ability to evolve.
Asked: [7 marks] (May 2019) What is an operating system? Write down its desirable characteristics.
Operating Systems Services: Types of Services
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">High weight</span>
Definition. <mark>Operating system services are the functions the OS offers to programs and users to make execution and use of the computer convenient and efficient.</mark>
Key points.
- User interface: a command line, GUI or batch interface through which the user controls the system; its purpose is easy interaction.
- Program execution: the OS loads a program into memory, runs it, and ends it normally or abnormally; its purpose is to run user code.
- I/O operations: user programs cannot control devices directly, so the OS performs I/O on their behalf, for safety and simplicity.
- File-system manipulation: creating, deleting, reading, writing, searching files and managing permissions, for permanent storage.
- Communication: processes exchange information through shared memory or message passing, on one machine or across a network, to cooperate.
- Error detection: the OS detects errors in CPU, memory, devices or programs and takes suitable action, for correct computing.
- Resource allocation and protection: it shares CPU, memory and devices among users and controls access, for fairness and security.
- Accounting: it records which users use how much CPU time, memory and I/O, for billing and usage statistics.
- User view vs system view: the user sees the services as convenience (ease of use, quick response); the system sees them as resource management (fair, efficient allocation).
Process management (5 activities). A process is a program in execution, with its own code, data, stack and registers.
- Creation and deletion of user and system processes (fork creates, exit or kill deletes).
- Suspension and resumption: a process is suspended (blocked or swapped out) when it waits or memory is short, and resumed when the event occurs.
- Synchronisation: semaphores and mutex locks let cooperating processes use shared data one at a time, avoiding race conditions.
- Communication: shared memory or message passing between processes.
- Deadlock handling: prevention, avoidance, detection and recovery, so that processes do not wait forever for each other's resources. Supporting topic, scheduling: long-term admits jobs, short-term picks the next ready process, medium-term swaps out; algorithms are FCFS, SJF, priority and round robin. States. New, Ready, Running, Waiting, Terminated: admitted (New to Ready), dispatch (Ready to Running), timeout (Running to Ready), I/O wait (Running to Waiting), I/O done (Waiting to Ready), exit (Running to Terminated). The PCB (process control block) holds the state, program counter, CPU registers, scheduling information, memory limits, I/O status and process ID; the OS saves and restores it at every context switch.
<figure class="ds-fig" style="margin:1.4rem 0;overflow-x:auto"><svg xmlns="http://www.w3.org/2000/svg" id="dsfig-u1-05" viewBox="0 0 467 252" width="467" height="252" role="img" aria-label="Process state diagram: New, Ready, Running, Waiting, Terminated"><style>#dsfig-u1-05 .e{stroke:#454C5A;stroke-width:1.4;fill:none}#dsfig-u1-05 .e.hi{stroke:#2340B8;stroke-width:2.6}#dsfig-u1-05 .n{fill:#FFFFFF;stroke:#16181D;stroke-width:1.4}#dsfig-u1-05 .n.hi{fill:#E3E9FC;stroke:#2340B8;stroke-width:2.2}#dsfig-u1-05 .n.rb-b{fill:#16181D;stroke:#16181D}#dsfig-u1-05 .n.rb-r{fill:#BD3227;stroke:#BD3227}#dsfig-u1-05 text{font-family:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;font-size:13px}#dsfig-u1-05 .t{fill:#16181D;font-weight:500}#dsfig-u1-05 .t.inv{fill:#FFFFFF;font-weight:700}#dsfig-u1-05 .kd{stroke:#16181D;stroke-width:1.2}#dsfig-u1-05 .dot{fill:#16181D}#dsfig-u1-05 .ann{fill:#2340B8;font-size:11px;font-weight:700}#dsfig-u1-05 .lbl{fill:#6F7787;font-family:system-ui,-apple-system,sans-serif;font-size:12px;font-weight:700}#dsfig-u1-05 .ptr{fill:#2340B8;font-size:12px;font-weight:700}#dsfig-u1-05 .ah{fill:#454C5A}#dsfig-u1-05 .ah.hi{fill:#2340B8}#dsfig-u1-05 .wl rect{fill:#FFFFFF;stroke:#DCE0E7}#dsfig-u1-05 .wl .t{font-size:12px;font-weight:700}#dsfig-u1-05 .wl.hi rect{fill:#2340B8;stroke:#2340B8}#dsfig-u1-05 .wl.hi .t{fill:#FFFFFF}html.dark #dsfig-u1-05 .e{stroke:#B1B7C3}html.dark #dsfig-u1-05 .e.hi{stroke:#8FA3FF}html.dark #dsfig-u1-05 .n{fill:#161920;stroke:#E6E8ED}html.dark #dsfig-u1-05 .n.hi{fill:#1E2748;stroke:#8FA3FF}html.dark #dsfig-u1-05 .n.rb-b{fill:#E6E8ED;stroke:#E6E8ED}html.dark #dsfig-u1-05 .n.rb-r{fill:#FF7E71;stroke:#FF7E71}html.dark #dsfig-u1-05 .t{fill:#E6E8ED}html.dark #dsfig-u1-05 .t.inv{fill:#0F1115}html.dark #dsfig-u1-05 .kd{stroke:#E6E8ED}html.dark #dsfig-u1-05 .dot{fill:#E6E8ED}html.dark #dsfig-u1-05 .ann{fill:#8FA3FF}html.dark #dsfig-u1-05 .lbl{fill:#858D9C}html.dark #dsfig-u1-05 .ptr{fill:#8FA3FF}html.dark #dsfig-u1-05 .ah{fill:#B1B7C3}html.dark #dsfig-u1-05 .ah.hi{fill:#8FA3FF}html.dark #dsfig-u1-05 .wl rect{fill:#161920;stroke:#2A2E37}html.dark #dsfig-u1-05 .wl.hi rect{fill:#8FA3FF;stroke:#8FA3FF}html.dark #dsfig-u1-05 .wl.hi .t{fill:#0F1115}</style><defs><marker id="ah5" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah" d="M0,1 L9,5 L0,9 z"/></marker><marker id="ahh5" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah hi" d="M0,1 L9,5 L0,9 z"/></marker></defs><path class="e" d="M59,40 L148,40" marker-end="url(#ah5)"/><path class="e" d="M186,48.4 Q233.5,72 279.2,49.3" marker-end="url(#ah5)"/><path class="e" d="M281,31.6 Q233.5,8 187.8,30.7" marker-end="url(#ah5)"/><path class="e" d="M298,59 L298,191" marker-end="url(#ah5)"/><path class="e" d="M286.6,196.8 L181.6,56.8" marker-end="url(#ah5)"/><path class="e" d="M317,40 L406,40" marker-end="url(#ah5)"/><g class="wl"><rect x="81" y="31" width="47.1" height="18" rx="9"/><text class="t" x="104.5" y="40" dy=".35em" text-anchor="middle">admit</text></g><g class="wl"><rect x="198.7" y="51.4" width="68.7" height="18" rx="9"/><text class="t" x="233.1" y="60.4" dy=".35em" text-anchor="middle">dispatch</text></g><g class="wl"><rect x="203.2" y="10.6" width="61.5" height="18" rx="9"/><text class="t" x="233.9" y="19.6" dy=".35em" text-anchor="middle">timeout</text></g><g class="wl"><rect x="263.7" y="117" width="68.7" height="18" rx="9"/><text class="t" x="298" y="126" dy=".35em" text-anchor="middle">I/O-wait</text></g><g class="wl"><rect x="199.2" y="117" width="68.7" height="18" rx="9"/><text class="t" x="233.5" y="126" dy=".35em" text-anchor="middle">I/O-done</text></g><g class="wl"><rect x="342.1" y="31" width="40.8" height="18" rx="9"/><text class="t" x="362.5" y="40" dy=".35em" text-anchor="middle">exit</text></g><circle class="n" cx="40" cy="40" r="18"/><text class="t" x="40" y="40" dy=".35em" text-anchor="middle">New</text><circle class="n" cx="169" cy="40" r="18"/><text class="t" x="169" y="40" dy=".35em" text-anchor="middle">Rdy</text><circle class="n" cx="298" cy="40" r="18"/><text class="t" x="298" y="40" dy=".35em" text-anchor="middle">Run</text><circle class="n" cx="298" cy="212" r="18"/><text class="t" x="298" y="212" dy=".35em" text-anchor="middle">Wt</text><circle class="n" cx="427" cy="40" r="18"/><text class="t" x="427" y="40" dy=".35em" text-anchor="middle">End</text></svg><figcaption style="font-size:.82em;opacity:.72;margin-top:.45rem">Process state diagram: New, Ready, Running, Waiting, Terminated</figcaption></figure>
Memory management (5 activities). 1. Tracking which parts of memory are used and by whom. 2. Deciding which processes to load when space is free. 3. Allocating and deallocating memory space. 4. Protecting one process's memory from another. 5. Swapping, paging and segmentation to run programs larger than memory. Allocation and deallocation. Contiguous allocation gives each process one block; the OS picks a free hole by first fit (first hole big enough), best fit (smallest hole big enough) or worst fit (largest hole), and deallocation returns the block to the free list and merges neighbouring holes. External fragmentation is scattered free holes too small to use (cured by compaction); internal fragmentation is unused space inside an allocated block. Swapping. A process is moved from memory to a backing-store disk when memory is short and brought back later, so total process size can exceed RAM. Paging. Physical memory is split into fixed frames and the program into equal pages; a page table maps each page to a frame, so memory need not be contiguous and external fragmentation vanishes, but internal fragmentation remains in the last page. A page-table entry holds the frame number, valid bit, protection bits and dirty bit. Segmentation. The program is split into variable-size logical segments (code, data, stack); a segment table entry holds each base and limit, matching the user's view of the program.
Role of system calls. Programs request each of these services through system calls, which are the interface to the kernel and let the OS control CPU, memory, devices and protection. Calls such as fork and exec make the OS allocate a CPU slot and memory to the new process, malloc or brk requests more memory, and exit frees both; because a program can obtain resources only through these calls, the OS decides who gets the CPU and memory. Example: fork() creates a child process with its own memory, and write(fd, buf, n) asks the kernel to send buf to a file or screen.
Answer frame. Open by defining services from the user's and the system's view; list the services in the order above with one sentence each; for process or memory management write only the five activities with a line on each; close by linking services to system calls.
Asked: [7 marks] (Nov 2019, Jun 2026) What are the various services provided by Operating system? Asked: [7 marks] (Jun 2024) What are the five major activities of an operating system in regards to process management? Asked: [7 marks] (Jun 2025) What are the five major activities of an operating system in regards to memory management? Asked: [7 marks] (Jun 2026) Discuss operating system services and the role of system calls in resource management.
Different ways of providing these Services – Utility Programs
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Utility (system) programs are programs supplied with the OS that give users a convenient environment for common tasks, beyond the kernel.</mark>
Key points.
- They include file management (copy, delete), status information (date, disk space), file editors, and programming-language support such as compilers.
- They also cover program loading and execution (loaders, debuggers) and communication tools.
- Most users see the OS through these programs and the shell, not through system calls.
- Services are thus provided either through system calls or through system programs built on top of them.
System Calls
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">High weight</span>
Definition. <mark>A system call is the programmatic interface through which a user program requests a service from the operating system kernel.</mark>
Diagram.
<figure class="ds-fig" style="margin:1.4rem 0;overflow-x:auto"><svg xmlns="http://www.w3.org/2000/svg" id="dsfig-u1-06" viewBox="0 0 474 80" width="474" height="80" role="img" aria-label="System call path: application, library wrapper, trap into kernel mode, kernel service, return to user mode"><style>#dsfig-u1-06 .e{stroke:#454C5A;stroke-width:1.4;fill:none}#dsfig-u1-06 .e.hi{stroke:#2340B8;stroke-width:2.6}#dsfig-u1-06 .n{fill:#FFFFFF;stroke:#16181D;stroke-width:1.4}#dsfig-u1-06 .n.hi{fill:#E3E9FC;stroke:#2340B8;stroke-width:2.2}#dsfig-u1-06 .n.rb-b{fill:#16181D;stroke:#16181D}#dsfig-u1-06 .n.rb-r{fill:#BD3227;stroke:#BD3227}#dsfig-u1-06 text{font-family:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;font-size:13px}#dsfig-u1-06 .t{fill:#16181D;font-weight:500}#dsfig-u1-06 .t.inv{fill:#FFFFFF;font-weight:700}#dsfig-u1-06 .kd{stroke:#16181D;stroke-width:1.2}#dsfig-u1-06 .dot{fill:#16181D}#dsfig-u1-06 .ann{fill:#2340B8;font-size:11px;font-weight:700}#dsfig-u1-06 .lbl{fill:#6F7787;font-family:system-ui,-apple-system,sans-serif;font-size:12px;font-weight:700}#dsfig-u1-06 .ptr{fill:#2340B8;font-size:12px;font-weight:700}#dsfig-u1-06 .ah{fill:#454C5A}#dsfig-u1-06 .ah.hi{fill:#2340B8}#dsfig-u1-06 .wl rect{fill:#FFFFFF;stroke:#DCE0E7}#dsfig-u1-06 .wl .t{font-size:12px;font-weight:700}#dsfig-u1-06 .wl.hi rect{fill:#2340B8;stroke:#2340B8}#dsfig-u1-06 .wl.hi .t{fill:#FFFFFF}html.dark #dsfig-u1-06 .e{stroke:#B1B7C3}html.dark #dsfig-u1-06 .e.hi{stroke:#8FA3FF}html.dark #dsfig-u1-06 .n{fill:#161920;stroke:#E6E8ED}html.dark #dsfig-u1-06 .n.hi{fill:#1E2748;stroke:#8FA3FF}html.dark #dsfig-u1-06 .n.rb-b{fill:#E6E8ED;stroke:#E6E8ED}html.dark #dsfig-u1-06 .n.rb-r{fill:#FF7E71;stroke:#FF7E71}html.dark #dsfig-u1-06 .t{fill:#E6E8ED}html.dark #dsfig-u1-06 .t.inv{fill:#0F1115}html.dark #dsfig-u1-06 .kd{stroke:#E6E8ED}html.dark #dsfig-u1-06 .dot{fill:#E6E8ED}html.dark #dsfig-u1-06 .ann{fill:#8FA3FF}html.dark #dsfig-u1-06 .lbl{fill:#858D9C}html.dark #dsfig-u1-06 .ptr{fill:#8FA3FF}html.dark #dsfig-u1-06 .ah{fill:#B1B7C3}html.dark #dsfig-u1-06 .ah.hi{fill:#8FA3FF}html.dark #dsfig-u1-06 .wl rect{fill:#161920;stroke:#2A2E37}html.dark #dsfig-u1-06 .wl.hi rect{fill:#8FA3FF;stroke:#8FA3FF}html.dark #dsfig-u1-06 .wl.hi .t{fill:#0F1115}</style><defs><marker id="ah6" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah" d="M0,1 L9,5 L0,9 z"/></marker><marker id="ahh6" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah hi" d="M0,1 L9,5 L0,9 z"/></marker></defs><path class="e" d="M59,40 L148,40" marker-end="url(#ah6)"/><path class="e" d="M188,40 L270,40" marker-end="url(#ah6)"/><path class="e" d="M324,40 L406,40" marker-end="url(#ah6)"/><path class="e" d="M408,40 L61,40" marker-end="url(#ah6)"/><g class="wl"><rect x="84.1" y="31" width="40.8" height="18" rx="9"/><text class="t" x="104.5" y="40" dy=".35em" text-anchor="middle">call</text></g><g class="wl"><rect x="213.1" y="31" width="40.8" height="18" rx="9"/><text class="t" x="233.5" y="40" dy=".35em" text-anchor="middle">trap</text></g><g class="wl"><rect x="342.1" y="31" width="40.8" height="18" rx="9"/><text class="t" x="362.5" y="40" dy=".35em" text-anchor="middle">mode</text></g><g class="wl"><rect x="206.4" y="31" width="54.3" height="18" rx="9"/><text class="t" x="233.5" y="40" dy=".35em" text-anchor="middle">return</text></g><circle class="n" cx="40" cy="40" r="18"/><text class="t" x="40" y="40" dy=".35em" text-anchor="middle">App</text><circle class="n" cx="169" cy="40" r="18"/><text class="t" x="169" y="40" dy=".35em" text-anchor="middle">Lib</text><rect class="n" x="273" y="25" width="50" height="30" rx="15"/><text class="t" x="298" y="40" dy=".35em" text-anchor="middle">Trap</text><circle class="n" cx="427" cy="40" r="18"/><text class="t" x="427" y="40" dy=".35em" text-anchor="middle">Ker</text></svg><figcaption style="font-size:.82em;opacity:.72;margin-top:.45rem">System call path: application, library wrapper, trap into kernel mode, kernel service, return to user mode</figcaption></figure>
Key points.
- System calls are the only entry point to the kernel, so user programs cannot touch hardware directly, which gives protection.
- They are usually invoked through an API such as POSIX or Win32, whose library wrapper hides the trap details.
- Parameters are passed in registers, in a table in memory whose address is in a register, or on the stack.
- Steps: the program calls a library function, the parameters are loaded, a trap (software interrupt) switches the CPU from user to kernel mode, the kernel runs the service through the system call table, and control returns to the program in user mode with a result.
- Process control (to create, run and end processes): fork, exec, exit, wait, abort.
- File management (to store and access files): open, read, write, close, create, delete.
- Device management (to use I/O devices): request device, release device, read, write.
- Information maintenance (to get or set system data): getpid, time, date, get attributes.
- Communication (to exchange data between processes): pipe, send, receive, shared memory.
- The mode bit is 1 in user mode and 0 in kernel mode; the trap sets it to 0 and the return sets it back to 1, so privileged instructions run only in the kernel.
Example. Copy file: open(source), create(destination), loop read and write, close both, exit.
Example. read(fd, buf, n) in a C program calls the library, which traps to the kernel; the kernel copies data from the file into buf and returns the byte count.
Answer frame. Open with the definition; draw the call path figure; describe the mechanism in points 3-4 for "how does a program use these calls"; give the five types with an example call each; close by saying system calls keep the kernel protected while providing services.
Asked: [7 marks] (Nov 2019) What are System call? Explain briefly about various types of system call provided by an operating system. Asked: [7 marks] (Jun 2020, Jun 2023) What is meant by a System call? How it can be used? How does an application program use these calls during execution?
Last-minute revision
- An OS is a resource manager, an extended machine and a control program.
- OS goals: convenience, efficiency, ability to evolve.
- Evolution: serial, batch, multiprogramming, time-sharing, PC, parallel/distributed, real-time, mobile.
- Batch: no interaction, CPU idle in I/O; multiprogramming: many jobs in memory.
- Time-sharing: time slice (quantum), round-robin, interactive.
- Hard real-time never misses a deadline; soft real-time tolerates it.
- Network OS: machines independent; distributed OS: appears as one system.
- A virus needs a host program; a worm is standalone and self-replicating.
- Services: UI, program execution, I/O, files, communication, error detection, allocation, accounting, protection.
- System call = trap from user mode to kernel mode.
- System call types: process control, file, device, information, communication.
Memory hooks
- Batch = "bulk, no talk"; time-sharing = "turns for all".
- Services: "U-P-I-F-C-E-A-A-P" (UI, Program, I/O, File, Communication, Error, Allocation, Accounting, Protection).
- System call = "knock on the kernel door": trap in, mode switch, return out.
- Call types: "P-F-D-I-C" (Process, File, Device, Information, Communication).
Coverage checklist
- Function: Define an operating system, goals, functions of OS (Jun 2023, Jun 2025).
- Evolution: Evolution of operating system (Nov 2023, Jun 2026).
- Different Types: batch, time-sharing, network, types with examples, worms and virus, demand paging, security in time sharing (May 2019, Jun 2020, Jun 2023, Nov 2023, Jun 2024).
- Desirable Characteristics and features of an O/S: What is an OS, desirable characteristics (May 2019).
- Operating Systems Services: Types of Services: services, process management activities, memory management activities, services with system calls (Nov 2019, Jun 2024, Jun 2025, Jun 2026).
- Different ways of providing these Services – Utility Programs: no past questions.
- System Calls: meaning, use, types (Nov 2019, Jun 2020, Jun 2023).