A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint...
-
Upload
clifford-francis -
Category
Documents
-
view
219 -
download
0
Transcript of A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint...
![Page 1: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/1.jpg)
A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems
Maurice HerlihyJoint with
Thomas Carle , Dimitra PapagiannopoulouIris Bahar , Tali Moreshet
![Page 2: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/2.jpg)
2
Modern Embedded Systems
• now many core, distributed memory• Parallel data structures • Locks don’t scale• Transactions do (más o menos)
![Page 3: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/3.jpg)
3
Dynamic Memory Management
• Software’s « oldest profession>• Usually provided by OS/Libraries• For parallel data structures• on embedded platforms• with HTM
![Page 4: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/4.jpg)
4
High-End Embedded Systems
• simplicity• small memory footprint• resource needs• roughly known in advance • but not always exactly
![Page 5: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/5.jpg)
5
Dynamic Memory Management
• Heap is linked list or binary tree • Applications explicitly malloc() and free() memory
Size: 16 bytesStart: 0x0800000
Size: 64 bytesStart: 0x0800100
![Page 6: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/6.jpg)
6
Principles of dynamic memory management• Allocate a 32-byte chunk
Size: 16 bytesStart: 0x0800000
Size: 64 bytesStart: 0x0800100
Too small Large enough
![Page 7: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/7.jpg)
7
Dynamic Memory Management
• Allocate a 32-byte chunk
Size: 16 bytesStart: 0x0800000
Size: 64 bytesStart: 0x0800100
![Page 8: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/8.jpg)
8
Dynamic Memory Management
• Allocate a 32-byte chunk
Size: 16 bytesStart: 0x0800000
Size: 64 bytesStart: 0x0800100
Size: 32 BytesStart: 0x0800100
Size: 32 BytesStart: 0x0800120
![Page 9: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/9.jpg)
9
Principles of dynamic memory management• Allocate a 32-byte chunk
Size: 16 bytesStart: 0x0800000
Size: 64 bytesStart: 0x0800100
Size: 32 BytesStart: 0x0800100
Size: 32 BytesStart: 0x0800120
![Page 10: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/10.jpg)
10
Principles of dynamic memory management• Allocate a 32-byte chunk
Size: 16 bytesStart: 0x0800000
Size: 32 BytesStart: 0x0800100
Size: 32 BytesStart: 0x0800120
Freeing is similar …
![Page 11: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/11.jpg)
11
Dynamic Memory Management
• is a concurrent data structure problem• steps must be atomic
![Page 12: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/12.jpg)
12
Fast Path
• Thread-local pools• successful malloc() and free() need no synchronization
• Calls happen inside transaction• Speculative allocation can speed up the execution
![Page 13: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/13.jpg)
13
Slow Path
• If local pool exhausted,• must allocate from shared heap
• Allocate within transaction• means more conflicts
• Instead:1. abort current transaction2. allocate fresh local pool3. restart transaction
![Page 14: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/14.jpg)
14
Benefits
• Transactions have smaller footprints• Disentangles • application • shared heap management
• Transactions more likely to commit
![Page 15: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/15.jpg)
15
Transaction-friendly memory management• At application startup:
1. One thread initializes the heap2. Each thread allocates its own local pool
![Page 16: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/16.jpg)
16
Transaction-friendly dynamic memory management
Enter transactionNext
Instruction ?
malloc()
Allocate from local pool
Enough memory?
Return allocated chunk
yes
Abort transactionEnter allocation transaction
Free remaining pool and allocate
fresh pool
Commit allocation
transaction no
![Page 17: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/17.jpg)
17
Transaction-friendly dynamic memory management
Enter transactionNext
Instruction ?
free()
Free to local pool
![Page 18: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/18.jpg)
18
Evaluation
• STAMP Vacation benchmark• 1, 2, 4, 8 and 16 cores• Local pools large enough so no refill needed• Tested:• transactional with local pools• lock-based with local pools• lock-based without local pools
![Page 19: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/19.jpg)
19
Evaluation
• Vacation benchmark (Normal run)
worse
better
![Page 20: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/20.jpg)
20
Evaluation (2)
• Vacation benchmark (Refill mechanism on one core)• 8 cores• local pool sizes: 64, 128, 256, 512, 1024, 2048 bytes• Transactional synchronization
![Page 21: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/21.jpg)
21
Evaluation (2)
• Vacation benchmark (Refill mechanism on one core)
![Page 22: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/22.jpg)
22
Evaluation (3)
• Vacation benchmark (Refill mechanism on all but one core)• 8 cores• local pool sizes: 64, 128, 256, 512, 1024 or 2048 bytes• Transactional synchronization
![Page 23: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/23.jpg)
23
Evaluation (3)
• Vacation benchmark (Refill mechanism on all but one core)
worst case: 20% increase in execution time
« Wall » between 512 and 1024 bytes: refills may induce additional conflicts
![Page 24: A Transaction-Friendly Dynamic Memory Manager for Embedded Multicore Systems Maurice Herlihy Joint with Thomas Carle, Dimitra Papagiannopoulou Iris Bahar,](https://reader030.fdocuments.net/reader030/viewer/2022033104/56649db05503460f94a9f1c3/html5/thumbnails/24.jpg)
24
Conclusions
• Dynamic memory management for Embedded TM• Results• Better than locking, in-transaction malloc• More flexible than static allocation
• Future work• More benchmarks• Explore new fallback reprovision strategies• Memory stealing between threads