Block other processes?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Block other processes?

John Almberg
I'm trying to use Squeak to time an external process via a Socket  
Connection.

I've got it working, but I'm suddenly wondering if the variation in  
timing is more due to internal delays in Squeak, than changes on the  
target system.

For example, if the Squeak garbage collector runs while the timing  
loop is running, that could throw off the measurement.

Is there any way to block the execution of other processes while in  
the timing loop?

-- John

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Block other processes?

John Almberg
I guess another way to ask this question is: is it possible for  
Squeak to steal cycles from an Object's 'step' process, while the  
step is running, or does the Object have control until the step  
completes?

I suspect the later, since during long-executing steps, the rest of  
Squeak seems frozen.

Note that I'm not really trying to use Squeak for real-time  
processing. I'm just building a prototype in Squeak, since it has all  
the networking stuff I need, plus a way to create a quick and dirty  
user interface.

Plus I'm having fun learning Squeak :-)

-- John


On Aug 17, 2007, at 8:18 PM, John Almberg wrote:

> I'm trying to use Squeak to time an external process via a Socket  
> Connection.
>
> I've got it working, but I'm suddenly wondering if the variation in  
> timing is more due to internal delays in Squeak, than changes on  
> the target system.
>
> For example, if the Squeak garbage collector runs while the timing  
> loop is running, that could throw off the measurement.
>
> Is there any way to block the execution of other processes while in  
> the timing loop?
>
> -- John
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Websites for On-line Collectible Dealers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Identry, LLC
John Almberg
(631) 546-5079
[hidden email]
www.identry.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Block other processes?

Ralph Johnson
On 8/18/07, John Almberg <[hidden email]> wrote:
> I guess another way to ask this question is: is it possible for
> Squeak to steal cycles from an Object's 'step' process, while the
> step is running, or does the Object have control until the step
> completes?

This is not the way that Squeak works.

Objects do not have a step process.  Squeak objects don't know much
about processes or execution.  Squeak has processes, semaphores, etc.
and they are objects, but most objects don't have anything to do with
them.   Every process has a priority.  Squeak runs a process until the
process stops or a higher-priority process is ready to run.  You can
make Squeak implement a round-robin scheduler by having a
higher-priority process wait on a timer and, when it wakes up, stop
the process that it just implemented and let the next process run.

This is probably not a good idea because most code in Squeak is not
threadsafe and does not expect to be interrupted.  But it can be done.

Look at class Process and Semaphore.  All the code that does this is
open and easily changed.  Not necessarily easy to change without
breaking something, however!

-Ralph Johnson
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Block other processes?

John Almberg
Hi Ralph,

Thanks for your response.

I guess I should have said "a Morph's step processes".

Basically, what I'm doing is building a set of indicators that are  
measuring activity on a remote server. Each indicator is a Morph that  
both does the measurement and displays the results. The measurement  
is done in the Morph's step method.

So I should have said something like "Is a Morph's step method ever  
interrupted, or does it run to completion?"

However, thanks for the pointer to the Process and Semaphore code.  
I'm sure I won't be changing anything in there, but it will help to  
understand how Squeak is working.

Thanks!

-- John

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Block other processes?

Ralph Johnson
> I guess I should have said "a Morph's step processes".

Yes, that makes a difference!

In general, a Morph's step method runs to completion.  However, if you
had a higher-priority process running in the background, it would be
possible for it to be interrupted.  That probably won't happen unless
you write the background process.  If you do, you'll have to worry
about the fact that most Smalltalk classes are not thread safe.

-Ralph
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners