Question: Rewrite the following given program to use POSIX for threads rather than fork. [10M] #include 0)f / t give a message about the proc ID

Rewrite the following given program to use POSIX for threads rather than fork. [10M] \#include 0)f / t give a message about the proc ID */ Bid= getridi( RKirtsf. "Process Id for process d is d, in, BAA ) ; compute (Bid) ; / * call the function to do some computation // break; /* After computation, quit. OR process creation will boom! */ 3 3 retarn 0r 3 Hints: Look at the manual page for pthreads by typing man pthreads. You will need to include the pthreads.h header and also link the pthreads library lpthreads. The command gSG accepts the command line argument - pthreods to set it up to use threads. There are a number of guides on using pthreads on the Internet which could help you. For example, from Lavrence Livermore National Labs in the USA (https://computinq.InI.qov/tutorials/pthreods/). In order to ensure the main function does not return until all the threads have you will need to join the threads. Debugging can be aided by making top report threads as well as processes. Use Shift +H. Note how the pthreods use pointers to void to reference function names and 8 pass arguments. In this practical we do not need to pass any arguments nor return any values but you may want to explore how this is done for your own study, especially if you want to use threads in the future
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
