Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
Answer: A situation where several processes access and manipulate the same data concurrently and the outcome depends on the order of execution
A race condition occurs when the final state of shared data depends on the specific order in which instructions are executed by concurrent processes.
Question 2 of 50
Which of the following is NOT a requirement for a solution to the Critical Section Problem?
Not quite. Try another option.
Answer: processor Speed
The solution to the critical section problem must satisfy Mutual Exclusion, Progress, and Bounded Waiting. It should not rely on the relative speed of the processors.
Question 3 of 50
What does 'Mutual Exclusion' imply in the context of the Critical Section Problem?
Not quite. Try another option.
Answer: If a process is executing in its critical section, then no other processes can be executing in their critical sections
Mutual exclusion ensures that only one process at a time is active within the critical section to prevent data inconsistency.
Question 4 of 50
What is a Semaphore?
Not quite. Try another option.
Answer: A protected integer variable that can only be accessed via two atomic operations
A semaphore is a synchronization tool (an integer variable) accessed only through two standard atomic operations: wait() and signal().
Question 5 of 50
In a Semaphore, what does the 'wait' (or P) operation do?
Not quite. Try another option.
Answer: Decrements the semaphore value
The wait operation (P) decrements the semaphore value. If the value becomes negative, the process is blocked.
Question 6 of 50
What is the main disadvantage of a Spinlock?
Not quite. Try another option.
Answer: It requires busy waiting, wasting CPU cycles
Spinlocks cause the calling process to loop continuously (busy wait) while waiting for the lock to become available, which wastes CPU time.
Question 7 of 50
A binary semaphore is also known as a:
Not quite. Try another option.
Answer: Mutex lock
A binary semaphore can range only between 0 and 1, functioning similarly to a Mutex (Mutual Exclusion) lock.
Question 8 of 50
Which hardware instruction is commonly used to implement mutual exclusion?
Not quite. Try another option.
Answer: TestAndSet
TestAndSet is an atomic hardware instruction that tests a value and sets it, used to implement locks for mutual exclusion.
Question 9 of 50
What is the 'Bounded Waiting' requirement?
Not quite. Try another option.
Answer: There exists a 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
Bounded waiting ensures that a waiting process will eventually get into the critical section; it prevents starvation.
Question 10 of 50
In the Producer-Consumer problem using a bounded buffer, when does the Producer wait?
Not quite. Try another option.
Answer: When the buffer is full
If the buffer is full, the producer cannot add new items and must wait until the consumer consumes an item.
Question 11 of 50
Which of the following is a high-level synchronization construct that ensures mutual exclusion automatically?
Not quite. Try another option.
Answer: Monitor
A Monitor is a high-level abstraction where the compiler ensures that only one process can be active within the monitor at a time.
Question 12 of 50
In the Dining Philosophers problem, deadlock occurs if:
Not quite. Try another option.
Answer: All philosophers pick up their left chopstick simultaneously
If every philosopher picks up the left chopstick at the same time, they will all wait indefinitely for the right chopstick, causing a circular wait (deadlock).
Question 13 of 50
What is Peterson's Solution used for?
Not quite. Try another option.
Answer: Solving the Critical Section problem for two processes
Peterson's solution is a classic software-based solution to the critical section problem restricted to two processes.
Question 14 of 50
In Peterson's solution, which variables are shared between processes?
Not quite. Try another option.
Answer: turn and flag
Peterson's solution uses an integer variable 'turn' to indicate whose turn it is, and a boolean array 'flag' to indicate if a process is ready to enter the critical section.
Question 15 of 50
What problem is the Readers-Writers problem primarily concerned with?
Not quite. Try another option.
Answer: Ensuring exclusive access for writers while allowing multiple concurrent readers
The problem allows multiple readers to read at the same time but requires that if a writer is writing, no other process (reader or writer) can access the shared data.
Question 16 of 50
What happens to threads that call 'wait' on a Condition Variable in a Monitor?
Not quite. Try another option.
Answer: They are suspended and placed in a waiting queue
When a thread executes wait() on a condition variable, it releases the monitor lock and is suspended until another thread signals it.
Question 17 of 50
Which of the following is NOT shared by threads of the same process?
Not quite. Try another option.
Answer: Program Counter and Stack
Each thread has its own thread of execution, which requires a private Program Counter (PC), set of registers, and Stack. They share code, data, and files.
Question 18 of 50
What is a Heavyweight Process compared to a Thread?
Not quite. Try another option.
Answer: A process with a single thread of control
A traditional process (Heavyweight) has a single thread of control. Threads are often called Light Weight Processes (LWP).
Question 19 of 50
Which multithreading model maps many user-level threads to a single kernel thread?
Not quite. Try another option.
Answer: Many-to-One Model
The Many-to-One model maps multiple user threads to a single kernel thread. If one blocks, the entire process blocks.
Question 20 of 50
What is a limitation of the Many-to-One multithreading model?
Not quite. Try another option.
Answer: The entire process blocks if one thread makes a blocking system call
Since there is only one kernel thread, the OS sees the process as a single unit. If that unit blocks (e.g., for I/O), no other user thread in that process can run.
Question 21 of 50
Which multithreading model provides more concurrency than Many-to-One but doesn't require a kernel thread for every user thread?
Not quite. Try another option.
Answer: Many-to-Many Model
The Many-to-Many model multiplexes many user-level threads to a smaller or equal number of kernel threads.
Question 22 of 50
What is 'Scheduler Activation'?
Not quite. Try another option.
Answer: A mechanism for communication between the user-thread library and the kernel
Scheduler activations provide a communication channel (often via upcalls) to maintain the correct number of kernel threads for the application's user threads.
Question 23 of 50
Which standard defines the API for thread creation and synchronization (Pthreads)?
Not quite. Try another option.
Answer: POSIX
Pthreads refers to POSIX Threads, a standard (IEEE 1003.1c) defining an API for thread creation and synchronization.
Question 24 of 50
What is the function of pthread_join()?
Not quite. Try another option.
Answer: Waits for a specific thread to terminate
The pthread_join() function suspends execution of the calling thread until the target thread terminates.
Question 25 of 50
A Precedence Graph is a directed acyclic graph used to:
Not quite. Try another option.
Answer: Describe the execution dependencies among concurrent processes
Precedence graphs illustrate constraints on the order in which a collection of tasks or processes can execute.
Question 26 of 50
What defines 'Co-operating Processes'?
Not quite. Try another option.
Answer: Processes that can affect or be affected by other executing processes
Co-operating processes share state (data or resources) and can influence one another's execution, requiring synchronization.
Question 27 of 50
In the context of process hierarchy, what system call is typically used in Unix/Linux to create a new process?
Not quite. Try another option.
Answer: fork()
The fork() system call creates a new process (child) which is a copy of the calling process (parent).
Question 28 of 50
If a Semaphore S has a value of 10, and 5 P (wait) operations and 3 V (signal) operations are performed, what is the final value of S?
Answer: The Critical Section problem for N processes
The Bakery Algorithm is a solution to the critical section problem for N processes, based on the idea of taking tickets in a bakery.
Question 30 of 50
Which of the following is true regarding User-Level Threads (ULT)?
Not quite. Try another option.
Answer: Context switching is faster than Kernel-Level Threads
ULT management is done by a thread library in user space. Context switching is faster because it does not require kernel intervention (mode switching).
Question 31 of 50
In the One-to-One multithreading model, what is the main drawback?
Not quite. Try another option.
Answer: Creating a user thread requires creating a corresponding kernel thread, which creates overhead
While offering good concurrency, the overhead of creating a kernel thread for every user thread can burden the system.
Question 32 of 50
What is an 'Upcall' in the context of Scheduler Activations?
Not quite. Try another option.
Answer: A notification from the kernel to the thread library
The kernel uses an upcall to inform the application (thread library) about specific events, such as a processor becoming available or a thread blocking.
Question 33 of 50
Which synchronization primitive is typically used to solve the Reader-Writer problem to prevent writer starvation?
Not quite. Try another option.
Answer: Semaphores with a priority queue
Standard semaphores might lead to starvation; complex solutions or monitors often use priority mechanisms to ensure writers eventually get access.
Question 34 of 50
What is 'Priority Inversion'?
Not quite. Try another option.
Answer: A lower priority process holds a lock needed by a higher priority process
Priority inversion occurs when a high-priority task is indirectly preempted by a medium-priority task because a low-priority task holds a shared resource.
Question 35 of 50
How does the 'Swap' hardware instruction assist in synchronization?
Not quite. Try another option.
Answer: It swaps the content of two memory words atomically
The Swap instruction atomically exchanges the contents of two variables, which can be used to implement a lock (e.g., swapping a lock variable with 'true').
Question 36 of 50
In a Monitor, if process P executes x.signal() and process Q was waiting on x, and Q immediately executes while P waits, this strategy is called:
Not quite. Try another option.
Answer: Signal and Wait (Hoare semantics)
In Hoare semantics (Signal and Wait), the signaler blocks to let the waiting thread run immediately.
Question 37 of 50
Which component allows a thread to have its own copy of data?
Not quite. Try another option.
Answer: TLS (Thread Local Storage)
Thread Local Storage (TLS) allows each thread to have its own instance of a variable, separate from other threads.
Question 38 of 50
The problem where a producer tries to put an item into a full buffer is handled by:
Not quite. Try another option.
Answer: Putting the producer to sleep
In standard synchronization solutions, the producer waits (sleeps) on a semaphore or condition variable until space is available.
Question 39 of 50
Why is disabling interrupts not a viable solution for mutual exclusion in multiprocessor systems?
Not quite. Try another option.
Answer: It only disables interrupts on one processor, not all
Disabling interrupts prevents the current CPU from switching tasks, but other CPUs can still access shared memory, failing to guarantee mutual exclusion.
Question 40 of 50
What is 'Busy Waiting'?
Not quite. Try another option.
Answer: A process repeatedly checking a condition until it becomes true
Busy waiting involves a continuous loop that consumes CPU cycles while checking if a lock or condition is available.
Question 41 of 50
Which of the following is a valid state for a Java thread?
Not quite. Try another option.
Answer: All of the above
Java threads can be in states such as NEW, RUNNABLE (Running), BLOCKED, WAITING, TIMED_WAITING, or TERMINATED.
Question 42 of 50
In the context of threads, what is 'cancellation'?
Not quite. Try another option.
Answer: Terminating a thread before it has completed
Thread cancellation involves terminating a thread (the target thread) before it has finished its task (e.g., clicking 'Stop' in a web browser).
Question 43 of 50
Deferred cancellation of a thread means:
Not quite. Try another option.
Answer: The thread checks periodically if it should terminate
In deferred cancellation, the target thread periodically checks a flag to see if it should terminate, allowing it to clean up resources safely.
Question 44 of 50
A solution to the Dining Philosophers problem using a monitor restricts a philosopher to pick up chopsticks only if:
Not quite. Try another option.
Answer: Both neighbors are not eating
To prevent deadlock and ensure mutual exclusion, a philosopher is allowed to change state to 'EATING' only if both left and right neighbors are not in 'EATING' state.
Question 45 of 50
Which type of semaphore can take any non-negative integer value?
Not quite. Try another option.
Answer: Counting Semaphore
Counting semaphores can range over an unrestricted domain and are used to control access to a given number of resources.
Question 46 of 50
What defines a 'Thread Safe' function?
Not quite. Try another option.
Answer: It can be called from multiple threads simultaneously without producing incorrect results
Thread safety ensures that shared data structures are manipulated in a manner that guarantees safe execution by multiple threads at the same time.
Question 47 of 50
In the 'Sleeping Barber' problem (a variation of producer-consumer), what happens if the customer arrives and the waiting room is full?
Not quite. Try another option.
Answer: The customer leaves
In the standard Sleeping Barber problem, if there are no free chairs in the waiting room, the customer leaves the shop.
Question 48 of 50
What is the benefit of the 'Grand Central Dispatch' (GCD) technology in macOS/iOS?
Not quite. Try another option.
Answer: It manages thread pools and scheduling automatically
GCD is an extension that allows application developers to identify sections of code to run in parallel, while the OS manages the threads.
Question 49 of 50
Concurrency vs Parallelism: Which statement is true?
Not quite. Try another option.
Answer: Parallelism requires multiple processors/cores, Concurrency does not
Concurrency is about dealing with lots of things at once (logical), while Parallelism is about doing lots of things at once (physical hardware execution).
Question 50 of 50
What is the primary purpose of a Condition Variable?
Not quite. Try another option.
Answer: To allow threads to wait for a specific condition to become true
Condition variables are synchronization primitives that enable threads to wait until a particular condition (state) occurs.
That's unit 3
Answer a few questions and your score shows up here.
Nearly through. Did unit 3 of CSE316 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 3 of CSE316 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.