Computers and Technology, 28.06.2020 03:01 carrottopsadly
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;
Answers: 2
Computers and Technology, 24.06.2019 01:00
Answer these and get 40 points and brainliest
Answers: 1
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
Computers and Technology, 24.06.2019 22:00
Difference between ancient and modern mode of information transmission
Answers: 1
Write all possible outputs of the following C program. Separate different possibilities clearly. Ass...
History, 23.08.2019 17:10
Chemistry, 23.08.2019 17:10
English, 23.08.2019 17:10
Chemistry, 23.08.2019 17:10
Physics, 23.08.2019 17:10
History, 23.08.2019 17:10
Mathematics, 23.08.2019 17:10
Computers and Technology, 23.08.2019 17:10