1A situation where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place is called a(n):
A.Infinite Loop
B.Starvation
C.Race Condition
D.Deadlock
Correct Answer: Race Condition
Explanation:A race condition occurs when the final result of concurrent processes depends on the precise sequence or timing of their execution.
Incorrect! Try again.
2Which of the following is not a requirement for a solution to the Critical Section Problem?
A.Mutual Exclusion
B.Progress
C.Bounded Waiting
D.Context Switching speed
Correct Answer: Context Switching speed
Explanation:The three necessary criteria for the Critical Section Problem are Mutual Exclusion, Progress, and Bounded Waiting. Context switching speed is a performance metric, not a correctness requirement.
Incorrect! Try again.
3In the context of the Critical Section Problem, what does Bounded Waiting ensure?
A.No process waits forever to enter its critical section.
B.Only one process stays in the critical section at a time.
C.Processes run in a strict round-robin fashion.
D.The CPU is never idle.
Correct Answer: No process waits forever to enter its critical section.
Explanation:Bounded Waiting ensures there exists a limit (bound) on the number of times other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted.
Incorrect! Try again.
4A semaphore is an integer variable that, apart from initialization, is accessed only through two standard atomic operations, typically called:
A.Start and Stop
B.Wait and Signal
C.Read and Write
D.Test and Set
Correct Answer: Wait and Signal
Explanation:Semaphores are accessed via wait() (often denoted as ) and signal() (often denoted as ).
Incorrect! Try again.
5If a semaphore implementation uses busy waiting, the semaphore is often called a:
A.Monitor
B.Spinlock
C.Deadlock
D.Mutex
Correct Answer: Spinlock
Explanation:A spinlock is a lock where the thread simply waits in a loop ('spins') repeatedly checking if the lock is available.
Incorrect! Try again.
6In the definition of the wait(S) operation for a semaphore , if the value of is non-positive, the process:
A.Increments and proceeds.
B.Sets to zero.
C.Waits (blocks or spins) until becomes positive.
D.Exits the system.
Correct Answer: Waits (blocks or spins) until becomes positive.
Explanation:The logic for wait(S) generally implies: while (S <= 0); S--;. The process must wait until resources are available ().
Incorrect! Try again.
7What is the primary advantage of a Counting Semaphore over a Binary Semaphore?
A.It is faster to implement.
B.It can control access to a given number of instances of a resource.
C.It prevents deadlocks automatically.
D.It requires no hardware support.
Correct Answer: It can control access to a given number of instances of a resource.
Explanation:A binary semaphore handles mutual exclusion (0 or 1), while a counting semaphore tracks available instances of a resource pool.
Incorrect! Try again.
8Which hardware instruction is defined atomically as: returns the original value of a boolean variable and sets the variable to true?
A.CompareAndSwap
B.TestAndSet
C.LoadAndStore
D.WaitAndSignal
Correct Answer: TestAndSet
Explanation:The TestAndSet instruction atomically reads a boolean value and sets it to true, commonly used to implement mutual exclusion.
Incorrect! Try again.
9In Peterson’s Solution for two processes, which two variables are shared between the processes?
A.Two semaphores
B.An integer turn and a boolean array flag
C.A mutex lock and a condition variable
D.A spinlock and a counter
Correct Answer: An integer turn and a boolean array flag
Explanation:Peterson's algorithm uses int turn (whose turn it is) and boolean flag[2] (indicating if a process is ready to enter the critical section).
Incorrect! Try again.
10The Producer-Consumer problem is also known as the:
A.Reader-Writer problem
B.Dining Philosophers problem
C.Bounded-Buffer problem
D.Sleeping Barber problem
Correct Answer: Bounded-Buffer problem
Explanation:The Producer-Consumer problem often involves a fixed-size buffer, leading to the name Bounded-Buffer problem.
Incorrect! Try again.
11In the Dining Philosophers Problem, if all philosophers pick up their left chopstick simultaneously, what condition occurs?
A.Starvation
B.Deadlock
C.Mutual Exclusion
D.Aging
Correct Answer: Deadlock
Explanation:If every philosopher holds the left chopstick and waits for the right one, no one can eat, and no one will release their chopstick, resulting in a circular wait (Deadlock).
Incorrect! Try again.
12A Monitor is a high-level synchronization construct that ensures:
A.Only one process can be active within the monitor at a time.
B.Processes can access monitor variables directly from outside.
C.Semaphores are never used inside the OS.
D.Deadlocks are impossible.
Correct Answer: Only one process can be active within the monitor at a time.
Explanation:Monitors provide automatic mutual exclusion; only one thread or process may be executing a procedure within the monitor module at any given time.
Incorrect! Try again.
13Which component is NOT shared among threads belonging to the same process?
A.Code section
B.Global variables
C.Open files
D.Stack pointer and Register set
Correct Answer: Stack pointer and Register set
Explanation:Threads share code, data, and OS resources like files, but each thread must have its own context, including the Program Counter, Registers, and Stack.
Incorrect! Try again.
14In the Many-to-One multithreading model:
A.Many user-level threads map to many kernel threads.
B.Many user-level threads map to a single kernel thread.
C.Each user-level thread maps to a unique kernel thread.
D.The OS is aware of all user-level threads.
Correct Answer: Many user-level threads map to a single kernel thread.
Explanation:The Many-to-One model maps multiple user threads to one kernel thread. If the kernel thread blocks, the entire process blocks.
Incorrect! Try again.
15What is the primary disadvantage of the One-to-One multithreading model?
A.It does not support true concurrency on multiprocessors.
B.Creating a user thread requires creating a corresponding kernel thread, creating overhead.
C.If one thread blocks, all threads block.
D.It is impossible to implement on Linux.
Correct Answer: Creating a user thread requires creating a corresponding kernel thread, creating overhead.
Explanation:While One-to-One offers better concurrency, the overhead of creating kernel threads for every user thread can burden the system performance.
Incorrect! Try again.
16A Precedence Graph is a directed acyclic graph (DAG) where nodes represent:
A.Resources
B.Individual statements or processes
C.Memory blocks
D.Critical sections
Correct Answer: Individual statements or processes
Explanation:In a precedence graph, nodes are tasks/processes, and edges represent execution dependencies (precedence constraints).
Incorrect! Try again.
17The Readers-Writers Problem prioritizes consistency by ensuring:
A.Multiple writers can write simultaneously.
B.Readers and writers can access data simultaneously.
C.Multiple readers can read simultaneously, but writers require exclusive access.
D.Writers always have priority over readers.
Correct Answer: Multiple readers can read simultaneously, but writers require exclusive access.
Explanation:The core constraint is that reading is non-destructive (shared access allowed), but writing is destructive (exclusive access required).
Incorrect! Try again.
18Condition variables in Monitors utilize which two operations?
A.Wait and Signal
B.P and V
C.Sleep and Wakeup
D.Lock and Unlock
Correct Answer: Wait and Signal
Explanation:Condition variables in monitors are operated on by wait (suspend execution) and signal (resume a suspended thread).
Incorrect! Try again.
19In synchronization, what is a Binary Semaphore often equivalent to?
A.A Condition Variable
B.A Mutex Lock
C.A Spinlock
D.A Monitor
Correct Answer: A Mutex Lock
Explanation:A binary semaphore takes values 0 and 1, providing similar functionality to a Mutual Exclusion (Mutex) lock.
Incorrect! Try again.
20What is Scheduler Activation?
A.A hardware interrupt that starts the scheduler.
B.A scheme for communication between the user-thread library and the kernel.
C.The process of activating a sleeping process.
D.The initial boot sequence of the OS.
Correct Answer: A scheme for communication between the user-thread library and the kernel.
Explanation:Scheduler activations provide a mechanism (like LWP) for the kernel to notify an application about kernel events (like blocking), allowing better user-level scheduling.
Incorrect! Try again.
21In the Two-Level Model of multithreading:
A.Threads are managed only by the kernel.
B.Threads are managed only by the user.
C.It combines Many-to-Many and One-to-One models.
D.Two threads run on one processor.
Correct Answer: It combines Many-to-Many and One-to-One models.
Explanation:The Two-Level model allows a Many-to-Many relationship while also allowing specific user threads to be bound to specific kernel threads (One-to-One).
Incorrect! Try again.
22Which of the following is true regarding User-Level Threads?
A.The kernel is aware of them.
B.Context switching is generally faster than kernel-level threads.
C.They can utilize multiprocessor architectures easily without kernel support.
D.Blocking one user-level thread never blocks the entire process.
Correct Answer: Context switching is generally faster than kernel-level threads.
Explanation:User-level threads are managed by a library in user space. Switching does not require kernel privileges/mode changes, making it faster.
Incorrect! Try again.
23The Bakery Algorithm is a solution for:
A.The Reader-Writer problem.
B.Critical Section problem for processes.
C.Deadlock recovery.
D.Memory management.
Correct Answer: Critical Section problem for processes.
Explanation:Lamport's Bakery Algorithm is a classic solution to the Critical Section problem for processes, assigning tickets to determine entry order.
Incorrect! Try again.
24In the Producer-Consumer problem using semaphores, what does the semaphore empty typically represent?
A.The number of full slots in the buffer.
B.The number of empty slots available in the buffer.
C.The status of the critical section.
D.The ID of the consumer process.
Correct Answer: The number of empty slots available in the buffer.
Explanation:The empty semaphore is initialized to the buffer size () and decremented by producers, counting available spaces.
Incorrect! Try again.
25The signal(S) operation on a semaphore is typically defined as:
A.
B.
C.
D.
Correct Answer:
Explanation:signal(S) (or ) increments the semaphore value. If any processes are waiting, one is awakened.
Incorrect! Try again.
26Co-operating processes are those that:
A.Run on different computers.
B.Do not share any data.
C.Can affect or be affected by other processes executing in the system.
D.Are strictly sequential.
Correct Answer: Can affect or be affected by other processes executing in the system.
Explanation:Co-operating processes share state or data and their execution can impact one another.
Incorrect! Try again.
27Which mechanism informs a user-thread library that a kernel thread is about to block?
A.Downcall
B.Upcall
C.System Call
D.Interrupt
Correct Answer: Upcall
Explanation:In scheduler activations, the kernel uses an upcall to inform the application (thread library) about events like blocking or processor allocation.
Incorrect! Try again.
28In a Monitor, if a thread calls x.wait(), what happens to the lock the thread holds?
A.The thread keeps the lock.
B.The thread releases the lock and suspends.
C.The monitor is destroyed.
D.The thread deadlocks immediately.
Correct Answer: The thread releases the lock and suspends.
Explanation:To allow other processes to enter the monitor (potentially to signal condition ), the waiting thread must release the monitor lock before suspending.
Incorrect! Try again.
29What is the Entry Section in process synchronization code?
A.The code executed after the critical section.
B.The code that requests permission to enter the critical section.
C.The part of the code where shared data is accessed.
D.The initialization of the process.
Correct Answer: The code that requests permission to enter the critical section.
Explanation:The Entry Section surrounds the Critical Section; it contains the synchronization logic to request access.
Incorrect! Try again.
30The CompareAndSwap (CAS) instruction takes three arguments: a memory location, an expected value, and a new value. It updates the memory location ONLY if:
A.The memory location currently holds the new value.
B.The memory location currently holds the expected value.
C.The memory location is empty.
D.The CPU is in kernel mode.
Correct Answer: The memory location currently holds the expected value.
Explanation:CAS atomically compares the contents of a memory location with an expected value and, only if they are equal, modifies the contents to the new given value.
Incorrect! Try again.
31Which of the following is an example of a Heavyweight Process (HWP) compared to a thread?
A.A standard UNIX process with a single thread of control.
B.A Java thread.
C.A Pthread.
D.A Green thread.
Correct Answer: A standard UNIX process with a single thread of control.
Explanation:Standard processes are heavyweight because they own a complete set of resources (memory map, files) compared to lightweight threads that share them.
Incorrect! Try again.
32In the Dining Philosophers solution using a Monitor, a philosopher is allowed to eat only if:
A.Both neighbors are eating.
B.One neighbor is eating.
C.Neither neighbor is eating.
D.They have a fork in the left hand.
Correct Answer: Neither neighbor is eating.
Explanation:To prevent deadlock and ensure exclusion, a philosopher in a monitor solution checks that state[left] != EATING and state[right] != EATING.
Incorrect! Try again.
33If we use a semaphore to solve the Critical Section problem, the initial value of the semaphore should be:
A.
B.1
C.N
D.-1
Correct Answer: 1
Explanation:For Mutual Exclusion, the semaphore acts as a mutex. It starts at 1. The first process waits (decrements to 0) and enters. The next process waits (decrements to -1) and blocks.
Incorrect! Try again.
34In the Signal and Continue monitor discipline:
A.The signaling thread waits until the signaled thread completes.
B.The signaled thread waits until the signaling thread completes.
C.The signaling thread continues executing, and the signaled thread becomes ready.
D.Both threads terminate.
Correct Answer: The signaling thread continues executing, and the signaled thread becomes ready.
Explanation:In Signal and Continue (common in Java/Mesa), the signaler keeps the lock, and the awakened thread moves to the ready queue to acquire the lock later.
Incorrect! Try again.
35A library that provides support for thread creation and management in user space without kernel support is known as:
A.Kernel-Level Threads (KLT)
B.Green Threads
C.Hyperthreading
D.Scheduler Activations
Correct Answer: Green Threads
Explanation:Green threads are threads scheduled by a runtime library or VM (like early Java) instead of the OS kernel.
Incorrect! Try again.
36The fork() system call in a multithreaded environment (specifically POSIX):
A.Always duplicates all threads.
B.Is not allowed.
C.Usually duplicates only the calling thread.
D.Terminates the process.
Correct Answer: Usually duplicates only the calling thread.
Explanation:In many modern UNIX implementations (POSIX), fork() duplicates only the thread that called it, although some systems offer forkall().
Incorrect! Try again.
37What is Thread Local Storage (TLS)?
A.Data shared by all threads.
B.Data unique to each thread that persists across function calls.
C.The stack of the thread.
D.The CPU cache dedicated to a thread.
Correct Answer: Data unique to each thread that persists across function calls.
Explanation:TLS allows threads to have their own copy of global-like data (visible across functions but unique to the thread).
Incorrect! Try again.
38In the context of synchronization, what is Atomic Action?
A.An action that takes one clock cycle.
B.An action that effectively happens all at once or not at all (indivisible).
C.An action related to nuclear physics simulations.
D.An action that cannot be called by user programs.
Correct Answer: An action that effectively happens all at once or not at all (indivisible).
Explanation:Atomicity guarantees that an operation is not interrupted by context switches in a way that exposes intermediate states.
Incorrect! Try again.
39Which of the following is a classic solution to the Readers-Writers problem that prevents writer starvation?
A.Reader preference.
B.Writer preference.
C.First-Come First-Served queueing semaphores.
D.Spinlocks.
Correct Answer: Writer preference.
Explanation:To avoid writer starvation (where a continuous stream of readers keeps the writer waiting), the solution must implement writer preference or fair queueing.
Incorrect! Try again.
40The collection of instructions that follows the critical section is called the:
A.Entry Section
B.Remainder Section
C.Exit Section
D.Critical Section
Correct Answer: Exit Section
Explanation:The Exit Section follows the Critical Section (releasing locks), and the Remainder Section follows the Exit Section.
Incorrect! Try again.
41Which multithreading model is generally used by Windows and Linux?
A.Many-to-One
B.One-to-One
C.Many-to-Many
D.None
Correct Answer: One-to-One
Explanation:Windows and Linux (via NPTL) primarily use the One-to-One model, mapping every user thread to a kernel schedulable entity.
Incorrect! Try again.
42What does the hardware instruction Swap(a, b) do?
A.Adds a and b.
B.Atomically exchanges the contents of variables a and b.
C.Compares a and b.
D.Copies a to b.
Correct Answer: Atomically exchanges the contents of variables a and b.
Explanation:The Swap instruction atomically swaps values, often used to implement global boolean locks (key and lock).
Incorrect! Try again.
43In a Precedence Graph, if there is an edge from node to , it implies:
A. must finish before starts.
B. must finish before starts.
C. and must run in parallel.
D.There is a deadlock between and .
Correct Answer: must finish before starts.
Explanation:Directed edges in precedence graphs represent dependency; the source must complete before the destination can begin.
Incorrect! Try again.
44Which of the following describes the Grand Central Dispatch (GCD) approach to threading?
A.A manual thread creation library.
B.An Apple technology that manages thread pools and schedules blocks of code.
C.A hardware synchronization primitive.
D.A Linux kernel scheduler.
Correct Answer: An Apple technology that manages thread pools and schedules blocks of code.
Explanation:GCD (used in macOS/iOS) allows developers to identify sections of code (blocks) to run in parallel, and the OS manages the thread pool.
Incorrect! Try again.
45What happens if a process utilizing user-level threads (Many-to-One model) makes a blocking system call?
A.Only the calling thread blocks.
B.The entire process blocks.
C.The kernel switches to another thread in the same process.
D.The system call is ignored.
Correct Answer: The entire process blocks.
Explanation:Since the kernel sees the process as a single thread of control, a blocking call stops the entire process.
Incorrect! Try again.
46The solution to the Producer-Consumer problem requires which two types of synchronization?
A.Mutual Exclusion and Synchronization (Signaling)
B.Deadlock prevention and Avoidance
C.Hardware and Software
D.User and Kernel
Correct Answer: Mutual Exclusion and Synchronization (Signaling)
Explanation:It needs Mutual Exclusion for buffer access and Signaling (semaphores/condition variables) to handle full/empty buffer states.
Incorrect! Try again.
47When a thread is cancelled asynchronously:
A.The target thread checks periodically if it should terminate.
B.The target thread is terminated immediately by another thread.
C.The target thread finishes its current function.
D.The target thread creates a child thread.
Correct Answer: The target thread is terminated immediately by another thread.
Explanation:Asynchronous cancellation kills the thread immediately, which can be dangerous if the thread holds shared resources.
Incorrect! Try again.
48The Bounded-Buffer problem with buffers uses a semaphore mutex. What is its initial value?
A.
B.1
C.N
D.N-1
Correct Answer: 1
Explanation:The mutex semaphore protects the critical section (inserting/removing from the buffer), so it acts as a binary lock initialized to 1.
Incorrect! Try again.
49In the context of the Critical Section, Progress implies that:
A.Processes in the remainder section decide who enters next.
B.Only processes not executing in their remainder sections can participate in deciding which will enter the critical section next.
C.The CPU must always be 100% utilized.
D.Context switches must happen every 10ms.
Correct Answer: Only processes not executing in their remainder sections can participate in deciding which will enter the critical section next.
Explanation:Progress ensures that if no process is in the critical section and some wish to enter, the selection of the next process cannot be postponed indefinitely and is decided by those wishing to enter.
Incorrect! Try again.
50Which POSIX Pthread function is used to create a new thread?
A.pthread_create
B.pthread_start
C.pthread_fork
D.pthread_new
Correct Answer: pthread_create
Explanation:pthread_create is the standard API in the POSIX library to spawn a new thread.
Incorrect! Try again.
Give Feedback
Help us improve by sharing your thoughts or reporting issues.