4 ms·
Quoting ko1 (https://bugs.ruby-lang.org/issues/8339#note-11 https://bugs.ruby-lang.org/issues/8339#note-11): > Parallel tracing needs an assumption that "d
by judofyr 13y ago
Quoting ko1 (https://bugs.ruby-lang.org/issues/8339#note-11 https://bugs.ruby-lang.org/issues/8339#note-11):
> Parallel tracing needs an assumption that "do not move (free) memory
> area except sweeping timing". Current CRuby does.
> For example: "ary << obj". Yes, the CRuby's memory management strategy
> (assumption) is different from normal interpreters.
- m0th87 13y agoIsn't memory only shuffled around during compaction? Why not mark/sweep in parallel, then stop-the-world at compaction time?
- Skinney 13y agoIn a nutshell, generational GCs works by scanning live data. Thus, anything not scanned is garbage. While the application is running, it also allocates new data. If you allocate an object somewhere --after-- that area has been scanned, the GC will treat that area as garbage, and then you will have memory corruption, leading to segfaults and other nice things. While parallel mark/sweep is certainly doable (Java does this) it's not easy to get right.
- riffraff 13y agonotice that refers to parallel (multiple GC threads) but doesn't rule out concurrent (one gc thread concurrent to the application thread)
- Skinney 13y agoWouldn't two threads possibly run in parallel in a multi-core system? Concurrency, as I understand it, is dividing things into tasks that can run (to some degree) independantly of eachother. Parallelism is two or more concurrent tasks running simultaniously. This if you have one gc thread and one application thread, you have the possibility of them running in parallel.
- riffraff 13y agoyes, they can run in parallel. But in the context of GC (in my understanding) the distinction goes like * concurrent GC is when (some phases of) the garbage collection happen in a separate thread from the main program. * parallel GC is when (some phases of) the collection are performed by multiple threads. So e.g. in a mark&sweep collector you can have a background thread that performs the mark phase concurrently or you can have a parallel collector that uses multiple threads to perform the mark phase. In MRI you can't do the latter but it could be possible to do the former, according to the thread referenced earlier.