NEW
Font size
WorksheetsBCS303-4
Total questions: 23
Worksheet time: 12mins
A cooperating process is one that —
Never shares data
Affects or is affected by other processes
Runs faster than other processes
Uses multiple CPUs
Concurrent access to shared data may lead to —
Faster execution
Data inconsistency
Deadlock only
No issues
The producer–consumer problem is an example of —
Deadlock
Race condition
Synchronization problem
Memory allocation
A race condition occurs when —
A process runs too slow
Processes access shared data in a critical section incorrectly
CPU switches tasks frequently
Memory becomes full
Critical section refers to —
Code that executes input-output
The portion of code accessing shared data
A non-executable code region
CPU registers
Peterson’s solution works for —
Multiple processes
Exactly two processes
Operating systems only
Memory management
In Peterson’s solution, flag[i] = true means —
Process does not want to enter
Process is ready to enter critical section
Process is terminated
Process is sleeping
The variable turn in Peterson’s solution indicates —
Next process to be created
Whose turn it is to enter critical section
CPU speed
Interrupt request
Hardware instruction used for mutual exclusion —
fork()
testAndSet()
printf()
malloc()
testAndSet() is —
Non-atomic
Atomic
Non-deterministic
Optional
A semaphore is —
A data structure
An integer variable used for synchronization
A hardware device
A CPU scheduling algorithm
Operation that decreases semaphore value —
spawn()
signal()
wait()
stop()
Operation that increases semaphore value —
wait()
signal()
block()
exit()
A binary semaphore can take values —
0 and 1
Any integer
-1 and 1
1 to 10
A counting semaphore can take —
Only 0
Only 1
Only non-negative integers
Only even values
Which problem is associated with managing a buffer shared by multiple processes?
Dining philosophers
Bounded-buffer problem
Reader–writer problem
Memory management
In the bounded-buffer problem, what is the initial value of 'empty'?
0
N
1
-1
In the reader–writer problem, what is true about multiple readers?
Cannot read simultaneously
Can read simultaneously
Can't access shared data
Must wait for writers
In the reader–writer problem, what does the first reader do?
Ignores the writer
Locks the shared resource for all readers
Must wait
Signals writer
What issue does the dining philosophers problem address?
Memory allocation
Deadlock and starvation
Network security
CPU scheduling
In the dining philosophers problem, how is each chopstick represented?
Binary semaphore
Counting semaphore
Mutex only
Thread
Mutual exclusion ensures —
No two processes enter critical section together
All processes enter together
Faster CPU speed
Unlimited waiting
Semaphore wait() operation contains —
S++
S--
S = 0
S = S + 10
