#fork and deterministic resumption of the resulting process

Andreas Raab andreas.raab at gmx.de
Fri Feb 8 09:51:50 UTC 2008


Igor Stasenko wrote:
> Well, i expect that your potential scheduler gives a chance to run
> processes at _any_ priority (doing something sometimes to switch
> active processes). Otherwise we're in not the parallel domain anymore.

Ah. Now we're starting with assumptions ;-)

> If you want , at some point to get all results filled, you can use
> Semaphore, or plain counter (just make sure you get in to ABA mess
> with it):
> 
> sema := Semaphore new.
>  1 to: 5 do:[:i|
>     [ i == 1 ifFalse: [ [ (result at: i-1)  isNil ] whileTrue: [] ].
>      result at: i put: i. sema signal ] forkAt: Processor
> activePriority - 10 + i.
> ].
> 
> [ sema excessSignals < 5 ] whileTrue: [].
> <here you got your array filled>

That's a little better. Still not good enough though. Now let's assume 
that my theoretical scheduler has limits for how many threads it can 
have scheduled at the same time (because of memory limits, cores etc). 
Not unusal at all. Would you like to try again?

Cheers,
   - Andreas




More information about the Squeak-dev mailing list