subject

Write all possible outputs of the following C program. Separate different possibilities clearly. Assume there will be no mutex or semaphore initialization, thread creation or joining failures. If you believe there is only one possible output, you just need to write that output. #include #include char arr [2]={'a','b']; int mark=0, size=0; pthread_mutex_t ml = PTHREAD_MUTEX_INITIALIZER; { void swap (int start, int end) { int i, j; for (i=start, j=mark;i<=end; i++) pthread_mutex_lock (&ml); arr[0]=arr[O] + (j82); arr[1]=arr[1]+(j82); pthread_mutex_unlock (&ml); } } void *fun (void *arg) { swap (mark, mark+size-1); mark=mark+size; } int main(int argc, char *argv[]) { int num_threads=2, i, x; size=14/num_threads; pthread_t thread[num_threads]; for( i = 0; i < num_threads; i++) x = pthread_create(&thread[i], NULL, fun, NULL); for( i = 0; i < num_threads; i++) pthread_join(thread[i], NULL); for(i=0;i<2;i++) printf("%c", arr[i]); return 0;

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 00:00
The gene form of a trait is called a(n) 
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
Answer these and get 40 points and brainliest
Answers: 1
question
Computers and Technology, 24.06.2019 18:10
Most information security incidents will occur because of select one: a. users who do not follow secure computing practices and procedures b. increases in hacker skills and capabilities c. poorly designed network protection software d. increasing sophistication of computer viruses and worms
Answers: 1
question
Computers and Technology, 24.06.2019 22:00
Difference between ancient and modern mode of information transmission
Answers: 1
You know the right answer?
Write all possible outputs of the following C program. Separate different possibilities clearly. Ass...
Questions
question
History, 23.08.2019 17:10
question
English, 23.08.2019 17:10
Questions on the website: 13722363