1/19
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which of the following critical-section problem's requirement ensures only one process is active in its critical section at a time?
• mutual exclusion
• progress
• bounded waiting
• none of the above
• mutual exclusion
Which of the following is true for race condition?
• race condition occurs where several processes access and manipulate the same data concurrently (WRONG)
•when race condition occurs, the outcome of the execution depends on the particular order in which the access takes place
• both of the above
• none of the above
• both of the above (UNSURE)
In _____, the process may be changing common variables, updating a table, writing a file, and so on.
• entry section
• critical section
• exit section
• remainder section
• critical section
Which of the following is true for the solutions to critical-section problems?
• No deadlock implies progress, and progress implies bounded waiting
• Bounded waiting implies progress, and progress implies no deadlock
• Progress implies no deadlock, and no deadlock implies bounded waiting
• Bounded waiting implies no deadlock, and no deadlock implies progress
• Bounded waiting implies progress, and progress implies no deadlock
Which of the following critical-section problem's requirements limits the amount of time a program will wait before it can enter its critical section?
• mutual exclusion
• progress (WRONG)
• bounded waiting
• none of the above
• bounded waiting
Which of the following solutions needs hardware support for the critical section problem?
• memory barriers
• compare_and_swap instruction
• atomic variables
• all of the above
• all of the above
Which of the following is NOT true about test_and_set instruction?
• It is a hardware instruction
• It is executed atomically
• Returns the original value of passed parameter
• Returns the new value of passed parameter
• Set the new value of passed parameter to "TRUE"
• Returns the new value of passed parameter
When mutex lock is implemented as binary semaphore, what should its value be initialized to be?
• 0
• 1
• -1
• none of the above
• 1
Assume the binary variable lock is initialized to be 0, which of the following can be an implementation of the entry section to solve the critical-section problem?
• while (compare and swap(&lock, 0 , 1) != 0), do nothing;
• while (test and set(&lock)), do nothing;
• both A and B
• none of the above
•
Which of the following is a software-based solution to the critical-section problem?
• Peterson's solution
• test_and_set
• compare_and_swap
• all of the above
• Peterson's solution
Which of the following is NOT true regarding semaphore implementation?
• It suffers from the busy waiting problem
• Semaphore has a waiting queue associated with the semaphores
• When a process executes the wait() operation and finds that the semaphore value is not positive, it will suspend itself
• A process that is suspended, waiting on the semaphore, should be restarted when some other process executes a signal() operation (WRONG)
• It suffers from the busy waiting problem (UNSURE)
Which of the following statements is true in multi-core SMP system?
• A counting semaphore can never be used as a binary semaphore.
• A binary semaphore can never be used as a counting semaphore.
• Spinlocks can be used to prevent busy waiting in the implementation of semaphore instead of disabling interrupts.
• Counting semaphores can be used to control access with a finite number of instances.
•
Which of the following indicates that Pi can enter the critical section in Peterson's solution?
• flag[j] == false or turn == i
• flag[j] == true or turn == i
• flag[j] == false or turn == j
• flag[j] == true or turn == j
• flag[j] == false or turn == i
What is the correct order of operations for protecting a critical section using a binary semaphore?
• release() followed by acquire()
• acquire() followed by release()
• wait() followed by signal()
• signal() followed by wait()
• wait() followed by signal()
The counting semaphore is initialized to _____.
• 0 (WRONG)
• 1
• the number of resources available
• none of the above
• the number of resources available (UNSURE)
Which of the following variables are shared between the processes in Peterson's solution?
• int turn
• boolean flag[2]
• both of the above
• none of the above
• both of the above
Which of the following is NOT true regarding conditional value, e.g. x?
• The only operations that can be invoked on a condition variable are wait() and signal()
• x.wait() means that the process invoking this operation is suspended until another process invokes x.signal() (WRONG)
• The x.signal() operation resumes exactly one suspended process
• If no process is suspended, then the signal() operation still affects the state of the semaphore
• If no process is suspended, then the signal() operation still affects the state of the semaphore (UNSURE)
Which of the following regarding mutex lock is NOT true?
• mutex lock is a hardware solution to critical-section problem
• mutex lock is a higher-level software solution to critical-section problem
• mutex lock suffers from busy waiting
• the general rule of thumb is to use mutex lock if the lock will be held for a duration less than two context switches
• mutex lock is a hardware solution to critical-section problem
Which of the following is NOT true for Peterson's solution?
• Mutual exclusion is preserved
• The progress requirements is satisfied
• The bounded-waiting requirement is met
• Peterson's solution works for synchronization among more than two processes
• Peterson's solution works for synchronization among more than two processes
Which of the following is true?
• No deadlock implies no starvation;
• No starvation implies no deadlock;
• Deadlock doesn't imply starvation;
• Starvation implies deadlock;
• Deadlock doesn't imply starvation;