Below is the pseudocode of the first two versions of Dekker’…

Below is the pseudocode of the first two versions of Dekker’s algorithm. Explain the problem with the first that is corrected by the second and how the second corrects this problem. Note: The code of the threads (after the first global lines) will be written TWICE for each version. The first time, the code of the two threads are side-by-side to make it easier to compare them. But in case this does not show up properly on your screen, the code will be written again with T2’s code written AFTER T1’s. VERSION 1:int threadNumber = 1;startThreads();*** SIDE-BY-SIDE ***// T1:                                              // T2:while (!done) {                                     while (!done) {   // non-critical code goes here                      // non-critical code goes here   while (threadNumber == 2) ; // spin                 while (threadNumber == 1) ; // spin   // this line marks entering mutual exclusion        // this line marks entering mutual exclusion   // critical section code is here                    // critical section code is here   threadNumber = 2; // exiting mutual exclusion       threadNumber = 1; // exiting mutual exclusion   // more non-critical code goes here                 // more non-critical code goes here}                                                   }*** TOP AND BOTTOM ***// T1:while (!done) {   // non-critical code goes here   while (threadNumber == 2) ; // spin   // this line marks entering mutual exclusion   // critical section code is here   threadNumber = 2; // exiting mutual exclusion   // more non-critical code goes here}      // T2:while (!done) {   // non-critical code goes here   while (threadNumber == 1) ; // spin   // this line marks entering mutual exclusion   // critical section code is here   threadNumber = 1; // exiting mutual exclusion   // more non-critical code goes here}VERSION 2:boolean t1Inside = false;boolean t2Inside = false;startThreads();*** SIDE-BY-SIDE ***// T1:                                              // T2:while (!done) {                                     while (!done) {   while (t2Inside) ; // spin                          while (t1Inside) ; // spin   t1Inside = true; // this line marks                 t2Inside = true; // this line marks                    // entering mutual exclusion                        // entering mutual exclusion               // critical section code is here                    // critical section code is here   t1Inside = false; // exiting mutual exclusion       t2Inside = false; // exiting mutual exclusion   // more non-critical code goes here                 // more non-critical code goes here}                                                   }*** TOP AND BOTTOM ***// T1:while (!done) {   while (t2Inside) ; // spin   t1Inside = true; // this line marks                    // entering mutual exclusion   // critical section code is here   t1Inside = false; // exiting mutual exclusion   // more non-critical code goes here}// T2:while (!done) {   while (t1Inside) ; // spin   t2Inside = true; // this line marks                    // entering mutual exclusion               // critical section code is here   t2Inside = false; // exiting mutual exclusion   // more non-critical code goes here}                                                                            }

Say which of the following is true and fully explain every p…

Say which of the following is true and fully explain every part of the answer (the cases where the statement applies and the cases where it does not). Mutual exclusion must be enforced in the following scenarios: 1. On any shared memory, whether it is modifiable or not. 2. On any modifiable memory, whether is it shared or not. 3. Even on memory that is neither shared nor modifiable. 4. Only on memory that is both shared and modifiable.