Operating systems: structure, services, system calls, process management, interprocess communication and synchronization (semaphores, critical-section problem). - Question Bank

1. What is the main advantage of kernel-level threads over user-level threads?
A) Faster creation and context switching.
B) Can run in parallel on multi-core processors without operating system intervention for each thread.
C) Simpler programming model.
D) Less memory overhead.
2. In a kernel-level thread implementation, which entity is directly managed by the operating system scheduler?
A) Processes
B) Threads
C) Files
D) Devices
3. Which of the following is an example of a user-level thread implementation?
A) Windows Threads
B) Linux Kernel Threads
C) Solaris Green Threads (or similar user-level thread libraries)
D) POSIX Threads (pthreads) when managed entirely by a user-level library
4. What does the term 'starvation' refer to in process scheduling?
A) A situation where a process is repeatedly denied CPU access and never gets to execute.
B) A situation where a process consumes excessive CPU time.
C) A deadlock situation.
D) A system crash due to resource exhaustion.
5. Which of the following is a method for preventing deadlock?
A) Allowing all conditions for deadlock to occur.
B) Ensuring at least one of the four necessary conditions for deadlock cannot hold.
C) Ignoring deadlock situations and restarting the system when they occur.
D) Increasing the number of available resources.
6. What is the main purpose of the 'sleep()' system call?
A) To immediately terminate a process.
B) To allow a process to temporarily relinquish the CPU and go into a waiting state for a specified duration.
C) To create a new process.
D) To signal another process.
7. A 'blocking send' in message passing IPC means:
A) The sending process continues execution immediately after sending the message.
B) The sending process is suspended until the message is received by the destination process.
C) The message is stored in a temporary buffer.
D) The message is sent asynchronously.
8. Which system call is used by a process to terminate itself?
A) fork()
B) exec()
C) exit()
D) waitpid()
9. What is the primary function of a scheduler in an operating system?
A) To manage memory allocation for processes.
B) To decide which process/thread gets to use the CPU next and for how long.
C) To handle communication between processes.
D) To manage the file system structure.
10. Which of the following operating system structures is known for its modularity and extensibility?
A) Monolithic Kernel
B) Microkernel
C) Layered System
D) All of the above
11. In the context of concurrency, what is a 'race condition'?
A) A situation where multiple processes compete for CPU time.
B) A situation where the outcome of concurrent operations depends on the unpredictable timing of their execution, leading to incorrect results.
C) A deadlock situation where processes are stuck.
D) A security vulnerability allowing unauthorized access.
12. What is the main challenge in implementing a Round Robin scheduling algorithm?
A) Determining the optimal time quantum.
B) Ensuring that long processes do not starve.
C) Preventing race conditions.
D) Managing the complexity of priority levels.
13. Which IPC mechanism allows processes to send and receive messages without sharing memory directly?
A) Shared Memory
B) Pipes
C) Message Queues
D) Sockets
14. What is the purpose of the 'Ready' state in process management?
A) The process is currently executing on the CPU.
B) The process is waiting for an event to occur (e.g., I/O completion).
C) The process is waiting to be assigned to the CPU.
D) The process has finished execution.
15. When a process makes an I/O request, it typically transitions to which state?
A) Running
B) Ready
C) Waiting (or Blocked)
D) Terminated
16. Which of the following is an example of a system call used for file management?
A) read()
B) fork()
C) malloc()
D) printf()
17. What is the primary advantage of a microkernel design?
A) Higher performance due to fewer context switches.
B) Increased reliability and maintainability as services run as separate processes.
C) Simpler implementation of device drivers.
D) Direct hardware access for all user applications.
18. In a microkernel architecture, which of the following services are typically moved out of the kernel into user space?
A) Interrupt handling
B) Memory management
C) File system management and device drivers
D) Process scheduling
19. Which operating system structure involves a monolithic kernel that includes most OS services within a single large process?
A) Microkernel
B) Layered System
C) Monolithic Kernel
D) Hybrid Kernel
20. What is a 'daemon' process in Unix-like operating systems?
A) A user application that runs in the foreground.
B) A background process that performs system services.
C) A temporary process created for a specific task.
D) A process that is currently waiting for I/O.
21. Which of the following is NOT one of the four necessary conditions for deadlock?
A) Mutual Exclusion
B) Hold and Wait
C) No Preemption
D) Fairness
22. A deadlock occurs when:
A) A process terminates abnormally.
B) A set of processes are blocked indefinitely, each holding a resource and waiting to acquire a resource held by another process in the set.
C) The CPU utilization drops to zero.
D) The operating system runs out of memory.
23. Which of the following synchronization techniques can lead to 'busy waiting' (also known as spinning)?
A) Semaphores with blocking
B) Mutex locks that block
C) Spinlocks
D) Message passing
24. What is the primary goal of the 'Producer-Consumer' problem in concurrency?
A) To manage shared memory efficiently between processes.
B) To synchronize the actions of a producer process creating data and a consumer process using that data, using a shared buffer.
C) To detect and prevent deadlocks in a system.
D) To ensure fair allocation of CPU time among all processes.
25. In a preemptive scheduling algorithm, a running process can be interrupted by the scheduler if:
A) The process voluntarily yields the CPU.
B) A higher-priority process becomes ready to run.
C) The process completes its CPU burst.
D) The process makes an I/O request.
26. Which of the following scheduling algorithms is non-preemptive?
A) Round Robin
B) Shortest Remaining Time First (SRTF)
C) First-Come, First-Served (FCFS)
D) Priority Scheduling (preemptive version)
27. The 'exec()' system call is used to:
A) Create a new process.
B) Terminate the current process.
C) Replace the current process image with a new program.
D) Wait for a child process to terminate.
28. Which system call is typically used to create a new process?
A) exit()
B) fork()
C) exec()
D) wait()
29. What does 'context switching' refer to in an operating system?
A) Switching between different user applications.
B) Saving the state of a current process and loading the state of a new process to allow the CPU to resume execution.
C) Switching between different network protocols.
D) Changing the display resolution of the monitor.
30. Which of the following is a benefit of using threads over processes?
A) Increased isolation between execution units.
B) Lower overhead for creation and context switching.
C) Greater security due to separate memory spaces.
D) Simpler synchronization mechanisms.
31. What is a 'thread'?
A) A separate process with its own memory space.
B) A lightweight unit of execution within a process, sharing resources with other threads of the same process.
C) A hardware component responsible for executing instructions.
D) A mechanism for inter-process communication.
32. The Process Control Block (PCB) is a data structure that contains:
A) Only the process ID.
B) Information about the process's state, CPU registers, memory management, etc.
C) The source code of the running program.
D) The output generated by the process.
33. In the context of operating systems, what is a 'process'?
A) A program stored on disk.
B) An instance of a program in execution.
C) A block of memory allocated to a program.
D) A thread of execution within a program.
34. Which of the following is a classic example of a synchronization problem that can be solved using semaphores?
A) Deadlock detection
B) The Producer-Consumer problem
C) Memory allocation
D) File access control
35. What is a potential problem if a process is preempted while it is in its critical section?
A) The process might complete its task faster.
B) Another process could enter the same critical section, violating mutual exclusion.
C) The operating system might crash.
D) The preempted process will automatically release the resource.
36. A mutex (mutual exclusion) lock is primarily used for:
A) Allowing multiple threads to access a resource concurrently.
B) Ensuring that only one thread can access a critical section at a time.
C) Managing the scheduling of processes.
D) Facilitating communication between different processes.
37. Which type of semaphore is initialized to 1 and is used to ensure mutual exclusion?
A) Counting Semaphore
B) Binary Semaphore
C) Mutex
D) Spinlock
38. The `signal()` operation on a semaphore (also known as V operation) typically:
A) Decrements the semaphore value and blocks the process if the value becomes negative.
B) Increments the semaphore value and potentially unblocks a waiting process.
C) Checks if the resource is available without modifying the semaphore.
D) Terminates the process associated with the semaphore.
39. The `wait()` operation on a semaphore (also known as P operation) typically:
A) Increments the semaphore value and potentially unblocks a waiting process.
B) Decrements the semaphore value and blocks the process if the value becomes negative.
C) Resets the semaphore value to zero.
D) Allows multiple processes to access the resource simultaneously.
40. A semaphore is a synchronization primitive that can be thought of as:
A) A variable used to store process IDs.
B) A counter used to control access to a shared resource.
C) A data structure for managing file permissions.
D) A mechanism for inter-process communication via message queues.
41. Which of the following is a fundamental requirement for solving the critical-section problem?
A) Mutual Exclusion
B) Fairness
C) Deadlock Prevention
D) Starvation Avoidance
42. A critical section is a segment of code that:
A) Is executed only by the operating system kernel.
B) Accesses shared resources and must not be executed by more than one process at a time.
C) Handles all input/output operations.
D) Is responsible for managing virtual memory.
43. Interprocess Communication (IPC) is essential for:
A) Preventing processes from interfering with each other.
B) Allowing processes to exchange data and synchronize their actions.
C) Increasing the security of the operating system.
D) Reducing the memory footprint of running applications.
44. Which scheduling algorithm aims to minimize the average waiting time by executing the process with the smallest execution time first?
A) First-Come, First-Served (FCFS)
B) Shortest Job Next (SJN)
C) Round Robin
D) Priority Scheduling
45. What is the main purpose of process scheduling?
A) To ensure that all processes have equal access to the CPU.
B) To maximize CPU utilization and minimize response time.
C) To prevent processes from accessing each other's memory.
D) To handle I/O requests from peripheral devices.
46. Which of the following is NOT a typical state of a process?
A) Running
B) Waiting
C) Blocked
D) Compiled
47. A system call is best defined as:
A) A request made by a user to the operating system for a service.
B) A hardware interrupt generated by a peripheral device.
C) A software instruction executed by the CPU.
D) A method for inter-process communication.
48. Which operating system service is responsible for allocating CPU time to different processes?
A) Memory Management
B) File System Management
C) Process Management
D) Device Management
49. What is a key function of the operating system's kernel?
A) To manage user interface elements like windows and icons.
B) To provide core system services and manage hardware resources.
C) To develop new software applications.
D) To perform data backup and recovery operations.
50. Which of the following best describes the primary role of an operating system?
A) To execute user applications directly without any intermediary.
B) To manage computer hardware and software resources, providing a platform for applications.
C) To perform complex mathematical calculations for scientific research.
D) To connect computers to the internet and manage network traffic.