mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
Initial file
This commit is contained in:
parent
4d2b59966c
commit
6a572635df
1 changed files with 64 additions and 0 deletions
64
docs/Garbage-Collector.md
Normal file
64
docs/Garbage-Collector.md
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
TODO: notes on how cyclone's GC works
|
||||||
|
|
||||||
|
terms: mutators, collector, what else?
|
||||||
|
|
||||||
|
two types:
|
||||||
|
|
||||||
|
- minor GC (stack portion from Cheney on MTA)
|
||||||
|
- major GC - Doligez-Leroy-Gonthier (DLG) collector
|
||||||
|
|
||||||
|
motivations:
|
||||||
|
- extend baker's approach to support multiple mutators
|
||||||
|
- State of the art GC's are built on top of DLG (stopless, chicken, clover)
|
||||||
|
|
||||||
|
limitations or potential issues:
|
||||||
|
- DLG memory fragmentation could be an issue for long-running programs
|
||||||
|
|
||||||
|
## minor GC
|
||||||
|
|
||||||
|
changes from Cheney on MTA:
|
||||||
|
- each thread has its own stack
|
||||||
|
|
||||||
|
## major GC
|
||||||
|
|
||||||
|
overview from paper
|
||||||
|
|
||||||
|
- single collector thread, multiple mutator threads
|
||||||
|
- single heap
|
||||||
|
- generally try to use atomic operations, but there is some locking. In particular, heap is protected by lock during object allocation / deallocation
|
||||||
|
|
||||||
|
GC stages / status:
|
||||||
|
/* Enums for tri-color marking */
|
||||||
|
typedef enum { STATUS_ASYNC
|
||||||
|
, STATUS_SYNC1
|
||||||
|
, STATUS_SYNC2
|
||||||
|
} gc_status_type;
|
||||||
|
|
||||||
|
typedef enum { STAGE_CLEAR_OR_MARKING
|
||||||
|
, STAGE_TRACING
|
||||||
|
//, STAGE_REF_PROCESSING
|
||||||
|
, STAGE_SWEEPING
|
||||||
|
, STAGE_RESTING
|
||||||
|
} gc_stage_type;
|
||||||
|
|
||||||
|
object colors:
|
||||||
|
red
|
||||||
|
blue
|
||||||
|
white
|
||||||
|
gray
|
||||||
|
black
|
||||||
|
|
||||||
|
|
||||||
|
important to explain how minor/major algorithms are interleaved. EG:
|
||||||
|
|
||||||
|
thread states:
|
||||||
|
typedef enum { CYC_THREAD_STATE_NEW
|
||||||
|
, CYC_THREAD_STATE_RUNNABLE
|
||||||
|
, CYC_THREAD_STATE_BLOCKED
|
||||||
|
, CYC_THREAD_STATE_BLOCKED_COOPERATING
|
||||||
|
, CYC_THREAD_STATE_TERMINATED
|
||||||
|
} cyc_thread_state_type;
|
||||||
|
|
||||||
|
typedef struct gc_thread_data_t gc_thread_data;
|
||||||
|
|
||||||
|
ETC
|
Loading…
Add table
Reference in a new issue