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, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. β€’ bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 23.06.2019 03:30
Ihave a singular monitor that is a tv for my computer. recently, i took apart my computer and put it back together. when i put in the hdmi cord and booted the computer to see if it worked, the computer turned on fine but the screen was blue with "hdmi no signal." i've tried everything that doesn't require buying spare parts, any answer is appreciated!
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What is the name of the sound effect that danny hears
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
You know the right answer?
Write all possible outputs of the following C program. Separate different possibilities clearly. Ass...
Questions
Questions on the website: 13722363