Worksheetssynchronization
Total questions: 8
Worksheet time: 5mins
In the reader/writer synchronization scheme, when some processes are reading
a new writer can write
a new writer cannot write
a new reader can read
a new reader cannot read
In the reader/writer synchronization scheme, when a process is writing
a new writer can write
a new writer cannot write
a new reader can read
a new reader cannot read
With Posix monitors, when you call pthread_cond_signal(&condition);
the next thread which calls pthread_cond_wait() on the condition will not block
one thread which is blocked on the condition is resumed
if no thread is blocked on the condition, nothing happens and the signal is lost
all the threads which are blocked on the condition are resumed
With semaphores, the P() function
suspends the calling process if the counter is positive
suspends the calling process if the counter is negative
increments the counter
decrements the counter
In a Posix monitor, what happens if we don't use the mutex lock ?
the executing thread can block
the shared data may become unconsistent
we can have a deadlock
all the threads can access the shared data at the same time
In the prodcons labwork with the products and freeslots conditions
possibly no threads are blocked on any of the two conditions
possibly threads are blocked on both conditions
if threads are blocked, they are all blocked on the same condition
a thread can block at the same time on both conditions
In the prodcons labwork, the buffer will be most of the time
empty if we create more producer threads
full if we create more producer threads
empty if we create more consumer threads
full if we create more consumer threads
In the prodcons labwork with the products and freeslots conditions, if I produce, I must:
test if the buffer is empty
test if the buffer is full
possibly block on the freeslots condition
possibly block on the products condition
