Threads or suggestion?

Stephen Pair spair at acm.org
Thu Aug 8 21:23:55 UTC 2002


Ummm...well ok then...I guess I should have run some benchmarks before
assuming that the overhead would be noticeable.

Perhaps this would be a nice feature to add to ProcessorScheduler?  You
could do something like:

Processor startTimerPreemption: 100
Processor stopTimerPreemption

The disadvantage here is that this always preempts after the specified
time has elapsed.  It would be nice to have something that would
interrupt the active process only if it has been running longer than the
specified amount of time.  Couldn't something like this be done in
checkForInterrupts?

- Stephen

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Andreas Raab
> Sent: Thursday, August 08, 2002 5:06 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: RE: Threads or suggestion?
> 
> 
> Stephen,
> 
> > I am interested in these things.  Also, I've been itching to make 
> > Comanche do it's socket serving using processes that are 
> pre-empted. 
> > The only way I know that that can be achieved is to run a higher 
> > priority process that loops around a timer event (like a 
> Delay). That 
> > seems to me like it would probably be a good bit of overhead if you 
> > were doing that say every 250 milliseconds.
> 
> You must be kidding! The overhead for process switching is 
> almost unmeasurable (last time I counted it in the range of 
> four message sends). You can easily do that every 10 msecs 
> without noticing anything.
> 
> Try this:
> 
> 	delay := Delay forMilliseconds: 10.
> 	done := false.
> 	scheduler := [[done] whileFalse:[delay wait]] forkAt: 
> Processor userInterruptPriority.
> 	xx := 0 tinyBenchmarks.
> 	done := true.
> 	xx.
> 
> and measure this against a #tinyBenchmark without the 
> "overhead". Here are my results:
> 
> tinyBenchmarks raw (3 runs):
>  '114285714 bytecodes/sec; 3422322 sends/sec'
>  '115627822 bytecodes/sec; 3425013 sends/sec'
>  '116575591 bytecodes/sec; 3419636 sends/sec'
> 
> tinyBenchmarks with scheduler overhead (3 runs):
>  '116047144 bytecodes/sec; 3361587 sends/sec'
>  '113174182 bytecodes/sec; 3403607 sends/sec'
>  '111014744 bytecodes/sec; 3382466 sends/sec'
> 
> 
> Cheers,
>   - Andreas
> 
> 
> 




More information about the Squeak-dev mailing list