multithreaded VMs
John M McIntosh
johnmci at smalltalkconsulting.com
Fri Feb 9 18:44:37 UTC 2001
At 9:28 AM -0800 2/9/01, John M McIntosh wrote:
> > They're still polled. The key issue in the VM event stuff was not
>loose user
>> input events anymore.
>
>The problem I've seen is that events sometimes *do* get lost, but in
>the image, not between the image and the VM. The 'place' they get
>lost seems to be the same place that is responsible for at least some
>of the sluggishness.
>
Late last night I built a mac os 9. version of Squeak that uses the
macintosh threadsLib library, which is a light weight cooperative
thread model not a heavy one like pthreads. It only took a few lines
of code, and passed the smoke test on the first try, at which point I
went to bed. However I've some more reading to do about if this is a
good thing. Since it is a cooperative model there are less worries
about a thread loosing control at the wrong time and having a
collision with data being manipulated by another thread.
For the Mac OS the thread manager assumes the main thread is the
event handler, and stuff happens in secondary threads. So I do this
createNewThread();
while(true)
{
ioProcessEvents();
YieldToAnyThread();
}
The interp() thread Yields to the event thread at ioGetNextEvent if
there isn't any events in the queue and I think every 1/2 second in
checkForInterrupts. Also the thread scheduler does attempt to
schedule the main thread if an OS event is pending which can happen
at some other undocumented scheduling points.
It may also greatly improve some messy issues with the browser
plugin, however I'm going to have a few people kick the tires first,
and given other comments I'm not sure where the slowdown is. But I'm
looking.
--
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
Custom Macintosh programming & various Smalltalk dialects
PGP Key: DSS/Diff/46FC3BE6
Fingerprint=B22F 7D67 92B7 5D52 72D7 E94A EE69 2D21 46FC 3BE6
===========================================================================
More information about the Squeak-dev
mailing list
|