Alexandre Buisse wrote:
On 6/8/05, Leopold Toetsch <[EMAIL PROTECTED]> wrote:

1) a local GC run in the threads arena
2) GC of the shared arena

Case 1) is simple as it's fully private to the thread. A non-shared
object can not be referenced by a shared one, therefore all local
garbage can be identified.


Does that mean that we have a gc structure in each arena (which, as
far as I understand parrot design, is similar to a process memory
space) ?

Object memory organization WRT threads isn't yet finally specified. But to me it seems that separating memory areas for threads is the best approach. Most of the objects created are temporaries and cleaning these is therefore a thread-local operaion.

 ...Or is a gc rather attached to a thread or a shared arena ?
(My question could be restated in : "are we sure that a thread only
uses one arena for its local storage ?").

Yep. When a new )threaded) interpreter is created it also creates it's own memory area (interpreter->arena_base). The question remains of course, how the shared resources are managed.

For the shared case 2) things get more complicated. Something like this
might happen:

- a "global GC start event" is triggered
- all threads must meet at a rendevous point
- all threads start a mark phase, shared items are marked either inside
a mutex lock or faster with an atomic BTS or CAS [1]
- threads can continue to run code or run a private GC too (as the mark
is already done)
- the owner of the shared arena waits for all threads to finish mark
- the owner of the shared arena collects garbage


This seems the simplest way to perform it. I am not sure I understand
why threads must meet at a rendezvous point, though. Couldn't they
just stop what they were doing, mark their shared items and go on ?

Well, yes that is the rendevous point.

I will begin to dig into parrot source, and hope I will be able to
start coding soon, if everyone is ok with the current design.

Before coding I'd like to have a much more detaild paper WRT GC strategy and implementation. This can of course be a src file too, with "the plan" inside as comments and a code outline.

Regards

Alexandre

leo

Reply via email to