"Mingnan G." <lelandguo@yahoo.com.cn> wrote in message
news:1145666703.438814.294550@j33g2000cwa.googlegr oups.com...[color=blue]
> Hello everyone.
>
> I have written a garbage collector for standard C++ application. It has
> following main features.[/color]
[...]
[color=blue]
> 4) Small Overhead
> The runtime cost of application threads is far less than a normal
> reference counting.[/color]
I posted something on amortizing the cost of reference counting down to
virtually zero by using by using something called "proxy" garbage
collection. Unfortunately, I can't seem to find the exact message on Google,
so I appended my *copy to the end of this message...
[color=blue]
> If there is no concurrently running scavenging
> action, there is no write-barrier overhead, no strong memory ordering
> requirement, no synchronization overhead.[/color]
What sort of transactions occur between your collector and its mutators
during a "scavenge" operation? Do your mutators have any #StoreLoad
dependencies during a scavenge operation? I take it that the collector can
indeed interrupt mutators during scavenges, correct?
[color=blue]
> There is no extra code or
> data structure injected for GC safe point. The whole system does not
> require strong memory ordering, it is suitable for most modern
> processor architecture. Multi-processor concurrency can be further
> exploited by the multi-threading property of mutator and collector.[/color]
I am guessing, but from this, it sounds like your design allows for loads to
pass stores (e.g., #LoadStore dependency ) right? If so, how does your stuff
differ from the following scheme:
http://citeseer.ist.psu.edu/domani00implementing.html http://groups.google.com/group/comp....60411bcd?hl=en
[...]
[color=blue]
> Any comments are welcome![/color]
FWIW, I use a more relaxed version of the synchronization pattern I briefly
described here:
http://groups.google.com/group/comp....afb8e0a3?hl=en
For my proxy gc that I briefly introduced here:
http://groups.google.com/group/comp....684aa070964e6a
As you can see, the periodic/episodic synchronization usage pattern
amortizes the cost of memory barriers over successive epochs in time. This
allows mutators to make synchronization-free local reference count
adjustments; no atomic operations or memory barriers are required. The same
goes for collector<->mutator communications. So, a mutator can literally
adjust a reference count by doing this:
++this_mutator->refs[whatever];
Both VZOOM and Joe Seighs RCU-SMR can be implemented in a way that can that
can dissect quiescent-states out of operating system provided
information... Except, as I stated before, the stuff that I invented can be
based on a more relaxed sync pattern I created.
BTW, speaking of inventions, If you think you have something truly novel,
and sets you apart from prior art, I suggest that you think about doing a
patent feasibility study, and possibly going thought the patent application
process. I suggest that you read the following thread:
http://groups.google.com/group/comp....9072fea09fb64e
:O
I would also suggest that you include comp.programming.threads into the
discussion...
* ----------------
"David Hopwood" <david.nospam.hopwood@blueyonder.co.uk> wrote in message
news:1143735782.586805.23710@i39g2000cwa.googlegro ups.com...[color=blue]
> [posting via Google because of news server problems -- sorry if this is
> a duplicate]
>
> Chris Thomasson wrote:[color=green]
>> Sergey P. Derevyago wrote:[color=darkred]
>>>Joe Seigh wrote:
>>>
>>>>> The question is: Can you take XXX proxy GC and plug it just like
>>>>>Boehm GC?
>>>>
>>>>No, things like RCU, etc... aren't used for storage management. They're
>>>>used for read lock-free solutions to the reader/writer problem in a
>>>>multi-threaded environment.
>>>
>>> So I was right: there is no GC/C++ that doesn't "stop the world".
>>> And it seems like it's not possible for any GC/C++ not to "stop the
>>> world".[/color]
>>
>> You don't need to garbage collect everything. Proxy collection can allow
>> an application to get away from traditional GC, and all of the overhead
>> that comes along with them.[/color]
>
> I always find it odd when people talk about the "overhead of GC" as
> though
> other memory management techniques had no overheads.
>
> You shouldn't assume that a hybrid of GC and some other memory
> management
> technique will have lower overhead than applying GC to all objects. If
> the
> other technique is some form of reference counting (as is commonly the
> case
> when using proxy GC), then it definitely won't; refcounting is very
> inefficient.[/color]
I agree, atomic lock-free refcounting can be very expensive. However, you
can simply amortize the cost of reference counting, if your using
ref-counting to begin with, when your implementing a proxy collector. You
don't reference count everything, "just" the collector structures. IMO,
using lock-free atomic reference counting to protect each node of a
data-structure would generate massive overheads. However, as you probably
know, there are other methods that can amortize the cost of actually
reference counting the collector structures. I created a straightforward
usage pattern for my VZOOM collector that is based on per-thread
periodic/episodic synchronizations...
- You don't need to activate the collector every time you access a shared
data-structure... You can setup a runtime configurable dynamic ratio of
accesses:syncs... Unfortunately, algorithms like RCU are not compatible with
this setup because it simply requires an arbitrary number of references to
persist over quiescent states. Your application will drive right off a cliff
if your try to do this with RCU! IMO, even RCU-SMR can't really fit this
bill because it was not really designed to allow the user to grab an
arbitrary number of references...
- Also, the collector I came up can be implemented with POSIX and dependant
load-ordering. So, an application can use it to implement lock-free reader
patterns on many different operating systems and processor combinations. Can
a traditional GC compete with the flexibility of a portable user-space proxy
collector wrt solving the reader/writer problem in lock-free algorithms?