Question: Only one thread can be in its critical section at any time in this process. The first thread, in terms of creation time, enters first

Only one thread can be in its critical section at any time in this process. The first thread, in terms of creation time, enters first in its critical section. After that threads are permitted to perform their critical section based on their ID. o Threads are given IDs in the format txy where x and y are digits (0-9). Thread IDs are unique. Threads may have same or different start_time. Thread entries in the input file can be in any order. o The y in thread IDs thus will either be an even digit or odd digit. o After the first thread, the next thread that will be permitted to perform its critical section must be the one in which y is different i.e. if y was even in first thread then in the next it must be odd or vice versa. o For the rest of the process, you must follow the same scheme i.e. two threads with odd y or even y can not perform critical section simultaneously. Since synchronization may lead to deadlock or starvation, you have to make sure that your solution is deadlock free i.e. your program must terminate successfully, and all the threads must perform their critical section. One extended form of starvation will be that towards the end, we have all odd or all even processes left, and they are all locked because there are no other type (odd/even) of threads left. Once the process reaches to that stage, you must let them perform their critical section to avoid starvation and progress towards the end of the process. In the screen shot on the next page, you will notice that t07, t05 and t01 perform their critical section without any even number thread separating them because there are no more even number threads left

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!