Consider this code for the producer-consumer problem: semaphore e = n, f = 0; /* e = empty buffer, f = full buffer */ binary_semaphore b = 1; producer: while (1) { P(e); bP(b); add_to_buffer; bV(b); V(f); } consumer: while (1) { P(f); bP(b); take_from_buffer; bV(b); V(e); }
(1) What is the effect of interchanging bP(b) and P(e) in the producer process in the producer-consumer problem?
(2) What is the effect of exchanging bV(b) and V(f) in the producer process in the producer-consumer problem?