subject

Read the man page of the following functions pthread_create, pthread_join. Read the man page of the following functions pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock, pthread_mutex_destroy. For each task, fullfill the requirements provided in the comments, or fill the blank. Compile the code and make sure it is executable. What is the output of the code? #include
#include
#include
void *functionc ();
pthread mutex t mutex1 PTHREAD MUTEX INITIALIZER
int counter = 0 ;
main ()
int rc1, rc2
pthread_t thread1, thread2;
* Create independent threads each of which will execute functionC*/
if ((rc1-pthread_create (&thread1, NULL,
printf ( "Thread creation failed : %d\n", rc1 ) ; , NULL))) if (( rc2-pthread_create (&thread2, NULL, , NULL)))
printf ( "Thread creation failed : %d\n" , rc2 ) ;
pthread_join ( pthread_join ( return (0); NULL) , NULL);
void *functionc () (
pthread_mutex_lock (
counter++
printf ( "Counter value : %d\n" , counter) ;
pthread mutex_unlock
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
Aprovides legal protection for something an individual has created
Answers: 1
question
Computers and Technology, 22.06.2019 03:10
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
Answers: 2
You know the right answer?
Read the man page of the following functions pthread_create, pthread_join. Read the man page of the...
Questions
question
Physics, 18.06.2020 14:57
question
Spanish, 18.06.2020 14:57
question
Mathematics, 18.06.2020 14:57
Questions on the website: 13722363