The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Smalltalk Processing

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Smalltalk Processing Posted: Jun 10, 2006 8:26 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Smalltalk Processing
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

Michael van der Gulik posted some code that runs a number of processes, and wondered about the results - which showed that the processes don't all run:

Either:

- My code is borked, which is entirely possible,
- The ProcessScheduler is buggy, or
- Squeak is meant to work like this.

Which of those is true?

I haven't examined the scheduler in Squeak, but in VW (which is descended from the same original codebase), processes are cooperative - i.e., a process at priority N will never interrupt another process at priority N. So in VW, when I tried his test, only one of the processes ever ran. He set up N processes, and had them fork like this:

loop: element
	[[ continue ] whileTrue: [ 
		counts at: element put: ((counts at: element) + 1).
	] ] forkAt: 10.

So if I do that, only the first one in ever runs (as they never get blocked on i/o). To make them all run, you do something like this:

loop: element
	[[ continue ] whileTrue: [ 
		counts at: element put: ((counts at: element) + 1).
		Processor activeProcess yield.
	] ] forkAt: 10.

That #yield puts the process in question on hold, allowing others to run. This is simply the way VW (and, to a large extent, it seems) Squeak work. If you want pre-emptive scheduling, it's easy enough to do - just change the scheduler (all the code is there in Smalltalk).

Read: Smalltalk Processing

Topic: New Authentication Support in BottomFeeder Previous Topic   Next Topic Topic: visual complexity

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use