pthread
Read pthread.c
carefully. Then, run make
and run pthread
multiple times and observe its output. Answer the following questions based on your observations.
Is the program’s output the same each time it is run? Why or why not?
Based on the program’s output, do multiple threads share the same stack?
Based on the program’s output, do multiple threads share the same global variables?
Based on the program’s output, what is the value of
void *threadid
? How does this relate to the variable’s type(void *)
?Using the first command line argument, create a large number of threads in
pthread
. Do all threads run before the program exits? Why or why not? Note: Please be precise. Vague responses will not be given credit.