Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program shown in the following figure uses the Pthreads API. What would be the output from the program at LINE C and LINE P?

The program shown in the following figure uses the Pthreads API. What would be the output from the program at LINE C and LINE P?

image text in transcribed

194 Chapter 4 Threads #include #include #include int value = 0; void *runner (void *param); /* the thread */ int main(int argc, char *argv[]) Prog pid.t pid; pthread_t tid; pthread_attr_t attr; pid = fork(); if (pid == 0) { /* child process */ pthread attr_init(&attr); pthread.create(&tid,&attr,runner ,NULL); pthread_join(tid,NULL); printf("CHILD: value = %d", value); /* LINE C */ else if (pid > 0) { /* parent process */ wait (NULL); printf ("PARENT: value = %d", value); /* LINE P */ void *runner (void *param) { value = 5; pthreadexit(); Figure 4.16 C program for Exercise 4.17. 4.19 Pthreads provides an API for managing thread cancellation." thread atalat

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

(c) What is the resolution of this experiment? Pg45

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago

Question

Explain the cost of capital.

Answered: 1 week ago

Question

1. Identify six different types of history.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago

Question

4. Describe the role of narratives in constructing history.

Answered: 1 week ago