Filters
Question type

If a thread attempts a P operation when a counting semaphore has been decremented to zero, ________.


A) the thread obtains a resource from the pool and decrements the semaphore to -1
B) the thread obtains a resource from the pool and the semaphore remains equal to 0
C) the thread must wait until a resource is returned to the pool by a V operation
D) the thread returns a resource to the pool and increments the semaphore to 1

E) All of the above
F) C) and D)

Correct Answer

verifed

verified

Code inside a critical section should ________.


A) access shared, modifiable data
B) run as quickly as possible
C) prevent the possibility of infinite loops
D) all of the above

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

Semaphore operations can be implemented in the kernel of a multiprocessor system by:


A) giving one processor the job of controlling the ready list.
B) controlling access (via busy waiting) to a shared ready list.
C) both a and b
D) none of the above

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

An example of a producer/consumer relationship is ________.


A) an application that copies data from a fixed-size buffer to a CD-RW
B) a word processor that sends data to a buffer to be printed
C) both a and b
D) none of the above

E) C) and D)
F) All of the above

Correct Answer

verifed

verified

What happens when a thread calls P( S ) when it wants to enter its critical section, where S is a binary semaphore set to 1?


A) The thread is allowed to enter its critical section and S is decremented.
B) The thread is blocked and added to a queue of waiting threads.
C) The semaphore is set to 2.
D) none of the above

E) B) and C)
F) B) and D)

Correct Answer

verifed

verified

Which of the following statements about critical sections is false?


A) Only one thread at a time can execute the instructions in its critical section for a particular resource.
B) If one thread is already in its critical section, another thread must wait for the executing thread to exit its critical section before continuing.
C) Once a thread has exited its critical section, a waiting thread may enter its critical section.
D) All threads must wait whenever any critical section is occupied.

E) A) and C)
F) A) and D)

Correct Answer

verifed

verified

D

In Java, the sleep method call must appear in part of a ________ statement because it might throw an exception indicating that the thread was interrupted before its sleep time expired.


A) if...else
B) do...while
C) try...catch
D) switch

E) None of the above
F) C) and D)

Correct Answer

verifed

verified

Threads that operate independently of one another but must occasionally interact to perform cooperative tasks are said to execute ________.


A) synchronously
B) in parallel
C) asynchronously
D) simultaneously

E) None of the above
F) A) and C)

Correct Answer

verifed

verified

Which of the following statements about semaphores is true?


A) P and V operations should be indivisible operations.
B) If several threads attempt a P( S ) operation simultaneously, only one thread should be allowed to proceed.
C) A semaphore implementation should guarantee that threads do not suffer indefinite postponement.
D) all of the above

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

________ restricts access to a shared variable to only one thread at any given time.


A) asynchronism
B) serialization
C) protection
D) mutual exclusion

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

Which of the following mutual exclusion algorithms require instructions to be executed atomically?


A) Dekker's algorithm
B) Peterson's algorithm
C) Lamport's algorithm
D) both a and b

E) All of the above
F) A) and D)

Correct Answer

verifed

verified

Semaphores can be used for each of the following purposes except:


A) to protect access to a critical section
B) to notify the process that an event has occurred
C) to prevent shared variables from getting corrupted
D) to synchronize two or more concurrent threads

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

B

A thread that uses processor cycles to continually test a condition before entering its critical section is said to be ________.


A) lockstep synchronized
B) deadlocked
C) busy waiting
D) indefinitely postponed

E) C) and D)
F) B) and C)

Correct Answer

verifed

verified

The test-and-set instruction ________.


A) prevents deadlock
B) prevents indefinite postponement
C) eliminates the possibility that a thread is preempted between reading a value from a memory location and writing a new value to the memory location
D) none of the above

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

A ________ is a variable that governs access to critical sections.


A) primitive
B) lock
C) controller
D) flag

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

Which property of mutual exclusion primitives is inappropriate for multiprocessor systems?


A) The solution is implemented purely in software on a machine without specially designed mutual exclusion machine-language instructions.
B) No assumption can be made about the relative speeds of asynchronous concurrent threads.
C) A thread that is executing instructions outside its critical section cannot prevent any other threads from entering their critical sections.
D) A thread must not be indefinitely postponed from entering its critical section.

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

A

Lamport's Bakery Algorithm does not require ________.


A) a large number of shared variables
B) complicated loops
C) that any operations occur atomically
D) all of the above

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

In Java, Object method notify transitions a thread from the ________ state to the ________ state.


A) waiting, ready
B) blocked, waiting
C) running, waiting
D) ready, running

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Disabling interrupts ________.


A) is a viable solution for mutual exclusion in a multiprocessor system
B) on a uniprocessor system could result in an infinite loop causing the system to hang
C) typically prevents a thread from being preempted while accessing shared data
D) both b and c

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

________ occurs when an infinite loop prevents progress in a multithreaded application.


A) Lockstep synchronization
B) Deadlock
C) Busy waiting
D) Indefinite postponement

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

Showing 1 - 20 of 26

Related Exams

Show Answer