[gclist] A problem with the Baker treadmill.

James McCartney james@clyde.as.utexas.edu
Tue, 14 Jan 1997 11:36:00 -0700


At 9:44 AM -0800 1/14/97, David Petrie Stoutamire wrote:
>Charles Fiterman wrote:

>> I'm doing Solaris Threads for a start and the overhead
>> is in the lock call. It doesn't matter if other threads
>> are running. That means that since the lock is for a
>> small number of instructions we should lock on the
>> whole collector rather than lock twice. It suggests use
>> of a spin lock written in assembler. In fact the requeue
>> operation can profitably be in assembler with the spin lock.

>I can confirm that writing your own spinlocks is the
>right thing to do.

It doesn't matter if the lock is only for a few instructions if the
scheduler decides your time slice is up at that moment.
If you are trying to do anything real time on a multitasking system
you can't afford a spin lock. If a suspended thread holds the lock
then you will wind up spinning for your entire CPU time slice.
The only place where I could see using a spin lock would be on
a multiprocessor system where each processor runs single threaded.


   --- james mccartney     james@clyde.as.utexas.edu   james@lcsaudio.com
If you have a PowerMac check out SuperCollider, a real time synth program:
ftp://mirror.apple.com//mirrors/Info-Mac.Archive/gst/snd/super-collider-demo.hqx