Question: #include #include #include #define NTHREADS 10 pthread_t threads[NTHREADS]; void go (int n) { printf(Hello from thread %d , n); thread_exit(100 + n); // REACHED? }
#include
7.For the threadHello program in Figure 4.6, the procedure go() has the parameter np and the local variable n. Are these variables per-thread or shared state? Where does the compiler store these variables states?
8. For the threadHello program in Figure 4.6, the procedure main() has local variables such as i and exitValue. Are these variables per-thread or shared state? Where does the compiler store these variables?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
