Operating System Structures MCQs for NSCT
Operating system structures cover two things: how programs ask the OS for services (system calls), and how the kernel itself is organised (monolithic, layered, microkernel, modular or hybrid). This is topic 2 of the Operating Systems area, which carries 5% of the NSCT according to HEC's Areas of Competencies. OS had the lowest 2026 accuracy of any area, 33.8%, per the HEC NSCT report and APP.
Definitions follow Silberschatz, Operating System Concepts. If kernel mode and traps are new to you, start with Introduction to Operating Systems.
System calls
A system call is the programming interface to the services the kernel provides. It traps from user mode into kernel mode, the kernel does the work, and control returns. Programmers usually call an API (POSIX, the Windows API or the Java API) instead. The API is portable and easier, and the run-time library (the system-call interface) makes the real calls. For example, printf() is a library function that buffers text and then calls write().
Silberschatz groups system calls into six categories:
| Category | UNIX examples | Windows examples |
|---|---|---|
| Process control | fork(), exit(), wait() |
CreateProcess(), ExitProcess(), WaitForSingleObject() |
| File management | open(), read(), write(), close() |
CreateFile(), ReadFile(), WriteFile(), CloseHandle() |
| Device management | ioctl(), read(), write() |
SetConsoleMode(), ReadConsole() |
| Information maintenance | getpid(), alarm(), sleep() |
GetCurrentProcessID(), SetTimer(), Sleep() |
| Communications | pipe(), shm_open(), mmap() |
CreatePipe(), CreateFileMapping(), MapViewOfFile() |
| Protection | chmod(), umask(), chown() |
SetFileSecurity(), SetSecurityDescriptorGroup() |
Parameters reach the kernel in three ways: in registers, in a block in memory whose address goes in a register, or on the stack. Linux uses registers for five or fewer parameters and the block method for more.
Communication calls support two models. Message passing copies data through the kernel and suits small amounts. Shared memory needs system calls only for setup and is faster for bulk data, but the processes must synchronise themselves.
Exam angle: when counting calls in a copy loop, include the final read() that returns 0 at end of file; it has no matching write().
Monolithic
In a monolithic kernel, everything between the system-call interface and the hardware runs as one program in kernel mode: file system, CPU scheduling, memory management and drivers. Traditional UNIX is the classic example, and Linux is monolithic too.
Its strength is speed, because services call each other directly. Its weakness is safety: a bad pointer in one driver can crash the whole system.
Linux is monolithic but modular. Loadable kernel modules (LKMs) add drivers and file systems at run time without a reboot. Modules still run in kernel space, so modular does not mean microkernel.
Exam angle: "supports modules" never makes a kernel a microkernel. Ask where the services run.
Microkernel
A microkernel removes every non-essential component from the kernel and runs it as a user-level process. The kernel keeps only minimal process and memory management plus a message-passing facility. Mach (Carnegie Mellon, mid-1980s) and QNX are the standard examples.
| Monolithic | Microkernel | |
|---|---|---|
| Services run in | Kernel space | User space (separate servers) |
| Communication | Direct function calls | Messages through the kernel |
| Performance | Faster | Slower (message overhead) |
| Fault isolation | A driver bug can crash all | A crashed server can be restarted |
| Examples | Traditional UNIX, Linux | Mach, QNX |
Benefits: easier extension, easier porting, and more security and reliability. The cost is performance. Windows NT 1.0 had a layered microkernel design and ran slowly, so NT 4.0 moved layers back into kernel space. Most real systems are hybrids. macOS and iOS use Darwin, which combines the Mach microkernel with the BSD UNIX kernel, and Windows is largely monolithic with some microkernel features.
Exam angle: if a question adds two messages per request, the microkernel's extra cost scales with the number of requests.
Layered
The layered approach splits the OS into levels: layer 0 is the hardware and layer N is the user interface. Each layer uses only the services of the layers below it. In a six-layer system, layer 3 may call layers 2, 1 and 0, never 4 or 5.
Layering makes construction and debugging simple, one layer at a time. It has two problems. Defining the layers is hard (Silberschatz's backing-store driver and CPU scheduler each seem to need the other), and every request passes through several layers, which costs performance.
Exam angle: a question describing a circular dependency between components is testing the "hard to define layers" weakness, not the performance one.
Common traps
- Calling
printf()a system call. It is a library function that may callwrite()once for manyprintf()calls. - Classing Linux as a microkernel because it has loadable modules.
- Forgetting the final
read()that returns 0 when counting system calls. - Mixing up categories.
getpid()is information maintenance,ioctl()is device management andchmod()is protection. - Assuming microkernels are faster because the kernel is smaller. Message passing makes them slower.
- Mixing up mechanism (how) and policy (what). The timer is a mechanism; a 10 ms time slice is a policy.
Worked examples
Understanding. A program calls alarm() to be signalled after 5 seconds. Which system-call category is this?
Answer: information maintenance. Silberschatz lists alarm() and sleep() (Windows SetTimer() and Sleep()) with time and process-attribute calls in this category.
Application. A copy loop reads an 8,192-byte file with a 4,096-byte buffer until read() returns 0. How many read() and write() calls does it make?
Answer: 3 reads and 2 writes. Two reads return 4,096 bytes each and both are written. A third read returns 0 at end of file and ends the loop.
Analysis. A client reads a file. In a monolithic kernel, how many traps into the kernel does this need, compared with a microkernel whose file system is a user-level server? Answer: 1 versus at least 2. Monolithic: one system call, and the kernel does the work. Microkernel: the client traps to send a request, the kernel delivers it to the file server, and the server traps again to send the reply. Those extra crossings and copies are the microkernel's performance cost.
Practise
The quiz below has 100 Operating System Structures questions, which you can filter by tier and difficulty.
Practise: 100 questions
FAQs
What is the difference between a system call and an API?
An API is a set of library functions, such as POSIX read() or the Windows ReadFile(), that programmers call. A system call is the actual trap into the kernel. API functions usually invoke one or more system calls for you. Programming to the API keeps code portable across systems with different system-call numbers.
Is Linux monolithic or a microkernel?
Linux is monolithic. Its file systems, scheduler, memory manager and drivers all run in kernel space in one address space. It is also modular, because loadable kernel modules can be added at run time. Silberschatz describes Linux as monolithic yet modular, which gives flexibility without microkernel message overhead.
Why are microkernels slower?
Services such as the file system run as separate user processes, so a request becomes messages: from the client to the kernel, to the server, and back. Each message involves copying data and switching between processes and modes. A monolithic kernel handles the same request with direct function calls inside the kernel.
What is a hybrid kernel?
A hybrid kernel mixes structures to balance speed and modularity. Darwin, the kernel of macOS and iOS, combines the Mach microkernel with the BSD UNIX kernel. Windows is largely monolithic but keeps some microkernel features, such as separate subsystems. Most commercial systems today are hybrids.
Next step
Continue with Process Management MCQs, go back to the Operating Systems hub, or try a timed NSCT mock test.