Exercise 3.40. Give all possible values of x that can result from executing (define x 10) (parallel-execute (lambda () (set! x (* x x))) (lambda () (set! x (* x x x)))) Which of these possibilities remain if we instead use serialized procedures: (define x 10) (define s (make-serializer)) (parallel-execute (s (lambda () (set! x (* x x)))) (s (lambda () (set! x (* x x x))))) ———————————————————————————————————————————————————————————————————————— Assuming that the value of x is read each time it is used in an expression, we have two or three reads, respectively, followed by one write, for each lamdba: A: (set! x (* x x)) rA rA wA B: (set! x (* x x x)) rB rB rB wB It is possible that both writes happen after all the reads: [all reads] wA wB → 1000 [all reads] wB wA → 100 It is also possible that one of the writes precedes some of the reads of the other procedure: If procedure A writes 100 before some B reads: rB rB wA rB → 10000 rB wA rB rB → 100000 wA rB rB rB → 1000000 If B writes 1000 before one or both A reads: rA wB rA → 10000 wB rA rA → 1000000 If serialized, there are only two possibilities: rA rA wA rB rB rB wB → 1000000 rB rB rB wB rA rA wA → 1000000