Question: How can I solve this with using PTHREADS, MUTEXES, and MUTEX CONDITION VARIABLES OBJECTIVES This rather short assignment should teach you how to use pthreads,

How can I solve this with using PTHREADS, MUTEXES, and MUTEX CONDITION VARIABLESHow can I solve this with using PTHREADS, MUTEXES, and MUTEX CONDITIONVARIABLES OBJECTIVES This rather short assignment should teach you how to use

OBJECTIVES This rather short assignment should teach you how to use pthreads, pthread mutexes and pthread condition variables THE PROBLEM A bridge is load-zoned and can only carry a total weight of maxweight tons. Your solution should ensure that the total weight of all vehicles on the bridge will never exceed its maximum load. Each vehicle will be represented by a separate thread and all inter-thread synchronization must be implemented through pthread mutexes and pthread condition variables. You cannot use semaphores Vehicles whose total loaded weight exceeds the maximum load of the bridge should be rejected and a descriptive message containing the serial number of the vehicle printed out YOUR PROGRAM Your program should consist of 1. A main program 2. An enterBridge (weight) method to be performed by each arriving vehicle 3. A leave Bridge(weight) method to be performed by each vehicle leaving the bridge, and 4. One child thread per vehicle. The maxweight constant should be read from the command line as in Van out 10 All other parameters will be read from the standard nput. Each input line will describe one vehicle arriving at the bridge and will contain four parameters An alphanumeric string without spaces representing the car license plate 2. A positive integer representing the number of seconds elapsed since the arrival ofthe previous vehicle (it will be equal to zero for the first vehicle arriving to the bridge), 3. A positive integer representing the total loaded weight of the vehicle rounded up to an integer number of tons, 4. A positive integer representing the number of seconds the vehicle will take to cross the bridge A possible set of input could be OBJECTIVES This rather short assignment should teach you how to use pthreads, pthread mutexes and pthread condition variables THE PROBLEM A bridge is load-zoned and can only carry a total weight of maxweight tons. Your solution should ensure that the total weight of all vehicles on the bridge will never exceed its maximum load. Each vehicle will be represented by a separate thread and all inter-thread synchronization must be implemented through pthread mutexes and pthread condition variables. You cannot use semaphores Vehicles whose total loaded weight exceeds the maximum load of the bridge should be rejected and a descriptive message containing the serial number of the vehicle printed out YOUR PROGRAM Your program should consist of 1. A main program 2. An enterBridge (weight) method to be performed by each arriving vehicle 3. A leave Bridge(weight) method to be performed by each vehicle leaving the bridge, and 4. One child thread per vehicle. The maxweight constant should be read from the command line as in Van out 10 All other parameters will be read from the standard nput. Each input line will describe one vehicle arriving at the bridge and will contain four parameters An alphanumeric string without spaces representing the car license plate 2. A positive integer representing the number of seconds elapsed since the arrival ofthe previous vehicle (it will be equal to zero for the first vehicle arriving to the bridge), 3. A positive integer representing the total loaded weight of the vehicle rounded up to an integer number of tons, 4. A positive integer representing the number of seconds the vehicle will take to cross the bridge A possible set of input could be

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!