NEW
Font size
WorksheetsQuiz 04 - Applied OS
Total questions: 60
Worksheet time: 3600secs
What is the primary issue illustrated by the dining philosophers problem?
Resource allocation
Memory management
Process scheduling
File handling
In the dining philosophers problem, how many forks are available for five philosophers?
5
10
2
1
What condition leads to a deadlock in the dining philosophers scenario?
All philosophers eat simultaneously
Each philosopher holds one fork and waits for another
Philosophers leave the table
Forks are not available
What is starvation in the context of process scheduling?
A process is unable to execute due to lack of resources
A process is terminated unexpectedly
A process runs indefinitely
A process is waiting for user input
Which of the following is a solution to prevent deadlock?
Allowing processes to hold resources indefinitely
Resource preemption
Ignoring the problem
Increasing the number of resources
In multiprogramming, what is the main advantage of interleaving processes?
Increased memory usage
Improved CPU utilization
Simplified process management
Reduced context switching
What happens when a process is in a waiting state?
It is executing instructions
It is terminated
It is waiting for a resource to become available
It is using the CPU
Which philosopher starts eating first in the dining philosophers problem?
Philosopher 2
Philosopher 1
Philosopher 3
Philosopher 5
What is the role of the operating system in multiprogramming?
To allocate memory only
To manage CPU scheduling and resource allocation
To execute user applications
To handle input/output operations
Which of the following can lead to starvation?
Fair scheduling algorithms
Priority-based scheduling
Round-robin scheduling
First-come, first-served scheduling
What is a common method to resolve deadlocks?
Ignoring the issue
Resource allocation graph
Increasing the number of processes
Allowing indefinite waiting
In the context of the dining philosophers problem, what is a safe state?
A state where all philosophers can eat simultaneously
A state where at least one philosopher can eat
A state where no philosopher can eat
A state where forks are not needed
What is the main goal of multiprogramming?
To minimize resource usage
To maximize CPU utilization
To simplify programming
To reduce the number of processes
Which of the following is NOT a characteristic of a deadlock?
Mutual exclusion
Hold and wait
Preemption
Circular wait
What is the effect of a process being starved?
It runs faster
It may never get CPU time
It consumes more resources
It terminates immediately
In the dining philosophers problem, what is required for a philosopher to eat?
One fork
Two forks
No forks
A plate of spaghetti
Which scheduling algorithm can help prevent starvation?
Shortest Job First
Round Robin
Priority Scheduling
First-Come, First-Served
What is the primary resource contention in the dining philosophers problem?
Plates
Forks
Spaghetti
Chairs
Which of the following is a potential solution to the dining philosophers problem?
Allowing philosophers to take forks at random
Implementing a waiter to control fork access
Increasing the number of forks
Allowing philosophers to eat with one fork
What is the main disadvantage of priority scheduling?
It is easy to implement
It can lead to starvation
It uses too many resources
It is inefficient
In the context of deadlocks, the condition 'Circular Wait' is best described as:
A process holding a resource while waiting for another that is held by a different process also in a wait state.
A resource that can only be used by one process at a time, like a printer.
The operating system's inability to reallocate a resource from a process that is waiting for another.
A process being indefinitely denied the resources it needs because of a flawed allocation policy.
The 'Banker's Algorithm' is primarily a strategy for:
Deadlock prevention by eliminating the possibility of a circular wait.
Deadlock avoidance by ensuring the system never enters an unsafe state.
Deadlock detection by reducing a resource allocation graph.
Deadlock recovery by selecting and terminating a victim process.
In the dining philosophers problem, if the custom is changed so that a philosopher must pick up both forks simultaneously or none at all, which deadlock condition is directly addressed?
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
A real-time life support system's OS must absolutely avoid deadlocks. The most suitable strategy would be:
Detection and Recovery, as it has the least impact on system performance.
Prevention, by enforcing a resource ordering scheme to eliminate circular wait.
Avoidance, using an algorithm like the Banker's to dynamically assess each request.
Ignoring the issue, as deadlocks are merely an inconvenience in all systems.
What is the fundamental difference between deadlock and starvation?
Deadlock involves multiple processes; starvation affects only a single process.
Starvation is a system-wide issue, while deadlock only affects a few jobs.
Deadlock is resolved by preemption; starvation is resolved by process termination.
In a deadlock, processes are active but blocked; in starvation, a process is inactive.
In a spooling system (Case 5), a deadlock can occur because:
Two jobs request the same dedicated device, like a plotter.
The printer requires a complete job output before printing, but the spooler is filled with partial outputs from multiple jobs.
Records in a database are locked by two processes in an alternating sequence.
A network node's output buffers are full and it cannot accept messages to clear them.
The phenomenon where the read/write arm of a disk moves incessantly between tracks due to conflicting commands but satisfies no requests is a classic example of:
Deadlock
Starvation
Livelock
Race Condition
In the context of database management, a 'race' is problematic because:
It always leads to a permanent system deadlock.
It introduces an element of chance, potentially corrupting data integrity.
It prevents any process from ever completing its transaction.
It is the only way to achieve high concurrency in a database system.
The 'resource allocation graph' reduction method is a technique used for:
Deadlock Prevention
Deadlock Avoidance
Deadlock Detection
Deadlock Recovery
When selecting a "victim" for process termination to recover from a deadlock, the LEAST important factor to consider is typically:
The priority of the job.
The CPU time the job has already used.
The number of resources the job is holding.
The color of the user's terminal.
If a system uses a policy where a process must request all required resources at creation time and is blocked until all are available, it is attempting to prevent deadlock by eliminating which condition?
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
A system is in a "safe state" if:
There are no deadlocked processes currently.
The operating system can allocate resources to each process in some order and still avoid a deadlock.
All processes have been allocated their maximum required resources.
The resource allocation graph contains no cycles.
The four necessary conditions for deadlock must occur:
In a specific, predetermined order.
Simultaneously.
Only in batch processing systems.
Only if the system has a master/slave configuration.
Which case of deadlock involves processes waiting for messages in a network where buffer space is exhausted?
Case 1: File Requests
Case 3: Dedicated Device Allocation
Case 6: Network
Case 7: Disk Sharing (Livelock)
An "unsafe state" in the Banker's Algorithm implies:
A deadlock has definitely occurred.
A deadlock is impossible.
A deadlock is possible but not inevitable.
The system must immediately preempt resources.
The key challenge in a symmetric multiprocessing (SMP) configuration is:
Ensuring the master processor does not fail.
Allowing each processor to have its own private memory and I/O devices.
Managing process synchronization to avoid races and deadlocks over shared resources.
Assigning entire jobs to a single processor for its entire lifespan.
The main advantage of the "WAIT and SIGNAL" synchronization mechanism over "test-and-set" is that it:
Is a simpler hardware instruction to implement.
Allows for more complex semaphore values beyond 0 and 1.
Eliminates busy waiting, freeing the CPU for other work.
Guarantees first-come, first-served access to the critical region.
In the Producer-Consumer problem, the semaphore "empty" is used to:
Count the number of full slots in the buffer.
Ensure mutual exclusion for the buffer itself.
Count the number of empty slots in the buffer.
Signal the consumer that it must wait.
A "critical region" is a code segment that:
Handles all of a process's I/O operations.
Must be executed by the operating system kernel.
Accesses a shared resource and must not be interleaved with other processes' execution.
Contains the program's main function.
The significant difference between a "process" and a "thread" is that threads within the same process:
Have their own complete set of PCB information and private memory space.
Are always executed on different physical processors.
Share the same code and data sections, reducing context-switching overhead.
Cannot communicate with each other under any circumstances.
In a multi-core processor system, a single-threaded application will:
Automatically run faster due to the increased number of cores.
Likely not see a performance increase, as it cannot utilize the additional cores.
Cause a deadlock because the OS doesn't know how to schedule it.
Be split into multiple threads by the compiler (implicit parallelism).
The state a thread enters when it issues an I/O request is typically:
Ready
Running
Blocked
Finished
The main goal of process synchronization is to:
Ensure all processes have an equal share of CPU time.
Prevent deadlocks from ever occurring under any circumstance.
Coordinate interacting processes so that inconsistent views of shared data are prevented.
Increase the degree of multiprogramming as much as possible.
A system with multiple processors, each with its own private memory and operating system, connected by a high-speed link, is best described as:
A symmetric multiprocessing (SMP) system
A loosely coupled system
A master/slave system
A multi-core system
The "busy waiting" problem associated with the test-and-set instruction refers to:
Processes productively using the CPU while waiting for a resource.
Processes wasting CPU cycles by continuously polling a lock variable.
The high utilization of a critical region.
The efficient operation of the WAIT and SIGNAL mechanism.
The strategy of numbering all resource types and requiring processes to request resources in strictly increasing order is a prevention technique aimed at eliminating:
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
In a system where a failed process automatically releases all its resources, which deadlock condition is being leveraged for recovery?
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
A process that is perpetually denied necessary resources, even though they are periodically available, is suffering from:
Deadlock
Livelock
Starvation
Race Condition
The directed graph for a system shows a cycle. This necessarily means:
The system is in an unsafe state.
A deadlock exists.
A deadlock is possible if all processes represented in the cycle are active.
The system has a circular wait condition, which is always fatal.
Which of the following is NOT a necessary condition for deadlock?
Mutual Exclusion
Preemptive Allocation
Hold and Wait
Circular Wait
A system has three identical printers. The deadlock prevention technique that would be most difficult to apply to these resources is:
Eliminating Mutual Exclusion (making printers sharable)
Eliminating Hold and Wait (request all printers at once)
Eliminating No Preemption (taking a printer from a process)
Eliminating Circular Wait (numbering the printers)
Detecting starvation typically requires the operating system to:
Build a resource allocation graph and look for cycles.
Monitor the length of time processes spend in the ready queue.
Calculate if the system is in a safe state before every allocation.
Preempt resources from processes that have held them the longest.
In a database transaction, if Process A has locked Record R1 and requests Record R2, while Process B has locked Record R2 and requests Record R1, the resulting situation is a:
Race condition
Starvation
Deadlock
Livelock
If the solution to the dining philosophers problem requires a philosopher to always pick up the lower-numbered fork first, this prevents deadlock by addressing:
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
A major problem with preempting a resource from a process to resolve a deadlock is:
It violates the Mutual Exclusion condition.
It can be impossible or very costly for certain resources
It only works for memory resources, not I/O devices.
It immediately causes starvation for the preempted process.
In a loosely coupled multiprocessing system, the primary challenge is:
Synchronizing access to shared memory.
Dynamically balancing the load between independent systems.
Preventing a single master processor from becoming a bottleneck.
Designing a decentralized scheduling algorithm.
The main advantage of multi-core processors over single-core processors is:
Each core runs at a significantly higher clock speed.
They can execute multiple threads truly in parallel.
They eliminate the need for cache memory.
They simplify the operating system's scheduling algorithm.
A significant disadvantage of the master/slave multiprocessing configuration is:
The high cost of hardware for each processor.
The master processor can become a performance bottleneck.
The inability to run any commercial operating system.
The complexity of synchronizing processes across different memory spaces.
In a symmetric multiprocessing (SMP) system, a single ready queue for all processors can lead to:
Increased complexity in the scheduling algorithm.
A situation where one processor is idle while another is overloaded.
Better cache performance due to data locality.
Processes being unable to access shared memory.
The primary goal of process synchronization is to ensure:
All processes get an equal share of CPU time.
The system never enters an unsafe state.
The consistency of shared data in a concurrent environment.
That deadlocks are completely eliminated.
