What happens if a Process is terminated inside of Process>>#terminate?

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

What happens if a Process is terminated inside of Process>>#terminate?

Tim Johnson-2
Hi newbies list,

I wrote a little Morph to monitor live processes vs terminated
processes.  In doing so, while experimenting, I ended up with one
Process which seemed to be terminated inside of Process>>#terminate,
which I think is strange.  Is it strange?  I ended up discarding the
working copy of my image and reverting to the last saved version.

It is interesting to see how many terminated Processes are left behind
when WebServer has been running for a long time.  Luckily they all seem
to be swept away with a #garbageCollect.  I do wonder why my image can
go for 24 hours without something in the image performing a garbage
collection.  SHTextStylerSH80 creates and terminates many processes
also, but they seem to get collected without my intervention (?).

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

Re: What happens if a Process is terminated inside of Process>>#terminate?

marcel.taeumel
Hi Tim J, 

as far as I know, every #basicNew: (primitive 71) triggers a GC. Not necessarily a full GC as through manually calling "Smalltalk garbageCollect", but at least an incremental GC. So, the image doing at least something (like the ticking clock in the upper right corner), will trigger a GC quite frequently.

Best,
Marcel

Am 08.06.2020 20:28:53 schrieb Tim Johnson <[hidden email]>:

Hi newbies list,

I wrote a little Morph to monitor live processes vs terminated
processes. In doing so, while experimenting, I ended up with one
Process which seemed to be terminated inside of Process>>#terminate,
which I think is strange. Is it strange? I ended up discarding the
working copy of my image and reverting to the last saved version.

It is interesting to see how many terminated Processes are left behind
when WebServer has been running for a long time. Luckily they all seem
to be swept away with a #garbageCollect. I do wonder why my image can
go for 24 hours without something in the image performing a garbage
collection. SHTextStylerSH80 creates and terminates many processes
also, but they seem to get collected without my intervention (?).

Thanks,
Tim J
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

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

Re: What happens if a Process is terminated inside of Process>>#terminate?

marcel.taeumel
... maybe it is even every 100th (or n-th) time calling #basicNew:. Something like that. :-)

Best,
Marcel

Am 08.06.2020 21:09:50 schrieb Marcel Taeumel <[hidden email]>:

Hi Tim J, 

as far as I know, every #basicNew: (primitive 71) triggers a GC. Not necessarily a full GC as through manually calling "Smalltalk garbageCollect", but at least an incremental GC. So, the image doing at least something (like the ticking clock in the upper right corner), will trigger a GC quite frequently.

Best,
Marcel

Am 08.06.2020 20:28:53 schrieb Tim Johnson <[hidden email]>:

Hi newbies list,

I wrote a little Morph to monitor live processes vs terminated
processes. In doing so, while experimenting, I ended up with one
Process which seemed to be terminated inside of Process>>#terminate,
which I think is strange. Is it strange? I ended up discarding the
working copy of my image and reverting to the last saved version.

It is interesting to see how many terminated Processes are left behind
when WebServer has been running for a long time. Luckily they all seem
to be swept away with a #garbageCollect. I do wonder why my image can
go for 24 hours without something in the image performing a garbage
collection. SHTextStylerSH80 creates and terminates many processes
also, but they seem to get collected without my intervention (?).

Thanks,
Tim J
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

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

Re: What happens if a Process is terminated inside of Process>>#terminate?

K K Subbu
In reply to this post by Tim Johnson-2
On 08/06/20 11:58 pm, Tim Johnson wrote:
> I do wonder why my image can go for 24 hours without something in the
>  image performing a garbage collection.

garbage is collected only where VM's "free" memory runs low.

See World Menu -> help -> vm statistics

to see memory counts. In the same menu, you will also see "space left",
which triggers garbage collection and then reports the free space.

In Squeak, a "process" is just a chain of activation frames (contexts)
tracking nested sends. This is the chain of contexts you see in Process
browser (right pane) or in Debugger (top panel).

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

Re: What happens if a Process is terminated inside of Process>>#terminate?

Mark Miller
In reply to this post by Tim Johnson-2
Re. garbage collection

The description of the GC from the book, "Squeak: Open Personal Computing and Multimedia" might help with your question. It's from the chapter "A Tour of the Squeak Object Engine," written by Tim Rowledge:

"Squeak uses an interesting hybrid of generation scavenging and mark-sweep collection as its garbage collector. Once the image is loaded into memory the end address of the last object is used as a boundary mark to separate two generations [old and new].

When the remaining free memory runs low, or a preset number of objects have been allocated, the VM will pause to garbage collect the new object region (ObjectMemory>>IncrementalGC). This is done with a mark-sweep algorithm modified to trace only those objects in the new region, thus touching considerably less memory than an entire image sweep. ...

[The] use of the two generations means that it can typically run in a very short time ... During activities like typing or browsing and coding, the system will run an incremental garbage collect one to five times per second. ...

One limitation of an incremental collection is that any objects from the old region that are no longer referenced do not get freed and collected. Of course, the observation that lead to generation scavenging tells us that this usually doesn't matter since old objects generally continue to live. However, sometimes we do need to completely clean out the object memory. ... Squeak simply forces the system to believe that the old/new boundary is at the bottom of the old region. Thus, the entire image is now considered to be new objects, and all objects will be fully traced. Look at the ObjectMemory>>fullGC method for details."

In another part of the chapter he says the generation scavenger method is based on the idea that older objects will tend to not need to be collected, or if they do, it's not that often. Some old objects will hang around forever, because something is always referencing them. However, newer objects tend to have very short lives, and so will be collected most frequently.

---Mark
[hidden email]

> On June 8, 2020 at 12:28 PM Tim Johnson <[hidden email]> wrote:
>
>
> Hi newbies list,
>
> I wrote a little Morph to monitor live processes vs terminated
> processes.  In doing so, while experimenting, I ended up with one
> Process which seemed to be terminated inside of Process>>#terminate,
> which I think is strange.  Is it strange?  I ended up discarding the
> working copy of my image and reverting to the last saved version.
>
> It is interesting to see how many terminated Processes are left behind
> when WebServer has been running for a long time.  Luckily they all seem
> to be swept away with a #garbageCollect.  I do wonder why my image can
> go for 24 hours without something in the image performing a garbage
> collection.  SHTextStylerSH80 creates and terminates many processes
> also, but they seem to get collected without my intervention (?).
>
> Thanks,
> Tim J
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners