Squeak and parallel computation

John M McIntosh squeak-dev at lists.squeakfoundation.org
Tue Oct 8 03:41:19 UTC 2002


Well the carbon macintosh version of the VM runs two pthreads threads,  
one for the UI, one for the interp.c loop (the VM). Actually it runs a  
bunch more since file io is on a thread, along with a timer thread etc,  
so upwards of 6 threads could be running. Thus I think file and network  
io are offloaded onto the other CPU.

Before releasing this I looked about to see if someone had an MP mac to  
test it, someone did and they did some testing for me, so far I've not  
heard about any problems (crashes).  I do in one or two places hold a  
mutex lock to deal with the queue of UI events.

Tho Alain Fischer reported he would get
Mar 12 22:26:20 localhost  
/Users/fischer/Develop/products/Squeak.app/Contents/MacOS/Squeak:  
kCGErrorFailure: CGSNewRegionWithQDRgn: Unable to complete region  
operation
when the event loop thread attempted to invoke QDPlatformFlushWindow  
and conflict with a flush event being processed as part of screen io on  
the interp.c loop. That's a conflict with our thread doing UI drawing,  
fortunately it's not fatal.

Since Apple is migrating to a multiple CPU platform I'd welcome any  
further input on crashes on MP machines before that user base gets real  
large.

Note with a little bit of external plugin code and you could run  
externals calls on a separate pthread. Database queries come to mind.

Oh, technically the Mpeg plugin will use pthreads, mind the last time I  
recompile to check this on os-x it causes some sort of fault in the  
pthread logic for which I've not bothered to check. If someone has some  
funding and a bank of MP macs, I'll be glad to figure out what the  
problem is.  The MPEG plugin uses pthreads based on how many CPUS you  
tell it you have to render chunks of the frame. Hint look at the plugin  
interface for the call to set it to more than one cpu, some  
windows/unix user with multiple CPUs might want to try that.

Mmm that doesn't help much if you are doing just CPU intensive  
Smalltalk because the interp.c thread is a single thread. Smalltalk  
Processes don't get their own OS thread. So what exactly are you doing  
or hope to be doing?

PS a carbon squeak os-x crash log

Thread 0 is the UI thread, Thread 3 is the interpreter, the other  
threads are created as part of the carbon framework support. 2 I think  
is the timer services I"m using. Cann't say what threads 1 and 4 are  
for?

This crash is the result of doing [nil] fork resume terminate

Date/Time:  2002-09-15 20:09:27 -0700
OS Version: 10.2 (Build 6C115)
Host:       localhost

Command:    Squeak VM Opt
PID:        11599

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x3a776978

Thread 0:
  #0   0x90074328 in mach_msg_trap
  #1   0x90006670 in mach_msg
  #2   0x901490b0 in __CFRunLoopRun
  #3   0x90181578 in CFRunLoopRunSpecific
  #4   0x92ba34cc in RunCurrentEventLoopInMode
  #5   0x92bb32f4 in ReceiveNextEventCommon
  #6   0x92bf24f4 in _AcquireNextEvent
  #7   0x92cb434c in RunApplicationEventLoop
  #8   0x00085c8c in main
  #9   0x000041c0 in _start
  #10  0x00003ff0 in start

Thread 1:
  #0   0x90042d68 in semaphore_timedwait_signal_trap
  #1   0x9003ef94 in _pthread_cond_wait
  #2   0x90233470 in TSWaitOnSemaphoreCommon
  #3   0x9023c298 in TimerThread
  #4   0x90021428 in _pthread_body

Thread 2:
  #0   0x90042d68 in semaphore_timedwait_signal_trap
  #1   0x9003ef94 in _pthread_cond_wait
  #2   0x902300ec in MPWaitOnQueue
  #3   0x90737084 in TNodeSyncTask::SyncTaskProc(void*)
  #4   0x9025e538 in PrivateMPEntryPoint
  #5   0x90021428 in _pthread_body

Thread 3 Crashed:
  #0   0x0000a940 in interpret
  #1   0x0000c214 in interpret
  #2   0x90021428 in _pthread_body

Thread 4:
  #0   0x9003f188 in semaphore_wait_signal_trap
  #1   0x9003efa4 in _pthread_cond_wait
  #2   0x026bb900 in waitForThreadSignal
  #3   0x026bbcdc in resolve
  #4   0x90021428 in _pthread_body


On Monday, October 7, 2002, at 05:28  PM, Ian Piumarta wrote:

> On Mon, 7 Oct 2002, Aaron J Reichow wrote:
>> On Tue, 8 Oct 2002, Ian Piumarta wrote:
>>> if your VM runs on one processor and your X server on another then
>>> you should see an improvement for graphics-bound code.
>
> I can get the ratio to 5:1 Squeak:X by scrolling a large window of  
> text.
>
--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list