WITH DETAILED ANSWERS
What can be used to prevent busy waiting when a semaphore is
implemented? - ANSWER-waiting queues
-it's in the question
For the Readers-Writers Problem, we saw the structure of a reader
process. Assume that there is currently one reader process that is
performing reading, and there are no other processes in the system.
What happens if another reader process arrives?
code:
do {
wait(mutex); read_count++;
if (read_count == 1)
wait(rw_mutex);
signal(mutex);
...
,/* reading is performed */
...
wait(mutex);
read count--;
if (read_count == 0)
signal(rw_mutex);
signal(mutex);
} while (true); - ANSWER-It will enter the section marked as "/* reading is
performed */ "
Monitors - ANSWER--A high-level abstraction that provides a convenient
and effective mechanism for process synchronization
-one process at a time
-for java, not c
Monitors represent a theoretical concept that has been proposed which is
not encountered in modern programming languages. - ANSWER-false
-we use em and implement em
,context switch - ANSWER-saves the state of the currently running
process and restores the state of the next process to run
A process executing an atomic instruction cannot be context-switched
regardless of how much clock cycles it takes to complete that instruction.
- ANSWER-True
-something atomic cannot be switched according to definition
The term "mutex" is formed by combining "mutual exception" - ANSWER-
false (MUTual EXclusion)
A mutex can take any of the value -1, 0, 1 - ANSWER-false (0,1)
An "atomic instruction" refers to a an instruction in a high level language
such as C. - ANSWER-false
Why is the the mutex semaphore used in the implementation of the
bounded-buffer problem using semaphores? - ANSWER-It ensures mutual
exclusion. (MUtual EXclusion)
, When using mutex locks, which is the correct sequence for implementing
a critical section? - ANSWER-acquire() followed by release()
load balancing - ANSWER-Distributing a computing or networking
workload across multiple systems to avoid congestion and slow
performance.
Processor affinity - ANSWER-unbinding of a process or a thread to a CPU,
so that the process or thread will execute only on the designated CPU
We had seen that when using semaphores, a process invokes the wait()
operation before entering its critical section, and then the signal()
operation upon completion of its critical section. Consider reversing the
order of these two operations—first calling signal(), then calling wait().
What would be a possible outcome of this? - ANSWER-Several processes
could be active in their critical sections at the same time.
T/F The value of a counting semaphore can range only between 0 and 1. -
ANSWER-false
-counting semaphores are essentially integer variables