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