q5solutions

Maximum unprocessed characters produced 20 b

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: y the Filter process? Maximum unprocessed characters produced: _______20______ (B) (4 points) What are appropriate initial values for each of the semaphores? initial value for charsA: ________0______ initial value for spaceA: _______20______ initial value for charsB: ________0______ initial value for spaceB: ________1______ 6.004 Spring 2010 - 3 of 4 - Quiz #5 (C) (4 points) For each of the following lines of code, indicate whether you would expect to find them in the Producer process, the Consumer process, or Neither process: in = (in+1)%20; in process (circle one): P C Neither signal(charsA); in process (circle one): P C Neither signal(indata); in process (circle one): P C Neither wait(charsB); in process (circle one): P C Neither (D) (3 points) Assuming that the only process synchronization appearing in the Producer and Consumer processes is the use of the four semaphores shown, will the above implementation work with multiple Producer processes? Multiple Filter processes? Multiple Consumer processes? “Work” means each character produced by a Producer is translated by exactly one Filter process and then consumed by exactly one Consumer process, i.e., no character is lost or processed twice. Works with multiple Producers (circle one): YES NO Works with multiple Filters (circle one): YES NO Works with multiple Consumers (circle one): YES NO END OF QUIZ! 6.004 Spring 2010 - 4 of 4 - Quiz #5...
View Full Document

This document was uploaded on 02/27/2014 for the course COMSCI 6.004 at MIT.

Ask a homework question - tutors are online