Most of you did not get the first question (5.17)

The answer should be..

------------

This change results in indefinite postponement. see below

Thread1 Thread2
  Enters critical section
  Executes Critical section code
  t2WantsToEnter=false
Enter while loop at line 17  
enter if conditional at line 19  
t1WantsToEnter=false  
  FavoredThread=1
  executes non-critical code
  enters critical section

-------------

Answer for (6.8)

a. putChar

b. getChar

c. FCFS   

d. because the buffer is circular, it is possible - for example- to have wrtierPosition be 0 while readerPosition is BUFFER_SIZE-1 . Therefore the relationship is false

e. lines 3-8

f. lines 23, and 39

g. lines 16 and 32

h. lines 22 and 38

i. occupiedSlots--;