Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Students decide to meet and go watch a movie. After they gather together in grou

ID: 3771026 • Letter: S

Question

Students decide to meet and go watch a movie. After they gather together in groups of group_size, they go buy tickets. Each student buys his own ticket (becomes a customer). There are two ticket-booths (each booth has one clerk). If the clerk is available it will serve the next customer on line (one customer at a time). There is only one line for both booths. Using semaphores and operations on semaphores, synchronize the two thread types: Student and Clerk. There are numStundents (default 9) and numClerks (default 2). Consider that there are no customers on line at the booth in the early morning. From the clerk's point of view (it is up to you) you can consider that both clerks were already at work or that neither of them has arrived yet (when the first customer showed up). There are more customers than numStudents. Give the type, initial value of each semaphore used, and shortly explain its use. Don't use Boolean variables if their use can be replaced by semaphores. Roughly before the synchronization, a possible execution pseudo-code for the threads might be:

Explanation / Answer

The given snippets really doesn’t server you much, below are few useful things: