Consider the following program: Note that the scheduler in a uniprocessor system would implement pseudo parallel execution

Question:

Consider the following program:


Note that the scheduler in a uniprocessor system would implement pseudo parallel execution of these two concurrent processes by interleaving their instructions, without restriction on the order of the interleaving.

a. Show a sequence (i.e., trace the sequence of inter-leavings of statements) such that the statement “x is 10” is printed.

b. Show a sequence such that the statement “x is 8” is printed. You should remember that the increment/decrements at the source language level are not done atomically, that is, the assembly language code:


Implements the single C increment instruction (x = x + 1).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: