Question: WRITE A PSEUDO-CODE SOLUTION USING SEMAPHORES Do NOT use wait( ), notify( ) or notifyAll( ) as monitor methods. Whenever synchronization issue can be resolved

WRITE A PSEUDO-CODE SOLUTION USING SEMAPHORES

Do NOT use wait( ), notify( ) or notifyAll( ) as monitor methods. Whenever synchronization issue can be resolved use semaphores and not a different type of implementation

WRITE A PSEUDO-CODE SOLUTION USING SEMAPHORES Do NOT use wait( ), notify(

Students come to school (simulated by sleep of random time) and wait for the instructor to arrive and open the door. Each student should attempt to take two exams. After two attempts (successful or not) student will group in groups of size group size Once the instructor arrives (sleep of random time), he allows students to enter the classroom and wait until is time for the exam to start. Students enter the classroom up to the classroom's capacity and eventually wait for the Instructor to handout the exam. The last student to fit in the classroom will let the instructor know that the exam needs to start. f the classroom is full or if the student didn't make it by the time the exam starts, we consider that the student missed the exam. The Instructor hands out the exam (signal) to students in the order in which the student entered the classroom. Next students work on the exam and wait for the Instructor to signal them when exam ended Throughout the duration of the exam, the Instructor sleeps (of fixed amount of time). When he wakes up, he allows all the students to leave the classroom. Next, the instructor and students (who took the exam) will take a break (sleep of random time) and get ready for the next exam NOTE: The students who missed the exam are already waiting to enter the classroom for the next exam At the end of the day, the exam grades for each student should be displayed (exam1, exam2) You can assign grades by generating random numbers between 10 and 100. If a student missed an exam, his grade will be 0 Once the grades are posted, students will groups of groups Size and next they will leave. Glve a display of the name of students grouping together. The instructor waits for all students to leave. The last student to leave will let the teacher that is time to go home. The instructor will terminate after all students leave The main thread will terminate once the instructor leaves as well. Default values: number of students: 14 class capacity: group size

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!