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 04:00
Which spereadsheet type will determine how well a bussiness has done over the past year
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen too
Answers: 2
question
Computers and Technology, 24.06.2019 12:50
Write a new lc-3 trap subroutine (i.e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i.e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e.g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e.g. b0000 0000 0000 0111 =
Answers: 3
question
Computers and Technology, 24.06.2019 16:50
Ramp charts are generally created in wordlotusexcelpowerpoint
Answers: 1
You know the right answer?
Must be done in c
seeking ta problem
the computer science department runs a mentoring...
Questions
Questions on the website: 13722363