Past exam question: 2078 (Past Questions), QA
Open in the Padhaiko appWhat is the role of system call in an operating system? Write down the major differences between following types of operating system.
- Batch System
- Real time system
- Interactive system
- Time sharing system
Solution
Role of System Calls in an Operating System: A system call provides the essential programmatic interface between an executing user-space application and the privileged services managed by the operating system kernel. Its core roles are:
- Hardware Protection and Mode Switching: Modern processors enforce dual-mode operation: unprivileged User Mode (Ring 3 on x86) and privileged Kernel/Supervisor Mode (Ring 0). User programs cannot directly execute privileged instructions (such as disabling interrupts or modifying page tables) or directly touch device controllers. When an application requires a privileged service (e.g., reading from disk or allocating memory), it executes a software trap/interrupt (such as
syscallorsysenter), triggering a controlled transition into kernel mode where the kernel safely performs the requested operation. - Resource Abstraction and Standardization: System calls shield programmers from the tedious, low-level details of hardware device registers, disk geometry, and bus protocols. They present uniform, high-level abstractions like
open(),read(),write(), andclose(), regardless of whether the underlying storage is an NVMe SSD, SATA hard disk, or USB flash drive. - Security, Access Control, and Validation: The kernel validates every system call argument (e.g., buffer pointers, array boundaries, file permissions) in supervisor space before performing operations, ensuring rogue or buggy user processes cannot corrupt other processes or destabilize the system.
Comparative Analysis of Operating System Types: The table below contrasts batch, real-time, interactive, and time-sharing systems across their foundational operational parameters:
| Parameter | Batch System | Real-Time System (RTOS) | Interactive System | Time-Sharing System |
|---|---|---|---|---|
| Primary Goal | Maximize CPU utilization and total system throughput. | Guarantee deterministic completion within strict time deadlines. | Provide rapid responsiveness and feedback to human user actions. | Multiplex CPU among multiple concurrent users to give illusion of dedicated access. |
| User Interaction | No direct user interaction during execution; jobs submitted via punchcards/scripts. | Typically no direct human interaction; responds to sensor/actuator events. | Direct continuous interaction via GUI, keyboard, and mouse. | Multiple users interact simultaneously via terminals or network shells. |
| CPU Scheduling | Sequential, non-preemptive (FCFS or shortest job next). | Priority-driven preemptive scheduling (e.g., Rate Monotonic, Earliest Deadline First). | Priority-based preemptive scheduling favoring interactive I/O-bound tasks. | Preemptive Round-Robin with fixed time quantum. |
| Response Time | High turnaround latency (minutes to hours). | Deterministic and strictly bounded (microseconds to milliseconds). | Fast human-scale response (tens of milliseconds to 1 second). | Immediate interactive response across all connected users. |
| Representative Example | IBM OS/360, early batch mainframes. | QNX, VxWorks, FreeRTOS, RTLinux. | Windows 11, macOS, Ubuntu Desktop. | UNIX, Linux multi-user servers, CTSS. |
System calls serve as the secure, hardware-protected interface enabling unprivileged user applications to invoke privileged operating system services via software traps. The four OS types address distinct computing demands: Batch systems optimize throughput without user intervention; Real-Time systems guarantee deterministic task execution before strict deadlines; Interactive systems prioritize immediate feedback to human inputs; and Time-Sharing systems multiplex the CPU among multiple simultaneous users using rapid round-robin time-slicing.