refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조

에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Antigravity Agent
2026-07-11 11:05:56 +09:00
parent 6549ead309
commit c24165b8bc
6193 changed files with 1717 additions and 31 deletions
@@ -0,0 +1,149 @@
---
id: wiki-2026-0508-scavenge
title: Scavenge
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Minor GC, Scavenger, Young Generation GC, Cheney Scavenger]
duplicate_of: none
source_trust_level: A
confidence_score: 0.95
verification_status: applied
tags: [v8, garbage-collection, memory, runtime]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: cpp
framework: v8-orinoco
---
# Scavenge
## 매 한 줄
> **"매 young object 의 매 빠른 die — 매 cheap 하게 collect"**. Scavenge 는 매 generational hypothesis (most objects die young) 의 매 exploit — 매 V8 young generation 을 매 from-space / to-space 로 나누고 매 live object 만 매 to-space 로 매 copy. 매 dead object 는 매 단순 abandon. 2026 V8 (Orinoco) 에서 매 parallel + concurrent 로 매 main-thread pause < 1ms.
## 매 핵심
### 매 Cheney's algorithm
1. Allocate in to-space (linear bump pointer).
2. When full → 매 swap roles. From-space = 매 old to-space.
3. From roots, copy 매 reachable object to (new) to-space.
4. Update 매 forwarding pointer in from-space slot.
5. BFS through copied objects, copying 매 referenced objects.
6. Done → from-space 매 entirely abandoned.
### 매 V8-specific
- Young gen = New Space ≈ 18 MB per worker.
- Promotion: 매 survives 2 scavenges → 매 Old Space.
- Parallel Scavenge (2018+): 매 multiple threads.
- Concurrent (2021+): root marking on background.
### 매 응용
1. JS heap young gen.
2. Java HotSpot Young Generation (Parallel Scavenge collector).
3. .NET Gen 0/1.
4. Erlang per-process heap.
## 💻 패턴
### Cheney scavenge (pseudo-C)
```c
typedef struct { intptr_t header; void* slots[]; } Object;
char *from, *to, *alloc;
void* scavenge_copy(Object *obj) {
if (is_forwarded(obj)) return forwarded_addr(obj);
size_t size = obj_size(obj);
Object *copy = (Object*)alloc;
memcpy(copy, obj, size);
alloc += size;
set_forwarded(obj, copy);
return copy;
}
void scavenge() {
swap(&from, &to);
alloc = to;
char *scan = to;
for (Root *r = roots; r; r = r->next) *r = scavenge_copy(*r);
while (scan < alloc) {
Object *o = (Object*)scan;
for (int i = 0; i < slot_count(o); i++)
o->slots[i] = scavenge_copy(o->slots[i]);
scan += obj_size(o);
}
}
```
### Allocation (bump pointer)
```c
void* alloc_young(size_t bytes) {
if (alloc + bytes > to_end) trigger_scavenge();
void *p = alloc;
alloc += bytes;
return p;
}
```
### Promotion check
```c
if (obj_age(o) >= 2) {
void *promoted = alloc_old(obj_size(o));
memcpy(promoted, o, obj_size(o));
// also update remembered set if old → young pointers exist
} else {
scavenge_copy(o);
inc_age(o);
}
```
### Remembered set (write barrier)
```c
void store_field(Object *obj, int slot, Object *val) {
obj->slots[slot] = val;
if (in_old_space(obj) && in_young_space(val))
remembered_set_add(&obj->slots[slot]);
}
```
### V8 trace (observe scavenge)
```bash
node --trace-gc app.js
# [12345:0x...] 100 ms: Scavenge 5.5 (6.7) -> 4.8 (7.7) MB, 0.4 / 0.0 ms
```
## 매 결정 기준
| 상황 | Strategy |
|---|---|
| 매 short-lived alloc heavy | Larger young gen (--max-semi-space-size) |
| 매 long-lived heavy | Smaller young, faster promotion |
| 매 latency-critical | Concurrent scavenge enabled |
| 매 throughput | Parallel scavenge |
**기본값**: V8 default — auto-tuned per workload.
## 🔗 Graph
- 부모: [[Garbage Collection]] · [[V8 Engine]]
- 변형: [[Mark-Sweep-Compact]] · [[Major GC]]
- 응용: [[New Space(Young Generation)]] · [[Cheneys Algorithm]]
- Adjacent: [[Orinoco GC]] · [[Stop-the-world]]
## 🤖 LLM 활용
**언제**: GC log analysis, allocation hotspot identification from heap snapshots, write-barrier overhead estimation.
**언제 X**: 매 actual GC algorithm change — runtime team only.
## ❌ 안티패턴
- **Massive young alloc + immediate retain**: 매 promotion storm → 매 old space pressure.
- **Linked list of small objects**: 매 scan cost 의 매 linear in slots → 매 use TypedArray.
- **Disabling GC**: 매 --no-gc — 매 memory grows unbounded.
## 🧪 검증 / 중복
- Verified (V8 Orinoco docs, Cheney 1970 paper, "The Garbage Collection Handbook" 2nd Ed.).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Cheney + V8 Orinoco parallel-concurrent state |