| 1 | \chapter{Allocator}
|
|---|
| 2 |
|
|---|
| 3 | ====================
|
|---|
| 4 |
|
|---|
| 5 | Writing Points:
|
|---|
| 6 |
|
|---|
| 7 | Objective of uHeapLmmm.
|
|---|
| 8 | Design philosophy.
|
|---|
| 9 | Background and previous design of uHeapLmmm.
|
|---|
| 10 |
|
|---|
| 11 | Distributed design of uHeapLmmm.
|
|---|
| 12 | ----- SHOULD WE GIVE IMPLEMENTATION DETAILS HERE? -----
|
|---|
| 13 | > figure.
|
|---|
| 14 | > Advantages of distributed design.
|
|---|
| 15 |
|
|---|
| 16 | The new features added to uHeapLmmm (incl. malloc_size routine)
|
|---|
| 17 | CFA alloc interface with examples.
|
|---|
| 18 | > Why did we need it?
|
|---|
| 19 | > The added benefits.
|
|---|
| 20 | ----- SHOULD WE GIVE PERFORMANCE AND USABILITY COMPARISON OF DIFFERENT INTERFACES THAT WE TRIED? -----
|
|---|
| 21 |
|
|---|
| 22 | Performance evaluation using u-benchmark suite.
|
|---|
| 23 |
|
|---|
| 24 | ====================
|
|---|
| 25 |
|
|---|
| 26 | \newpage
|
|---|
| 27 | \paragraph{Design 1: Decentralized}
|
|---|
| 28 | Fixed number of heaps: shard the heap into N heaps each with a bump-area allocated from the sbrk area.
|
|---|
| 29 | Kernel threads (KT) are assigned to the N heaps.
|
|---|
| 30 | When KTs $\le$ N, the heaps are uncontented.
|
|---|
| 31 | When KTs $>$ N, the heaps are contented.
|
|---|
| 32 | By adjusting N, this approach reduces storage at the cost of speed due to contention.
|
|---|
| 33 | In all cases, a thread acquires/releases a lock, contented or uncontented.
|
|---|
| 34 | \begin{cquote}
|
|---|
| 35 | \centering
|
|---|
| 36 | \input{AllocDS1}
|
|---|
| 37 | \end{cquote}
|
|---|
| 38 | Problems: need to know when a KT is created and destroyed to know when to create/delete the KT's heap.
|
|---|
| 39 | On KT deletion, its heap freed-storage needs to be distributed somewhere.
|
|---|
| 40 |
|
|---|
| 41 | \paragraph{Design 2: Centralized}
|
|---|
| 42 |
|
|---|
| 43 | One heap, but lower bucket sizes are N-shared across KTs.
|
|---|
| 44 | This design leverages the fact that 95\% of allocation requests are less than 512 bytes and there are only 3--5 different request sizes.
|
|---|
| 45 | When KTs $\le$ N, the important bucket sizes are uncontented.
|
|---|
| 46 | When KTs $>$ N, the free buckets are contented.
|
|---|
| 47 | Therefore, threads are only contending for a small number of buckets, which are distributed among them to reduce contention.
|
|---|
| 48 | \begin{cquote}
|
|---|
| 49 | \centering
|
|---|
| 50 | \input{AllocDS2}
|
|---|
| 51 | \end{cquote}
|
|---|
| 52 | Problems: need to know when a kernel thread (KT) is created and destroyed to know when to assign a shared bucket-number.
|
|---|
| 53 | When no thread is assigned a bucket number, its free storage is unavailable.
|
|---|
| 54 | It is possible to use sharing and stealing techniques to share/find unused storage, when a free list is unused or empty.
|
|---|