native threads

C. David Shaffer cdshaffer at acm.org
Mon Apr 18 16:26:50 UTC 2005


Ned Konz wrote:

>On Monday 18 April 2005 7:56 am, C. David Shaffer wrote:
>  
>
>>Execute the first section of code above.  Wait until it is done (use the
>>ProcessBrowser to confirm that the two processes are complete).  
>>    
>>
>
>Of course, depending on what other processes you're running (like for instance 
>if you've told the ProcessBrowser to report on CPU usage), you may be 
>introducing a high-priority process that will change the scheduling.
>
>  
>
>>Print 
>>the second section to confirm that the size is 20000.  Print the third
>>to see that the first process did not complete before it was preempted.
>>    
>>
>
>Again, this assumes that you've got a higher-priority process (typically we 
>have several of them, so it generally will work as described).
>
>  
>
Thanks Ned.  I thought that this was already covered in this thread.  My
point is that the scheduler is performing the rather simplistic task
described (the 1's and 2's are interleaved in a somewhat unpredictable
manner).  So no need for a yield unless one wants to control when the
preemption occurs.  I was not trying to mislead anyone into thinking
that the preemption was by the same priority process.  Only
demonstrating that the claim that a yield was required was completely
invalid...a higher priority process will inevitably interrupt these
under "normal circumstances".  (Clearly as soon as one tries to write
code which depends on this happening after a certain amount of time
problems will occur.)  To be clear, my point is this: When someone
claims "cooperative multitasking in Squeak causes SharedQueue population
by separate processes to occur in sequential order" that person is
clearly wrong under normal circumstances.  Similarly when someone claims
that "a server cannot be written using a language/VM which only supports
cooperative multitasking and green threads" that person is clearly wrong
since Squeak has several examples of stable servers.  Finally when
someone claims that "cooperative multitasking places an unreasonable
burden on developers, forcing them to /yield/ at compute intensive
sections of their code" that person is clearly wrong on two accounts: 1)
such yields can be easily avoided, 2) when a yield is needed it is
needed for a very obvious reason and instead of this being a "burden" on
the developer it is a benefit since said developer clearly understands
how their processes are executed.

David

-- 
C. David Shaffer
http://www.cs.westminster.edu/~shaffer
http://www.shaffer-consulting.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050418/44672d57/attachment.htm


More information about the Squeak-dev mailing list