Question: 1(50p) Explain the difference between thread and process 2(50p) What are the possible outputs of the code below. #include #include int x=0; void *method ()

 1(50p) Explain the difference between thread and process 2(50p) What are

1(50p) Explain the difference between thread and process 2(50p) What are the possible outputs of the code below. \#include \#include int x=0; void *method () \{ x+=100; pthread_exit(0); \} int main()\{ pthread_t tid1, tid2; pthread_attr_t attr; pthread_attr_init(\&attr); pthread_create(\&tid1,\&attr, method,NULL); pthread_create(\&tid2,\&attr, method,NULL); pthread_join(tid1, NULL); pthread_join(tid2, NULL); printf("x:\%d ",x); \}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!