subject

Must be done in c
seeking ta problem
the computer science department runs a mentoring center to undergraduate students with their programming assignments.
the lab has a coordinator and several tas to assist the students. the waiting area of the center has several chairs. initially, all the chairs are empty.
the coordinator is waiting for the students to arrive and all the tas are waiting for students to be assigned by coordinator. a student who arrives at the center seeking sits in an
empty chair in the waiting area and waits to be called for taing. if no chairs are available, the student will come back at a later time. if the coordinator sees a student waiting, then the
coordinator wakes up an idle ta, if there is one, and assigns the student to the ta. if all the tas are busy assisting students, the coordinator waits for a ta to be free and then
assigns a waiting student to the ta. a ta after assisting a student, waits for the next student to be assigned to him using posix threads, mutex locks, and semaphores, implement a
solution that coordinates the activities of the coordinator, tas, and the students. some hints to implement this project are provided next.
implementation hints
using pthreads, begin by creating n students and m tas as separate threads. (n and m are arguments to the program.)
the coordinator will run as a separate thread. student threads will alternate between programming for a period of time and seeking from the ta. if the ta is
available, they will obtain . otherwise, they will either sit in a chair in the waiting area or, if no chairs are available, will resume programming and seek at a later time.
when a student arrives and finds an empty chair, the student must notify the coordinator using a semaphore. when the ta is free (initially and after a student)
, the ta must notify the coordinator using a semaphore. also, waiting students and tas must be woken up by the coordinator using separate semaphores. for details on
how to use pthreads, synchronization primitives mutex and semaphores see the book.
to simulate programming and getting in students threads, and the ta providing to a student in the ta thread, the appropriate threads should sleep (by invoking for a random of time (up to three seconds).
the total number of students, the number of tas, the number of chairs, and the number of times a student seeks a ta’s are passed as command line arguments
as shown below (csmc is then ame of the executable):
csmc #students#tas#chairs#
csmc 10 3 4 5
once a student thread takes the required number of from the tas, it should terminate. once all the student threads are terminated, the ta threads, the coordinator thread, and finally the main program should be terminated.
output
your program must output the following at the appropriate times:
student [#] takes a seat.
waiting students = [# of students waiting]
student [#] found no empty chair will try again later
ta [#] student for [#] seconds.
waiting students = [# of students waiting]

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
What is the largest decimal number that can be represented by a binary number with 4 place values? (remember, each place in a binary number has a value of a power of 2, starting in the ones place with 20.)
Answers: 3
question
Computers and Technology, 22.06.2019 05:00
This program will store roster and rating information for a soccer team. coaches rate players during tryouts to ensure a balanced team. (1) prompt the user to input five pairs of numbers: a player's jersey number (0 - 99) and the player's rating (1 - 9). store the jersey numbers in one int vector and the ratings in another int vector. output these vectors (i.e., output the roster). (3 pts) ex: enter player 1's jersey number: 84 enter player 1's rating: 7 enter player 2's jersey number: 23 enter player 2's rating: 4 enter player 3's jersey number: 4 enter player 3's rating: 5 enter player 4's jersey number: 30 enter player 4's rating: 2
Answers: 1
question
Computers and Technology, 22.06.2019 07:00
Idon understand these and need some ! ?
Answers: 2
question
Computers and Technology, 22.06.2019 16:20
It policy compliance and emerging technologies respond to the following: propose at least three control measures that organizations need to put in place to ensure that they remain complaint with emerging technologies and in a continually changing it environment. examine the correlation of effective configuration management and change control procedures to remain compliant with emerging technologies and it security changes.
Answers: 2
You know the right answer?
Must be done in c
seeking ta problem
the computer science department runs a mentoring...
Questions
question
Mathematics, 30.10.2020 19:50
question
History, 30.10.2020 19:50
question
Advanced Placement (AP), 30.10.2020 19:50
question
History, 30.10.2020 19:50
Questions on the website: 13722359