Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an outline of a multithreading algorithm that simulate the following case: In the cs lab, 1 0 students practice writing programs. Student alternate between

Write an outline of a multithreading algorithm that simulate the following case:
In the cs lab, 10 students practice writing programs.
Student alternate between programming for some time and going for help from the teacher.
When arrived to the teacher, students will get help if he is available. Otherwise, they either sit in the waiting chair or if TA is busy resume programming and will seek help at later time. There are two waiting seats outside the teachers' room.
If there are no waiting students sitting on the chairs, the teacher takes a nap. If one student arrive he will wake up the teacher who then will call one student in for help.
When the teacher finishes helping a student, he must check to see if there are students waiting for help. If so, the TA must help each of these students in turn. If no students are present, the teacher may return to napping.
You may simulate students programming - as well as the teacher providing help to a student - is to have the appropriate threads sleep for a random period of time.
In you answer, identify the critical regions (shared resources), identify the number of threads, name of threads, role of each thread, semaphores you need to use to synchronize between the threads.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

Contrast the terms expense and expenditure.

Answered: 1 week ago