guile-devel
[Top][All Lists]
Advanced

[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 2.0.0.16 (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 
concurrently 
(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 - http://www.xs4all.nl/~hanwen





reply via email to

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