Fourth question shared int reserved[2] = {0, 0}; // global var void enter_region(int pid) { // 0 or 1 int other; other = 1 - pid; // pid of other process reserved[pid] = 1; // reserve while (reserved[other]);// busy wait reserved[pid] = 1; // reserve } // enter_region void leave_region(int pid) { reserved[pid] = 0; } // leave_region The two critical lines
{}