Question: Source: void *thread(void *vargp); char **ptr, int main(){ const int N = 2; int i; pthread_t tid[N]; char *msgs[N] = { Hello from foo, Hello

 Source: void *thread(void *vargp); char **ptr, int main(){ const int N

Source:

void *thread(void *vargp); char **ptr, int main(){ const int N = 2; int i; pthread_t tid[N]; char *msgs[N] = { "Hello from foo", "Hello from bar" }; printf("Parent thread started with PID = %d and parent PID %d ", getpid(), getppid()); ptr = msgs;

for(i=0;i

for (i=0;i

void *thread(void *vargp) { int myid = (int)vargp; static int cnt = 0; printf("[%d]:%s(cnt=%d) with PID= %d and parent PID %d ", myid, ptr[myid], ++cnt, getpid(), getppid()); int i= cnt; for(;;i++){ printf("[%d] %d ",myid,i); sleep(cnt); } return NULL; }

void *thread(void *vargp): char **ptr, int mainO const int N-2; int i; pthread_t tid[N]; char *msgs[N] = { "Hello from foo", "Hello from bar" printf("Parent thread started with PID-90d and parent PID %dn", getpid(), getppid()); ptr msgs; for (i -0; i

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!