UNIHIVE

Study Hub UNIPORT CSC 394

CSC 394 · Operating Systems

OS structure, services and system calls

How an OS is organised (monolithic, layered, microkernel, modular, virtual machines), system calls and their types, and interrupts.

Our notes

2 min read

System calls

A system call is the way a program asks the kernel for a service. The program places arguments, runs a special trap instruction, the CPU switches to kernel mode, the kernel does the work and returns.

TypeUNIX examples
Process controlfork(), exec(), exit(), wait()
File managementopen(), read(), write(), close()
Device managementioctl(), read(), write()
Informationgetpid(), time()
Communicationpipe(), socket(), shmget()

Library functions (printf in C, print in Python) call these for you.

Interrupts

An interrupt is a signal that makes the CPU stop what it is doing, save its state, and run an interrupt handler.

  • Hardware interrupts: a key pressed, disk finished, timer tick.
  • Software interrupts (traps): system calls, errors such as divide-by-zero.

The timer interrupt lets the OS take the CPU back from a program (needed for time-sharing).

Dual-mode operation

A mode bit separates user mode (restricted) and kernel mode (all instructions allowed). Privileged instructions (I/O, changing memory maps, turning off interrupts) only run in kernel mode; this protects the system from faulty or malicious programs.

OS structures

StructureIdeaPros / cons
Simple / monolithicthe whole OS is one big program in kernel modefast; hard to maintain, one bug can crash all (MS-DOS, early UNIX)
Layeredlayers, each using only the one below (layer 0 hardware … layer N user interface)easy to debug; can be slow; hard to define layers (THE system)
Microkernelonly the essentials (IPC, scheduling, basic memory) in the kernel; drivers and file systems run as user processesreliable, secure, extensible; message passing is slower (Mach, MINIX, QNX)
Modular (loadable modules)a core kernel plus modules loaded when neededflexible and fast (Linux, Solaris)
Hybridmixes the aboveWindows NT, macOS (XNU)

Virtual machines

A hypervisor lets one computer run several operating systems at once, each in its own virtual machine (VirtualBox, VMware, cloud servers). Containers (Docker) share one kernel but isolate programs.

OS services for users

Program execution, I/O operations, file-system manipulation, communication, error detection; and for the system: resource allocation, accounting, protection and security.

The shell

The shell (command interpreter) reads user commands and runs them: bash on Linux, PowerShell on Windows. Examples: ls (list files), cd (change directory), cp, mv, rm, ps (list processes), kill.

Exams usually ask: define a system call and give types with examples; explain interrupts; dual-mode operation; compare monolithic, layered and microkernel structures; what a virtual machine is.

Common mistake: saying the shell is the kernel. The shell is a user program that talks to the kernel through system calls.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 394 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.