Exercise 27.1-1

Suppose that we spawn P-FIB\((n-2)\) in line 4 of P-FIB, rather than calling it as is done in the code. What is the impact on the asymptotic work, span, and parallelism?

Trivially, the work remains unchanged. The addition of a new spawn keyword in the pseudocode does not impact the time it would take to run the same code after having removed all spawn and sync keywords.

Similarly, the span remains unchanged as well because none of the changed lines represent content that exists on the critical path. Right before we spawn P-FIB\((n-2)\) we spawned P-FIB\((n-1)\) which will always result in more nodes thus securing its place on the critical path.

Lastly, the parallelism of this algorithm also remains unchanged. Even if we ran this adjusted algorithm in an infinite-processer environment, we would still receive no benefit from spawning this second call to P-FIB because the previous call will always take longer to complete. The end result is the adjusted algorithm taking just as long to run as the initial one regardless of how many processors are being used.