Question: Threads and locks problem Consider the code written by Harry Q. Bovik for the following problem. Please assume that all necessary header files are included

Threads and locks problem

Threads and locks problem Consider the code written by Harry Q. Bovik

for the following problem. Please assume that all necessary header files are

Consider the code written by Harry Q. Bovik for the following problem. Please assume that all necessary header files are included in the code and all system calls and accessory functions always succeed. You may assume that the locks have been initialized correctly in main(), which we do not show. Bovik comes to you and complains that funel () seems to misbehave. Is he lying or is there something wrong with his code? Defend your answer in 1-3 sentences. 2. Bovik is complaining about func2 () as well. He insists to your boss that this program sometimes hangs and your boss would like your opinion. Is Bovik lying again or is there a problem? Defend your answer in 1-3 sentences. pthread_mutex_r , count_1, .l_count; int ref_count, tid_1, tid_2, tid_3, tid_4; void .threadl(void .vargp) { tid_2 = pthroad_self(); pthread_mutex_lock (count_1); ref_count++; pthread_mutex_unlock (count_l); return(0); } void .thread2(void .vargp) ( tid_1 = pthread_self(); pthread_mutex_lock (count_l); pthread_kill(pthread_self (), SIGKILL); ref_count++; pthread_mutex_unlock (count_l); return(0); } void .thread3(void .vargp) (tid_3 = pthread_self(); pthread_mutex_lock (count_l); pthread_mutex_lock (l_count); ref_count++; pthread_mutex_unlock (l_count); pthread_mutex_unlock (count_l); return(0); void .thread4(void .vargp) tid_4 = pthread_self(); pthread_mutex_lock (l_count); pthread_mutex_lock (count_l); ref_count --; pthread_mutex_unlock (l_count); pthroad_mutex_unlock (count_l); return(0); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!