Lab 3Simulate the concurrent execution of two threads using a single program:
Thread A: prints five subsequent lines of letter A on the printer and
keeps looping (about 10 times).
Thread B: prints five subsequent lines of letter B on the printer and
keeps looping (about 10 times).Implement (a) and (b) using two programs, respectively:(a) Do not use any algorithm for mutual exclusion and show the printout,
which should be similar to this:1: AAAAAAAAA
1: AAAAAAAAA1: BBBBBBBBB
1: BBBBBBBBB
1: BBBBBBBBB1: AAAAAAAAA
1: AAAAAAAAA
1: AAAAAAAAA1: BBBBBBBBB
1: BBBBBBBBB2: AAAAAAAAA
2: AAAAAAAAA…………………(b) Write the program again considering the mutual exclusion. Run the
program several times to show that mutual exclusion is guaranteed.To make longer execution of threads, use some sleep(n) functions in
the program. Experiment with n to choose the best one to show the
results.1: AAAAAAAAA
1: AAAAAAAAA
1: AAAAAAAAA
1: AAAAAAAAA
1: AAAAAAAAA1: BBBBBBBBB
1: BBBBBBBBB
1: BBBBBBBBB
1: BBBBBBBBB
1: BBBBBBBBB2: AAAAAAAAA
…………………Submission:In order not to lose any files, you’d better zip all your files into a .zip file.Submit your project to TRACS before the deadline. Homework will NOT be accepted through emails.
You should write a readme textfile telling the grader how to run your programs. Without this file,
it is very likely that your project will not be run properly.
Concurrent, execution, program:, simulate, Single, solved, Threads, using
[SOLVED] Lab 3 simulate the concurrent execution of two threads using a single program:
$25
File Name: Lab_3__simulate_the_concurrent_execution_of_two_threads_using_a_single_program:.zip
File Size: 744.18 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.