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, 24.06.2019 10:50
In 2009 to 2010, how many social network users were reported as being victims of online abuse? a. 1 in 10 b. 100% c.1 in 100 d. 50%
Answers: 2
question
Computers and Technology, 24.06.2019 13:50
Write a program that performs a simple n-body simulation, called "jumping leprechauns." this simulation involves n leprechauns, numberd 1 to n. it maintains a gold value g_i for each leprechaun i, which begins with each leprechaun starting out with a million dollars worth of gold, that is, g_i = 1000000 for each i = 1,. in addition, the simulation also maintains, for each leprachaun,i, a place on the horizon, which is represented as a double-precision floating point number, x_i. in each iteration of the simulation, the simulation processes the leprachauns in order. processing a leprachaun i during its iteration begins by computing a new place on the horizon for i, which is determined by the assignment:
Answers: 3
question
Computers and Technology, 24.06.2019 15:30
The idea that, for each pair of devices v and w, there’s a strict dichotomy between being “in range” or “out of range” is a simplified abstraction. more accurately, there’s a power decay function f (·) that specifies, for a pair of devices at distance δ, the signal strength f(δ) that they’ll be able to achieve on their wireless connection. (we’ll assume that f (δ) decreases with increasing δ.) we might want to build this into our notion of back-up sets as follows: among the k devices in the back-up set of v, there should be at least one that can be reached with very high signal strength, at least one other that can be reached with moderately high signal strength, and so forth. more concretely, we have values p1 ≥ p2 ≥ . . ≥ pk, so that if the back-up set for v consists of devices at distances d1≤d2≤≤dk,thenweshouldhavef(dj)≥pj foreachj. give an algorithm that determines whether it is possible to choose a back-up set for each device subject to this more detailed condition, still requiring that no device should appear in the back-up set of more than b other devices. again, the algorithm should output the back-up sets themselves, provided they can be found.\
Answers: 2
question
Computers and Technology, 25.06.2019 08:00
Is skill in using productivity software, such as word processors, spreadsheets, database management systems, and presentation software.computer literacyinformation literacybusiness literacynetwork literacy
Answers: 1
You know the right answer?
Must be done in c
seeking ta problem
the computer science department runs a mentoring...
Questions
question
Mathematics, 13.12.2020 16:30
question
Computers and Technology, 13.12.2020 16:30
question
Mathematics, 13.12.2020 16:30
question
Mathematics, 13.12.2020 16:40
question
Mathematics, 13.12.2020 16:40
question
Mathematics, 13.12.2020 16:40
question
Chemistry, 13.12.2020 16:40
Questions on the website: 13722367