[squeak-dev] Access to processes hierarchie

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

[squeak-dev] Access to processes hierarchie

Frederic Pluquet-3
Hello,

I'm looking for a way to access dynamically to the "father" process of a forked process...

|p1|
p1 := Processor activeProcess.
[ how to retrieve dynamically the process p1 here ? ] fork.
[ |p2| 
p2 := Processor activeProcess.
 [ how to retrieve dynamically the process p1 here (grandfather of the current process) ?
how to retrieve dynamically the process p2 here (father of the current process) ?] fork] fork.

... and so on.

How to access dynamically to the ancestors of a process ? 
Perhaps by the suspendedContext ? Or by something else ?

Fréd

--
Frédéric Pluquet
Université Libre de Bruxelles (ULB)
Assistant
http://www.ulb.ac.be/di/fpluquet


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Access to processes hierarchie

Eliot Miranda-2
You'll need to add an instance variable to process and modify fork to record the origin.  Currently processes don't remember their ancestor.  I recommend you create a special fork that remembers ancestry, rather than modifying the default fork.  You will potentially accumulate a lot of garbage otherwise.  Also, you might consider making the reference from a process to its parent weak to allow the parent to be GC'ed when it terminates even if it has children.

Other fun things include implementing join where a parent will block until all of its children have completed or been terminated.

The suspendedContext is the head of the process's chain of activations and so points to what the process is doing, not to where it came from.  You can locate the block that started the process, but not in general the process that contained the home of the block, because a context doesn't refer to the process in which it was created (for strong performance reasons), and once the home has been returned from it is typically only referenced from blocks created within it.


On Fri, Jul 11, 2008 at 2:51 PM, Frederic Pluquet <[hidden email]> wrote:
Hello,

I'm looking for a way to access dynamically to the "father" process of a forked process...

|p1|
p1 := Processor activeProcess.
[ how to retrieve dynamically the process p1 here ? ] fork.
[ |p2| 
p2 := Processor activeProcess.
 [ how to retrieve dynamically the process p1 here (grandfather of the current process) ?
how to retrieve dynamically the process p2 here (father of the current process) ?] fork] fork.

... and so on.

How to access dynamically to the ancestors of a process ? 
Perhaps by the suspendedContext ? Or by something else ?

Fréd

--
Frédéric Pluquet
Université Libre de Bruxelles (ULB)
Assistant
http://www.ulb.ac.be/di/fpluquet