subject
Engineering, 22.04.2020 01:21 hoyanna69

Modify the following code to do the following: - Task 1 (50 pts). Eliminate the deadlock by avoiding circular waiting. (Hint: change the order to access chopsticks for some philosophers.) - Task 2 (50 pts). Eliminate the deadlock by avoiding hold and wait. In other words, if a philosopher is not able to obtain the right chopstick, he/she will release the left chopstick immediately. (Hint: Use Pthread Mutex to solve the problem.) -Task 3 (50 pts extra credit). Eliminate the deadlock by limiting that at most 3 philosophers are able to compete for the chopsticks at the same time. (Hint: Use Pthread Conditional Variable to solve the problem.)#include #include #include #include #include #define NUMP 5pthread_mutex_t fork_mutex[NUMP];int main(int argc, char* argv[]){ int i; pthread_t diner_thread[NUMP]; int dn[NUMP]; void *diner(); for (i=0;i

ansver
Answers: 3

Another question on Engineering

question
Engineering, 03.07.2019 23:20
Two technicians are discussing the intake air temperature (iat) sensor. technician a says that the computer uses the iat sensor as a backup to the engine coolant temperature (ect) sensor. technician b says that the powertrain control module (pcm) will subtract the calculated amount of fuel if the air measures hot. who is correct
Answers: 3
question
Engineering, 04.07.2019 18:10
Assuming compressible flow of air and that the measurements are done at flagstaff a pitot static tube that gives the difference of total and static pressure measures 0.35 m of mercury. what is the velocity of air? assume the temperature to be 300k. (submit your excel or matlab calculation sheet)
Answers: 1
question
Engineering, 04.07.2019 18:10
What are the two (02) benefits, which may result from a successful implementation of preventive maintenance (pm) program in an organization? (clo3)a)- lean manufacturing b)-overlapping responsibilities c)-the planner is not qualified d)-accurate contractor information e)-reduction in equipment redundancies f)-accurate stores information
Answers: 3
question
Engineering, 04.07.2019 19:10
Agas is compressed from vi 0.3 m, p 1 bar to of v2 0.1 m3, p2--3 bar. pressure and volume are related linearly during the process. for the gas, find the work, in kj.
Answers: 2
You know the right answer?
Modify the following code to do the following: - Task 1 (50 pts). Eliminate the deadlock by avoiding...
Questions
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Social Studies, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
History, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Chemistry, 14.09.2020 14:01
question
Biology, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
question
French, 14.09.2020 14:01
question
History, 14.09.2020 14:01
question
Mathematics, 14.09.2020 14:01
Questions on the website: 13722361