Skip to main content
All tracks
Operating Systems

Introduction to Operating Systems

An operating system (OS) manages hardware and provides services to programs. It sits between applications and hardware, giving every program a consistent, protected view of the machine.

What an OS does​

ResponsibilityExamples
Process managementCreate, schedule and terminate programs
Memory managementAllocate RAM, provide virtual memory
File systemsOrganise and protect data on disks
Device managementDrivers for disks, network cards, keyboards
Protection and securityUsers, permissions, isolation between processes

Kernel and user space​

The kernel is the privileged core of the OS. Applications run in user mode and ask the kernel for services through system calls; the CPU switches to kernel mode for the duration of the call.

#include <unistd.h>

int main(void) {
// write() is a system call: the kernel performs the actual I/O
write(1, "hello\n", 6);
return 0;
}

Kernel designs​

  • Monolithic (Linux): most services run inside the kernel; fast, but a driver bug can crash everything.
  • Microkernel (Minix, QNX): only the essentials in the kernel, the rest in user space; safer, with more message passing.
  • Hybrid (Windows NT, macOS): a mix of both.

Common system calls​

CategoryPOSIX examples
Process controlfork, exec, wait, exit
File managementopen, read, write, close
Device managementioctl, read, write
Communicationpipe, socket, shmget

Interrupts​

An interrupt is a signal that makes the CPU pause the current work and run a handler: a keypress, a finished disk read, a timer tick. The timer interrupt is what lets the OS take the CPU back from a running program (pre-emption).

Finished reading?

Mark it complete to track your progress across the docs.

Questions and discussion

Stuck on something here, or found a clearer way to explain it? Start a thread.

All discussions
  • Ask a question or share what helped
  • React to useful answers
  • Sign in with GitHub to post

Comments are stored in GitHub Discussions and shown here by giscus. PrepVerse never sees your GitHub password.