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

Processes interleaving executions with race conditions problem; Considering a ra

ID: 3806158 • Letter: P

Question

Processes interleaving executions with race conditions problem;

Considering a race condition would exist when the final result of an activity that involves 2 or more processes that have shared resources depends on the timing of these processes. Shown in the diagram are two processes, X and Y. The spaces between shows the interleaving of their executions. Both the processes share the variables "in" and "out." a. Suppose the user of Process X enters "hello" from the keyboard and other user of Process Y enters in "world." So from the diagram above that is illustrated interleaving, what would be printed? b. Create a different interleaving that will produce a different output. What is the output using your creation?

Explanation / Answer

a) Since X,Y are shared variables and no locking protocol is specified the input taken in process X is shared with process Y and the output is printed as "world world" 2 times

b)

out=in

display out

This progeam when executed giving hello and world as inputs to process X and Y respectively gives output as"hello world"

Process X Process Y Read In

out=in

display out

Read In out=in display out
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