How is a system call implemented in an OS?
Using a system call index table. Each system call has a unique number (index) used by the kernel to locate the appropriate handler function.
What is a system call index table?
A system call index table is a special table that the operating system (OS) keeps, where each entry represents a system call.
What are the three main parameter passing methods for system calls?
1) Registers, 2) Memory block or table, 3) Stack.
What is the advantage of passing system call parameters via registers?
Fast and efficient, but limited by the number of available registers.
What is the advantage of passing system call parameters via memory blocks?
Flexible, supports larger parameter sets. Only the starting address needs to be passed.
Why is stack-based parameter passing often used for system calls?
It is flexible, does not require a fixed number of parameters, and is portable across different architectures.
What are the two main models of interprocess communication (IPC)?
Message passing and shared memory.
What is message passing in IPC?
Processes exchange data by sending and receiving messages through the operating system.
What is an advantage of message passing?
Simplicity and synchronization is built-in; processes do not directly share memory space.
What is shared memory in IPC?
Multiple processes share a region of memory. Processes can read and write directly to the shared space.
What is the main advantage of shared memory IPC?
High performance because processes can directly access data without kernel involvement after setup.
What is the challenge of shared memory IPC?
Requires careful synchronization (e.g., semaphores, mutexes) to avoid race conditions.
Why is there no perfect operating system?
Different systems have conflicting requirements (e.g., performance vs. security, simplicity vs. functionality). Trade-offs are always necessary.
Give an example of conflicting OS requirements.
High security may reduce performance; high performance may reduce portability or flexibility.
What is the difference between policy and mechanism in OS design?
Mechanism = how something is done (implementation). Policy = what decision to make (strategy).
Give an analogy for policy vs. mechanism.
Mechanism = function definition (fixed code). Policy = parameters passed to the function (easily changed).
Why separate policy and mechanism?
It increases flexibility; OS mechanisms can be reused with different policies.
What type of structure does MS-DOS use?
A simple, single-tasking structure with no separation between user and kernel mode.
What are limitations of the MS-DOS structure?
No memory protection, poor stability, and limited multitasking.
What type of structure does UNIX use?
A layered but monolithic structure. Kernel provides file system, process management, device drivers.
What are features of the UNIX OS structure?
Better separation, multiuser support, multitasking, but still monolithic (kernel is one large program).
What type of structure does Windows use?
A hybrid structure combining aspects of monolithic and microkernel designs.
What are features of Windows OS structure?
Modular, supports multitasking, GUI, kernel-mode and user-mode separation, better portability.
What is a command interpreter (shell)?
A program that reads user commands and translates them into OS actions.