Garbage Collection for Edge Computing Andrés Amaya García David May Ed Nutting sourcecodeartisan.com bristol.ac.uk
Introduction § Modern programming languages provide a high-level view of data and control – Python, C#, JavaScript, etc... – Productivity – Trust § Modern languages are not used in embedded systems because software garbage collectors: – Impose high performance and memory overheads – Cannot be used in real-time systems sourcecodeartisan.com bristol.ac.uk
Objectives § Efficiently support modern languages in embedded systems – think small IoT edge devices e.g. ARM Cortex-M processors. § Investigate hardware –instead of software– collectors – High run-time performance – Low memory requirements – Capable of hard real-time sourcecodeartisan.com bristol.ac.uk
Integrated Hardware Garbage Collection (IHGC) § Exact collector Register File – Every word has a 1-bit tag: pointer vs data § Indirection through handles Processor Garbage – Directory memory contains object’s metadata Pipeline Collector – Tightly integrated with processor § Hardware state machine for collector – Each state transition performed in one memory cycle – Collector operates when the processor is not Directory Main Memory accessing memory § Allocations via an instruction Private bus Shared Shared memory bus bus bus sourcecodeartisan.com bristol.ac.uk
IHGC – Indirection Through Handles Directory Pointer Handle Offset Address Size Mark Deep List Allocated object + Free Memory sourcecodeartisan.com bristol.ac.uk
IHGC – Indirection Through Handles Directory Pointer Handle Offset Address Size Mark Deep List Pointers are not physical Allocated object + memory Free Memory addresses sourcecodeartisan.com bristol.ac.uk
IHGC – Indirection Through Handles Directory Pointer Handle Offset Address Size Mark Deep List Pointers are not physical Allocated object + memory Directory has Free Memory addresses object metadata and collection information sourcecodeartisan.com bristol.ac.uk
IHGC – Indirection Through Handles Directory Pointer Handle Offset Address Size Mark Deep List Pointers are not physical Allocated object + memory Directory has Free Memory addresses object metadata and collection information Memory access in two steps: 1. Calculate main memory address 2. Access main memory sourcecodeartisan.com bristol.ac.uk
IHGC – Garbage Collection State Machine Check Scan & Mark Root Root § Mark-Compact collector Pop Scan Check § Roots are pointers in the registers Next Object & Mark Object Word Pointer § Each state transition is performed in one memory cycle Load Read Clear Object Word Word Info Zero Write Word Word Mark Objects Compact Mark Roots sourcecodeartisan.com bristol.ac.uk
IHGC – Coordination § Mark stage – Pointers loaded from main memory are processed for marking – Conceptually similar to a traditional read barrier § Compact stage – Redirect memory access to the correct location when the object accessed is being compacted § Transparent from the program’s point of view § Does not incur pauses or performance penalties sourcecodeartisan.com bristol.ac.uk
Experimental Setup § Modelled an ARM Cortex-M0 alongside the IHGC § Benchmarks: – BEEBS – Python 3 scripts running on MicroPython § LLVM compiler sourcecodeartisan.com bristol.ac.uk
Results – BEEBS sourcecodeartisan.com bristol.ac.uk
Results – BEEBS Comparable performance in programs that do NOT use dynamic memory sourcecodeartisan.com bristol.ac.uk
Results – BEEBS Better performance in programs that use dynamic memory sourcecodeartisan.com bristol.ac.uk
Results – MicroPython sourcecodeartisan.com bristol.ac.uk
Results – Pauses sourcecodeartisan.com bristol.ac.uk
Results – Pauses x1.5 larger heap sourcecodeartisan.com bristol.ac.uk
Results – Pauses Up to 20% reduction in pauses when data width increases sourcecodeartisan.com bristol.ac.uk
Conclusion § IHGC splits collection work at the granularity of a memory cycle § Collection worked performed when the processor is not using the memory § Comparable or better performance when running C programs § Python scripts run 1.5-7 faster in IHGC system § Hard real-time sourcecodeartisan.com bristol.ac.uk
Thank You! Questions? Andrés Amaya García andres.amayagarcia@bristol.ac.uk sourcecodeartisan.com sourcecodeartisan.com bristol.ac.uk
Recommend
More recommend