Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

synchronization

Total questions: 8

Worksheet time: 5mins

Name
Class
Date
1.

In the reader/writer synchronization scheme, when some processes are reading

a)

a new writer can write

b)

a new writer cannot write

c)

a new reader can read

d)

a new reader cannot read

2.

In the reader/writer synchronization scheme, when a process is writing

a)

a new writer can write

b)

a new writer cannot write

c)

a new reader can read

d)

a new reader cannot read

3.

With Posix monitors, when you call pthread_cond_signal(&condition);

a)

the next thread which calls pthread_cond_wait() on the condition will not block

b)

one thread which is blocked on the condition is resumed

c)

if no thread is blocked on the condition, nothing happens and the signal is lost

d)

all the threads which are blocked on the condition are resumed

4.

With semaphores, the P() function

a)

suspends the calling process if the counter is positive

b)

suspends the calling process if the counter is negative

c)

increments the counter

d)

decrements the counter

5.

In a Posix monitor, what happens if we don't use the mutex lock ?

a)

the executing thread can block

b)

the shared data may become unconsistent

c)

we can have a deadlock

d)

all the threads can access the shared data at the same time

6.

In the prodcons labwork with the products and freeslots conditions

a)

possibly no threads are blocked on any of the two conditions

b)

possibly threads are blocked on both conditions

c)

if threads are blocked, they are all blocked on the same condition

d)

a thread can block at the same time on both conditions

7.

In the prodcons labwork, the buffer will be most of the time

a)

empty if we create more producer threads

b)

full if we create more producer threads

c)

empty if we create more consumer threads

d)

full if we create more consumer threads

8.

In the prodcons labwork with the products and freeslots conditions, if I produce, I must:

a)

test if the buffer is empty

b)

test if the buffer is full

c)

possibly block on the freeslots condition

d)

possibly block on the products condition