subject

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

#include

#include

#include

int value = 0;

void *runner(void *param); /* the thread */

int main(int argc, char *argv[])

{

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;

pthread exit(0);

}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
In which phase does software coding and testing happen in the spiral model? the spiral model does not have a separate testing phase. both, software coding and testing occurs during the phase.
Answers: 3
question
Computers and Technology, 22.06.2019 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Creating "smart interfaces" in all sectors of industry, government, and the public arena is one of the fastest growing hct areas. these interfaces model, interpret, and analyze such human characteristics as speech, gesture, and vision. the field of biometrics, in which humans authenticate themselves to machines, is an area of considerable interest to hct practitioners. fingerprint scans are one of the most frequently used biometric options, and this article, biometric student identification: practical solutions for accountability & security in schools, makes a case for the implementation of fingerprint scans in schools. critique the article, and answer the following questions: according to the author, what are the main benefits of adopting fingerprint scans in schools for student identification? according to the author, what are the main drawbacks of adopting fingerprint scans in schools for student identification? do you agree with the author's assessment of the pl
Answers: 2
You know the right answer?
The program shown uses the Pthreads API. What would be the output from the program at LINE C and LIN...
Questions
question
Physics, 25.02.2021 05:30
question
Mathematics, 25.02.2021 05:30
question
Mathematics, 25.02.2021 05:30
question
Mathematics, 25.02.2021 05:30
question
Biology, 25.02.2021 05:30
question
Mathematics, 25.02.2021 05:30
Questions on the website: 13722363