Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

can you answer 5 and 6 please? The first known correct software solution to the

ID: 3791934 • Letter: C

Question

can you answer 5 and 6 please?

The first known correct software solution to the critical-section problem for two processes was developed by the Dutch mathematician Theodora's Dekker. The processes share the following variables: Boolean flag[2];//Both initially false int turn; The structure of process P_i(i = 0 or 1) is shown below. The other process is P(j = 1 or 0). Prove the algorithm shown below satisfies the following requirements for a critical section: At most one process can execute its critical section at a time. If multiple processes attempt to enter their critical sections at the same time, one process is guaranteed to be selected and move forward Once a process P has requested access to its critical section, there exists a bound on the number of times other processes will be allowed to access their critical sections before P is given access to its critical section. flag[i] = true; while (flag l() = = true) (If (turn = = j) flag[i] = false; while (turn = = j)//do nothing flag(i) = true;/critical section would be placed here */turn = J; flag[i] = false; while (true); Multithreading does not necessarily guarantee improved performance over single-threaded versions of the same program Provide one example of a type of program that would run faster with multiple threads than it would with one thread and one example of a type of program that would not run faster with multiple threads.

Explanation / Answer

6.

threads cannot speed up execution of code. They do not make the computer run faster. All they can do is increase the efficiency of the computer by using time that would otherwise be wasted. In certain types of processing this optimization can increase efficiency and decrease running time.

Example of multithread program that would run faster is:

1.Massively parallel server monitoring infrastructure, for example u are required to monitor 30K servers/routers every 5 seconds.this can be done usingmulti threading.

2.JUnit uses threads to run test cases in parallel.

Example of single thread that would not run faster using multiple threads is the A single processor system only run instructions linearly. '

Having multiple lines of execution is done by the operating system processing interrupts, saving the state of the current thread, and starting another one.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote