[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the new gc asserts in master

From: Han-Wen Nienhuys
Subject: Re: the new gc asserts in master
Date: Thu, 28 Aug 2008 10:20:19 -0300
User-agent: Thunderbird (X11/20080723)

Han-Wen Nienhuys escreveu:
>>> The use of scm_gc_mark() outside of GC is fundamentally broken, since it
>>> creates race conditions in the presence of threads.
>> I was not aware that this was the case. 
>> My impression was that the mark phase is global; it requires all threads
>> that were in guile mode to go dormant, and those that were not in guile
>> mode cannot enter guile mode until the mark is complete.
> Yes, the mark phase is global, but the thread locking is done in
> scm_i_gc; once the marking starts, there is only one thread.  Since
> scm_gc_mark is called from the smob mark functions, it does not force
> other threads to go dormant.  It could, but I suspect the lock would
> be a contention point.

It would be very cool to have thread safe marking for a different reason:
marking it is the expensive step in GC, so if we can do that in N threads 
(on a SMP machine) we have can speed it up by almost a factor N.

To do it properly, you could do the bitvector marking with 
a compare & swap instruction.

 Han-Wen Nienhuys - address@hidden -

reply via email to

[Prev in Thread] Current Thread [Next in Thread]