prepare a cc program that uses the pthread


Prepare a C/C++ program that uses the PTHREAD library to create threads and mutexes to synchronize them. The program must to the following:

* Dianne can initialize the mutexes, then call the threads Rob, Michele, Tim, Paul and Vern. You can want to detach the threads (I wish we could in reality) once they are created.

* Each thread will open its own command file (Rob.in, Michele.in, etc) for reading. The file format will be:

R+/-N

+/-N Note that there may be many +/-N lines

W

R shows the start of a critical section - where you will acquire the account balance from global storage.

+/-N shows a deposit (+N) or withdraw (-N) from the account.

W shows the end of the critical section - where you will write the accout balance to global storage. At this point each thread must also display the text:

Account balance after thread *thread_name_here* is $xxx

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: prepare a cc program that uses the pthread
Reference No:- TGS0443581

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)