Use any C program withoutusing PTHREADS calculate time taken to executeprogram.
- Write same program of question 1 using PTHREADS.Calculate time taken to execute program.(1 mark)
- Identify data races in above program and explain whythis situation occurred with an example (1 mark)
- Rewrite the code to avoid data races should use any ofthe THREE techniques.(1.5 marks)
please I need the c code..
| | | |
critical section | | | |
mutex solution | | | |
semaphore functions | | | |
Barriers | | | |
Read-Write Locks | | | |
Run program using 1, 2, 4, and8 threads Comparison study (1.5 marks)
| Number of threads |
Implementation | 1 | 2 | 4 | 8 |
critical section | | | | |
mutex solution | | | | |
semaphore functions | | | | |
Barriers | | | | |
Read-Write Locks | | | | |
- Rewrite the program using OPENMP. Run on 4 processors.Calculate time taken.
- At the end calculate speed up.