Previous | Next --- Slide 41 of 64
Back to Lecture Thumbnails
kostun

Is the idea behind the last point "Can prove..." that each thread has a stack and if a stack has size S, then we need at most S*T storage where T is the number of threads?

bmo

For the "prove" part, I'm thinking: For single threaded program, there will only be a maximum of one continuation in the work queue. Because for each iteration, thread executes foo(i) and queues the continuation. When its done with foo(i), it gets the continuation from the queue and executes it. And does that for all iterations.

For a T (multi) threaded program, since each thread behaves like the single threaded program mentioned above, there can only be a maximum of T continuations placed in the queue. Since there can only be a maximum of T foo(i) executing at a time, that means there can only be a maximum of T continuations created for those T foo(i).

Please log in to leave a comment.