Introduction to Operating Systems MCQs for NSCT
An operating system (OS) is the program that sits between users and the hardware: it allocates the CPU, memory, storage and devices, and it stops programs from harming each other. This is topic 1 of the Operating Systems area, which carries 5% of the NSCT according to HEC's Areas of Competencies. Small weightage, but in 2026 OS had the lowest accuracy of any area, 33.8%, per the HEC NSCT report and APP.
Definitions follow Silberschatz, Operating System Concepts. Later topics, from processes to deadlocks, build on these terms.
OS functions
From the user's side the OS makes the computer convenient to use. From the system's side it is a resource allocator (sharing CPU time, memory and I/O fairly) and a control program (preventing errors and misuse). The kernel is "the one program running at all times"; shells, compilers and apps run on top of it.
| Function | What the OS does |
|---|---|
| Process management | Creates, schedules, suspends and ends processes |
| Memory management | Tracks which memory is in use and by whom; moves processes in and out |
| File-system and storage management | Files, directories, free space, disk scheduling |
| I/O management | Device drivers, buffering, caching, DMA |
| Protection and security | Controls access to resources; defends against attacks |
A program is a passive file on disk; a process is a program in execution. Three students running one compiler binary give 1 program and 3 processes.
The OS is interrupt driven. A device raises an interrupt, and the CPU looks up the handler in the interrupt vector, a table of handler addresses. A trap (exception) is a software-generated interrupt, caused by an error such as division by zero or by a system call. With DMA (direct memory access), a controller moves a whole block to memory and raises one interrupt per block instead of one per byte.
Exam angle: questions often ask which OS function a duty belongs to. "Deciding which processes to move into and out of memory" is memory management, not process management.
Types
| Type | Key idea | Example |
|---|---|---|
| Batch | Jobs grouped and run with no interaction | Overnight payroll |
| Multiprogramming | Several jobs in memory so the CPU always has one to run | Any modern OS |
| Time-sharing (multitasking) | Switches so fast that users interact; response time typically under a second | Linux server with many users |
| Multiprocessor (SMP) | Several CPUs share memory; each runs OS and user code | Multicore laptops |
| Clustered | Separate computers share storage; one takes over if another fails | High-availability servers |
| Hard real-time | Missing a deadline is a failure | Pacemaker, anti-lock brakes |
| Soft real-time | Critical tasks get priority; occasional misses tolerated | Video calls, streaming |
Multiprogramming raises CPU utilisation. A simple model from Tanenbaum gives utilisation = 1 − pⁿ, where p is the fraction of time a process waits for I/O. With p = 0.8 and n = 3, utilisation = 1 − 0.512 = 48.8%.
For multiprocessors, Amdahl's law limits speedup: speedup = 1 / (S + (1 − S)/N). A program that is 25% serial (S = 0.25) on 4 cores speeds up only about 2.29 times. Multiprocessors also give graceful degradation: service continues in proportion to the surviving hardware.
Exam angle: hard versus soft real-time is about the cost of a missed deadline, not about speed.
Kernel vs user mode
To protect the system, the hardware has a mode bit: 0 for kernel mode and 1 for user mode (Silberschatz's convention). Privileged instructions, such as I/O control, timer management and turning off interrupts, run only in kernel mode. If user code attempts one, the hardware traps to the OS, which usually ends the program.
| User mode | Kernel mode | |
|---|---|---|
| Mode bit | 1 | 0 |
| Privileged instructions | Trap to the OS | Allowed |
| Who runs here | Applications, shells, libraries | The kernel |
| How you enter | Return from a trap or interrupt | System call, interrupt or exception |
A timer ensures the OS gets the CPU back even if a program loops forever; setting it is privileged. MS-DOS on the Intel 8088 had no mode bit, so one buggy program could overwrite the OS.
Exam angle: kernel mode is a CPU state, not a user account. A root (administrator) program still runs in user mode and must make a system call. The Operating System Structures topic covers system calls in depth.
Common traps
- Confusing the kernel with the shell. The shell is a user program that reads commands.
- Swapping the mode-bit values. In Silberschatz, kernel = 0 and user = 1.
- Treating multiprogramming and time sharing as identical. Time sharing adds frequent switching for interactive response.
- Calling a video-streaming app hard real-time. A late frame is dropped, so it is soft.
- Assuming N cores give N times the speed. The serial part caps it (Amdahl's law).
- Thinking a trap is a hardware interrupt. A trap is software-generated.
Worked examples
Understanding. Which instruction must be privileged: reading the clock, issuing a system-call trap, or disabling interrupts? Answer: disabling interrupts. A program that disables interrupts could stop the OS ever regaining control. Reading the clock is harmless, and the trap is how user programs request services, so it must work in user mode.
Application. Each process waits for I/O 90% of the time. Using utilisation = 1 − pⁿ, how many processes give at least 50% utilisation? Answer: 7. 0.9⁶ = 0.531, giving 46.9%, which is too low. 0.9⁷ = 0.478, giving 52.2%.
Analysis. A program is 10% serial. A student expects 8 cores to make it 8 times faster. What does Amdahl's law predict? Answer: about 4.71 times. Speedup = 1 / (0.1 + 0.9/8) = 1 / 0.2125, about 4.71. The serial 10% never runs faster, so adding cores gives shrinking returns.
Practise
The quiz below has 98 Introduction to Operating Systems questions, which you can filter by tier and difficulty.
Practise: 98 questions
FAQs
What is the difference between an operating system and a kernel?
The kernel is the core of the OS that runs at all times in kernel mode and manages the CPU, memory and devices. The full operating system also includes system programs, libraries and user interfaces such as the shell or GUI.
Is multiprogramming the same as multiprocessing?
No. Multiprogramming keeps several jobs in memory so one CPU always has work while others wait for I/O. Multiprocessing means the computer has two or more CPUs (or cores) that can run processes at the same time. A single-core machine can multiprogram but cannot multiprocess.
Why does the OS need a timer?
Without a timer, a user program in an infinite loop, or one that never makes a system call, could keep the CPU forever. The OS loads the timer before giving the CPU to a program, and the timer interrupt returns control to the OS. Loading the timer is a privileged instruction.
What is the difference between an interrupt and a trap?
An interrupt is raised by hardware, such as a device finishing I/O or the timer expiring. A trap, or exception, is generated by software: an error like division by zero or an invalid memory access, or a deliberate system call. Both switch the CPU to kernel mode and run an OS handler.
Next step
Continue with Operating System Structures MCQs, go back to the Operating Systems hub, or try a timed NSCT mock test.