#fork and deterministic resumption of the resulting process

Andreas Raab andreas.raab at gmx.de
Fri Feb 8 06:17:44 UTC 2008


Igor Stasenko wrote:
> I'd like to emphasize this (please, increase the font size, when you
> reading following phrase):
> 
> ...  a program that relies on a particular implementation of
> scheduling is wrong.

Sorry but that's complete nonsense. If you really believe this then I'll 
challenge you to write a program that you believe is "correct" for the 
following problem: Create a program that will write the numbers 1 
through five from five concurrent threads into an array in the order 1, 
2, 3, 4, 5. Something that today you could do for example via:

result := Array new: 5.
1 to: 5 do:[:i|
   [result at: i put: i] forkAt: Processor activePriority+1.
].

*Regardless* of your implementation I will define a scheduling mechanism 
that breaks your program, e.g., make it behave "wrong". In other words 
if you believe what you write above you won't *ever* be able to write 
correct multi-threaded code.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list