Courses / HEC NSCT – National Skill Competency Test: Complete Preparation for Computing Graduates
9.1 OS Basics, Processes and Threads
Area 9 – Operating Systems (5%) · 40 min read · 10 MCQs to check yourself
Process vs thread (ByteByteGo)
What an OS does
Manages processes, memory, files, I/O devices and security, and provides a user interface (CLI/GUI) and system calls (the program's way to ask the kernel for services, e.g. fork(), read()).
- Kernel mode (full hardware access) vs user mode (restricted). A system call or interrupt switches to kernel mode.
- Kernel types: monolithic (Linux), microkernel (minimal kernel, services in user space), hybrid (Windows, macOS).
- Types of OS: batch, time-sharing (multitasking), real-time (hard/soft deadlines), distributed, mobile (Android, iOS), embedded.
Process
A process = program in execution (code, data, stack, heap, registers). Described by its PCB (process control block: PID, state, program counter, registers, priority, open files).
States: New → Ready → Running → (Waiting/Blocked for I/O → Ready) → Terminated. A context switch saves one process's state and loads another's – pure overhead.
fork() creates a child process; exec() replaces its program. A zombie process has finished but its parent has not collected its exit status; an orphan has lost its parent.
Threads
A thread is a lightweight unit of execution inside a process. Threads of a process share code, data and open files but each has its own stack, registers and program counter.
| Process | Thread |
|---|---|
| Heavyweight, separate memory | Lightweight, shared memory |
| Creation and switching are slower | Faster to create and switch |
| Communicate via IPC (pipes, sockets, shared memory, message passing) | Communicate through shared variables (needs synchronisation) |
| Multithreading improves responsiveness (one thread waits for I/O while another computes) and uses multi-core CPUs. |
This lesson ends with a quiz of 10 MCQs. Open the lesson on PrepOasis to take it and save your progress.
Previous: Area 8 Review, Checklist and Area Test · Next: 9.2 CPU Scheduling