Hardware interview practice
Semaphores
What does ok become?
Starting point
Question code
semaphore s = new(2);
int ok;
initial begin
s.get(2);
ok = s.try_get(1);
endChoose one
Answer choices
- A. 0, because no key remains
- B. 1, because try_get creates a key
- C. 2, the initial key count
- D. The call blocks until a key is returned
