Computer Science 322 Quiz 9 Name _____________________ 1. When a unix pipe is used to emulate a semaphore: a. read() corresponds to wait() b. pipe() corresponds to wait() write() corresponds to signal() write() corresponds to signal() c. write() corresponds to wait() d. pipe() corresponds to wait() read() corresponds to signal() read() corresponds to signal() 2. The semaphore's "value" corresponds to: a. The number of times the pipe b. The number of pipes that have has been read() been created c. The number of times the pipe d. The number of bytes presently has been written to. in the pipe. 3. In the producer / consumer problem, the use of at least one mutex semaphore is necessary a. When there are multiple b. Whenever there are multiple producers and multiple consumers producers or muliple consumers. but not when there are multiple producers and a single consumer. c. Always d. Never 4. In the producer consumer-problem the consumer: a. waits on "items" and signals b. waits on "slots" and signals "items" after consuming. "items" after consuming. c. waits on "items" and signals d. waits on "slots" and signals "slots" after consuming. "slots" after consuming. 5. Deadlock can occur in a producer/consumer problem when the producers and the consumers use the same mutex semaphore and the consumer gets the waits in the wrong order: a. only when the buffer is full. b. only when the buffer is empty c. whenever the buffer is not d. whenever the buffer is not full empty