bristol.ac.uk sourcecodeartisan.com
Garbage Collection for Edge Computing
Andrés Amaya García David May Ed Nutting
Garbage Collection for Edge Computing Andrs Amaya Garca David May - - PowerPoint PPT Presentation
Garbage Collection for Edge Computing Andrs Amaya Garca 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,
bristol.ac.uk sourcecodeartisan.com
Andrés Amaya García David May Ed Nutting
bristol.ac.uk sourcecodeartisan.com
§ 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
bristol.ac.uk sourcecodeartisan.com
§ 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
bristol.ac.uk sourcecodeartisan.com
§ Exact collector
– Every word has a 1-bit tag: pointer vs data
§ Indirection through handles
– Directory memory contains object’s metadata – Tightly integrated with processor
§ Hardware state machine for collector
– Each state transition performed in one memory cycle – Collector operates when the processor is not accessing memory
§ Allocations via an instruction
Register File Processor Pipeline Garbage Collector Directory Main Memory
Private bus Shared bus Shared memory bus bus
bristol.ac.uk sourcecodeartisan.com
Handle Pointer Offset Address Directory Size Mark Deep List
+
Allocated object Free Memory
bristol.ac.uk sourcecodeartisan.com
Handle Pointer Offset Address Directory Size Mark Deep List
+
Allocated object Free Memory
Pointers are not physical memory addresses
bristol.ac.uk sourcecodeartisan.com
Handle Pointer Offset Address Directory Size Mark Deep List
+
Allocated object Free Memory
Pointers are not physical memory addresses Directory has
and collection information
bristol.ac.uk sourcecodeartisan.com
Handle Pointer Offset Address Directory Size Mark Deep List
+
Allocated object Free Memory
Pointers are not physical memory addresses Directory has
and collection information Memory access in two steps: 1. Calculate main memory address 2. Access main memory
bristol.ac.uk sourcecodeartisan.com
§ Mark-Compact collector § Roots are pointers in the registers § Each state transition is performed in
Scan Root Check & Mark Root Pop Next Object Scan Object Word Check & Mark Pointer Load Object Info Read Word Clear Word Zero Word Write Word Mark Roots Mark Objects Compact
bristol.ac.uk sourcecodeartisan.com
§ 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
bristol.ac.uk sourcecodeartisan.com
§ Modelled an ARM Cortex-M0 alongside the IHGC § Benchmarks: – BEEBS – Python 3 scripts running on MicroPython § LLVM compiler
bristol.ac.uk sourcecodeartisan.com
bristol.ac.uk sourcecodeartisan.com
Comparable performance in programs that do NOT use dynamic memory
bristol.ac.uk sourcecodeartisan.com
Better performance in programs that use dynamic memory
bristol.ac.uk sourcecodeartisan.com
bristol.ac.uk sourcecodeartisan.com
bristol.ac.uk sourcecodeartisan.com
x1.5 larger heap
bristol.ac.uk sourcecodeartisan.com
Up to 20% reduction in pauses when data width increases
bristol.ac.uk sourcecodeartisan.com
§ 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
bristol.ac.uk sourcecodeartisan.com
Andrés Amaya García andres.amayagarcia@bristol.ac.uk sourcecodeartisan.com