Re: [Pharo-dev] Can we have subclasses of Process?

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

Re: [Pharo-dev] Can we have subclasses of Process?

Eliot Miranda-2
Hi Denis,

    as others have pointed out one can subclass Process.  One can also add instance variables to Process.  The constraint is that the first four (*) instance variables must be left unaltered.  The VM makes use of the first four:

Object subclass: #Link
instanceVariableNames: 'nextLink'
Link subclass: #Process
instanceVariableNames: 'suspendedContext priority myList...

(*five when we have the multithreaded FFI, the fifth being threadId used to bind processes to specific OS threads when required)

The same goes for ProcessorScheduler - the VM uses quiescentProcessLists & activeProcess, and Semaphore - the VM uses firstLink lastLink & excessSignals.

On Thu, Aug 17, 2017 at 5:03 AM, Denis Kudriashov <[hidden email]> wrote:
Hi.

Is it allowed to subclass Process?  I remember that there were some problems with it but I could not find any information.  

Generally I think about system processes which can be represented by concrete subclasses. For example explicit UIProcess can be used to remove many #isUIProcess conditions from system.

Best regards,
Denis



--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Can we have subclasses of Process?

Bert Freudenberg
On Thu, Aug 17, 2017 at 9:28 PM, Eliot Miranda <[hidden email]> wrote:
Hi Denis,
as others have pointed out one can subclass Process.  One can also add instance variables to Process. 
​[...]

On Thu, Aug 17, 2017 at 5:03 AM, Denis Kudriashov <[hidden email]> wrote:
Generally I think about system processes which can be represented by concrete subclasses. For example explicit UIProcess can be used to remove many #isUIProcess conditions from system.

I don't think that's a good use case​, since frequently there would be more than one UIProcess instance and you still would have to check if the one you're looking at is the currently active one. E.g. every time a debugger pops up for the current UI process (e.g. after a user interrupt) the current UI process is suspended, and a new one is spawned to run the debugger.

- Bert -