Ignore:
Timestamp:
Aug 4, 2021, 2:40:11 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
199894e
Parents:
0640189e (diff), df5b2c8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
doc/theses/mubeen_zulfiqar_MMath
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mubeen_zulfiqar_MMath/allocator.tex

    r0640189e r5541ea3d  
    111111%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    112112
    113 \section{Added Features}
    114 
    115 
    116 \subsection{Methods}
    117 Why did we need it?
    118 The added benefits.
    119 
     113\section{Added Features and Methods}
     114To improve the UHeapLmmm allocator (FIX ME: cite uHeapLmmm) interface and make it more user friendly, we added a few more routines to the C allocator. Also, we built a CFA (FIX ME: cite cforall) interface on top of C interface to increase the usability of the allocator.
     115
     116\subsection{C Interface}
     117We added a few more features and routines to the allocator's C interface that can make the allocator more usable to the programmers. THese features will programmer more control on the dynamic memory allocation.
     118
     119\subsubsection void * aalloc( size_t dim, size_t elemSize )
     120aalloc is an extension of malloc. It allows programmer to allocate a dynamic array of objects without calculating the total size of array explicitly. The only alternate of this routine in the other allocators is calloc but calloc also fills the dynamic memory with 0 which makes it slower for a programmer who only wants to dynamically allocate an array of objects without filling it with 0.
     121\paragraph{Usage}
     122aalloc takes two parameters.
     123\begin{itemize}
     124\item
     125dim: number of objects in the array
     126\item
     127elemSize: size of the object in the array.
     128\end{itemize}
     129It returns address of dynamic object allocatoed on heap that can contain dim number of objects of the size elemSize. On failure, it returns NULL pointer.
     130
     131\subsubsection void * resize( void * oaddr, size_t size )
     132resize is an extension of relloc. It allows programmer to reuse a cuurently allocated dynamic object with a new size requirement. Its alternate in the other allocators is realloc but relloc also copy the data in old object to the new object which makes it slower for the programmer who only wants to reuse an old dynamic object for a new size requirement but does not want to preserve the data in the old object to the new object.
     133\paragraph{Usage}
     134resize takes two parameters.
     135\begin{itemize}
     136\item
     137oaddr: the address of the old object that needs to be resized.
     138\item
     139size: the new size requirement of the to which the old object needs to be resized.
     140\end{itemize}
     141It returns an object that is of the size given but it does not preserve the data in the old object. On failure, it returns NULL pointer.
     142
     143\subsubsection void * resize( void * oaddr, size_t nalign, size_t size )
     144This resize is an extension of the above resize (FIX ME: cite above resize). In addition to resizing the size of of an old object, it can also realign the old object to a new alignment requirement.
     145\paragraph{Usage}
     146This resize takes three parameters. It takes an additional parameter of nalign as compared to the above resize (FIX ME: cite above resize).
     147\begin{itemize}
     148\item
     149oaddr: the address of the old object that needs to be resized.
     150\item
     151nalign: the new alignment to which the old object needs to be realigned.
     152\item
     153size: the new size requirement of the to which the old object needs to be resized.
     154\end{itemize}
     155It returns an object with the size and alignment given in the parameters. On failure, it returns a NULL pointer.
     156
     157\subsubsection void * amemalign( size_t alignment, size_t dim, size_t elemSize )
     158amemalign is a hybrid of memalign and aalloc. It allows programmer to allocate an aligned dynamic array of objects without calculating the total size of the array explicitly. It frees the programmer from calculating the total size of the array.
     159\paragraph{Usage}
     160amemalign takes three parameters.
     161\begin{itemize}
     162\item
     163alignment: the alignment to which the dynamic array needs to be aligned.
     164\item
     165dim: number of objects in the array
     166\item
     167elemSize: size of the object in the array.
     168\end{itemize}
     169It returns a dynamic array of objects that has the capacity to contain dim number of objects of the size of elemSize. The returned dynamic array is aligned to the given alignment. On failure, it returns NULL pointer.
     170
     171\subsubsection void * cmemalign( size_t alignment, size_t dim, size_t elemSize )
     172cmemalign is a hybrid of amemalign and calloc. It allows programmer to allocate an aligned dynamic array of objects that is 0 filled. The current way to do this in other allocators is to allocate an aligned object with memalign and then fill it with 0 explicitly. This routine provides both features of aligning and 0 filling, implicitly.
     173\paragraph{Usage}
     174cmemalign takes three parameters.
     175\begin{itemize}
     176\item
     177alignment: the alignment to which the dynamic array needs to be aligned.
     178\item
     179dim: number of objects in the array
     180\item
     181elemSize: size of the object in the array.
     182\end{itemize}
     183It returns a dynamic array of objects that has the capacity to contain dim number of objects of the size of elemSize. The returned dynamic array is aligned to the given alignment and is 0 filled. On failure, it returns NULL pointer.
     184
     185\subsubsection size_t malloc_alignment( void * addr )
     186malloc_alignment returns the alignment of a currently allocated dynamic object. It allows the programmer in memory management and personal bookkeeping. It helps the programmer in verofying the alignment of a dynamic object especially in a scenerio similar to prudcer-consumer where a producer allocates a dynamic object and the consumer needs to assure that the dynamic object was allocated with the required alignment.
     187\paragraph{Usage}
     188malloc_alignment takes one parameters.
     189\begin{itemize}
     190\item
     191addr: the address of the currently allocated dynamic object.
     192\end{itemize}
     193malloc_alignment returns the alignment of the given dynamic object. On failure, it return the value of default alignment of the uHeapLmmm allocator.
     194
     195\subsubsection bool malloc_zero_fill( void * addr )
     196malloc_zero_fill returns whether a currently allocated dynamic object was initially zero filled at the time of allocation. It allows the programmer in memory management and personal bookkeeping. It helps the programmer in verifying the zero filled property of a dynamic object especially in a scenerio similar to prudcer-consumer where a producer allocates a dynamic object and the consumer needs to assure that the dynamic object was zero filled at the time of allocation.
     197\paragraph{Usage}
     198malloc_zero_fill takes one parameters.
     199\begin{itemize}
     200\item
     201addr: the address of the currently allocated dynamic object.
     202\end{itemize}
     203malloc_zero_fill returns true if the dynamic object was initially zero filled and return false otherwise. On failure, it returns false.
     204
     205\subsubsection size_t malloc_size( void * addr )
     206malloc_size returns the allocation size of a currently allocated dynamic object. It allows the programmer in memory management and personal bookkeeping. It helps the programmer in verofying the alignment of a dynamic object especially in a scenerio similar to prudcer-consumer where a producer allocates a dynamic object and the consumer needs to assure that the dynamic object was allocated with the required size. Its current alternate in the other allocators is malloc_usable_size. But, malloc_size is different from malloc_usable_size as malloc_usabe_size returns the total data capacity of dynamic object including the extra space at the end of the dynamic object. On the other hand, malloc_size returns the size that was given to the allocator at the allocation of the dynamic object. This size is updated when an object is realloced, resized, or passed through a similar allocator routine.
     207\paragraph{Usage}
     208malloc_size takes one parameters.
     209\begin{itemize}
     210\item
     211addr: the address of the currently allocated dynamic object.
     212\end{itemize}
     213malloc_size returns the allocation size of the given dynamic object. On failure, it return zero.
     214
     215\subsubsection void * realloc( void * oaddr, size_t nalign, size_t size )
     216This realloc is an extension of the default realloc (FIX ME: cite default realloc). In addition to reallocating an old object and preserving the data in old object, it can also realign the old object to a new alignment requirement.
     217\paragraph{Usage}
     218This realloc takes three parameters. It takes an additional parameter of nalign as compared to the default realloc.
     219\begin{itemize}
     220\item
     221oaddr: the address of the old object that needs to be reallocated.
     222\item
     223nalign: the new alignment to which the old object needs to be realigned.
     224\item
     225size: the new size requirement of the to which the old object needs to be resized.
     226\end{itemize}
     227It returns an object with the size and alignment given in the parameters that preserves the data in the old object. On failure, it returns a NULL pointer.
     228
     229\subsection{CFA Malloc Interface}
     230We added some routines to the malloc interface of CFA. These routines can only be used in CFA and not in our standalone uHeapLmmm allocator as these routines use some features that are only provided by CFA and not by C. It makes the allocator even more usable to the programmers.
     231CFA provides the liberty to know the returned type of a call to the allocator. So, mainly in these added routines, we removed the object size parameter from the routine as allocator can calculate the size of the object from the returned type.
     232
     233\subsubsection T * malloc( void )
     234This malloc is a simplified polymorphic form of defualt malloc (FIX ME: cite malloc). It does not take any parameter as compared to default malloc that takes one parameter.
     235\paragraph{Usage}
     236This malloc takes no parameters.
     237It returns a dynamic object of the size of type T. On failure, it return NULL pointer.
     238
     239\subsubsection T * aalloc( size_t dim )
     240This aalloc is a simplified polymorphic form of above aalloc (FIX ME: cite aalloc). It takes one parameter as compared to the above aalloc that takes two parameters.
     241\paragraph{Usage}
     242aalloc takes one parameters.
     243\begin{itemize}
     244\item
     245dim: required number of objects in the array.
     246\end{itemize}
     247It returns a dynamic object that has the capacity to contain dim number of objects, each of the size of type T. On failure, it return NULL pointer.
     248
     249\subsubsection T * calloc( size_t dim )
     250This calloc is a simplified polymorphic form of defualt calloc (FIX ME: cite calloc). It takes one parameter as compared to the default calloc that takes two parameters.
     251\paragraph{Usage}
     252This calloc takes one parameter.
     253\begin{itemize}
     254\item
     255dim: required number of objects in the array.
     256\end{itemize}
     257It returns a dynamic object that has the capacity to contain dim number of objects, each of the size of type T. On failure, it return NULL pointer.
     258
     259\subsubsection T * resize( T * ptr, size_t size )
     260This resize is a simplified polymorphic form of above resize (FIX ME: cite resize with alignment). It takes two parameters as compared to the above resize that takes three parameters. It frees the programmer from explicitly mentioning the alignment of the allocation as CFA provides gives allocator the liberty to get the alignment of the returned type.
     261\paragraph{Usage}
     262This resize takes two parameters.
     263\begin{itemize}
     264\item
     265ptr: address of the old object.
     266\item
     267size: the required size of the new object.
     268\end{itemize}
     269It returns a dynamic object of the size given in paramters. The returned object is aligned to the alignemtn of type T. On failure, it return NULL pointer.
     270
     271\subsubsection T * realloc( T * ptr, size_t size )
     272This realloc is a simplified polymorphic form of defualt realloc (FIX ME: cite realloc with align). It takes two parameters as compared to the above realloc that takes three parameters. It frees the programmer from explicitly mentioning the alignment of the allocation as CFA provides gives allocator the liberty to get the alignment of the returned type.
     273\paragraph{Usage}
     274This realloc takes two parameters.
     275\begin{itemize}
     276\item
     277ptr: address of the old object.
     278\item
     279size: the required size of the new object.
     280\end{itemize}
     281It returns a dynamic object of the size given in paramters that preserves the data in the given object. The returned object is aligned to the alignemtn of type T. On failure, it return NULL pointer.
     282
     283\subsubsection T * memalign( size_t align )
     284This memalign is a simplified polymorphic form of defualt memalign (FIX ME: cite memalign). It takes one parameters as compared to the default memalign that takes two parameters.
     285\paragraph{Usage}
     286memalign takes one parameters.
     287\begin{itemize}
     288\item
     289align: the required alignment of the dynamic object.
     290\end{itemize}
     291It returns a dynamic object of the size of type T that is aligned to given parameter align. On failure, it return NULL pointer.
     292
     293\subsubsection T * amemalign( size_t align, size_t dim )
     294This amemalign is a simplified polymorphic form of above amemalign (FIX ME: cite amemalign). It takes two parameter as compared to the above amemalign that takes three parameters.
     295\paragraph{Usage}
     296amemalign takes two parameters.
     297\begin{itemize}
     298\item
     299align: required alignment of the dynamic array.
     300\item
     301dim: required number of objects in the array.
     302\end{itemize}
     303It returns a dynamic object that has the capacity to contain dim number of objects, each of the size of type T. The returned object is aligned to the given parameter align. On failure, it return NULL pointer.
     304
     305\subsubsection T * cmemalign( size_t align, size_t dim  )
     306This cmemalign is a simplified polymorphic form of above cmemalign (FIX ME: cite cmemalign). It takes two parameter as compared to the above cmemalign that takes three parameters.
     307\paragraph{Usage}
     308cmemalign takes two parameters.
     309\begin{itemize}
     310\item
     311align: required alignment of the dynamic array.
     312\item
     313dim: required number of objects in the array.
     314\end{itemize}
     315It returns a dynamic object that has the capacity to contain dim number of objects, each of the size of type T. The returned object is aligned to the given parameter align and is zero filled. On failure, it return NULL pointer.
     316
     317\subsubsection T * aligned_alloc( size_t align )
     318This aligned_alloc is a simplified polymorphic form of defualt aligned_alloc (FIX ME: cite aligned_alloc). It takes one parameter as compared to the default aligned_alloc that takes two parameters.
     319\paragraph{Usage}
     320This aligned_alloc takes one parameter.
     321\begin{itemize}
     322\item
     323align: required alignment of the dynamic object.
     324\end{itemize}
     325It returns a dynamic object of the size of type T that is aligned to the given parameter. On failure, it return NULL pointer.
     326
     327\subsubsection int posix_memalign( T ** ptr, size_t align )
     328This posix_memalign is a simplified polymorphic form of defualt posix_memalign (FIX ME: cite posix_memalign). It takes two parameters as compared to the default posix_memalign that takes three parameters.
     329\paragraph{Usage}
     330This posix_memalign takes two parameter.
     331\begin{itemize}
     332\item
     333ptr: variable address to store the address of the allocated object.
     334\item
     335align: required alignment of the dynamic object.
     336\end{itemize}
     337It stores address of the dynamic object of the size of type T in given parameter ptr. This object is aligned to the given parameter. On failure, it return NULL pointer.
     338
     339\subsubsection T * valloc( void )
     340This valloc is a simplified polymorphic form of defualt valloc (FIX ME: cite valloc). It takes no parameters as compared to the default valloc that takes one parameter.
     341\paragraph{Usage}
     342valloc takes no parameters.
     343It returns a dynamic object of the size of type T that is aligned to the page size. On failure, it return NULL pointer.
     344
     345\subsubsection T * pvalloc( void )
     346This pcvalloc is a simplified polymorphic form of defualt pcvalloc (FIX ME: cite pcvalloc). It takes no parameters as compared to the default pcvalloc that takes one parameter.
     347\paragraph{Usage}
     348pvalloc takes no parameters.
     349It returns a dynamic object of the size that is calcutaed by rouding the size of type T. The returned object is also aligned to the page size. On failure, it return NULL pointer.
    120350
    121351\subsection{Alloc Interface}
    122 Why did we need it?
    123 The added benefits.
     352In addition to improve allocator interface both for CFA and our standalone allocator uHeapLmmm in C. We also added a new alloc interface in CFA that increases usability of dynamic memory allocation.
     353This interface helps programmers in three major ways.
     354\begin{itemize}
     355\item
     356Routine Name: alloc interfce frees programmers from remmebring different routine names for different kind of dynamic allocations.
     357\item
     358Parametre Positions: alloc interface frees programmers from remembering parameter postions in call to routines.
     359\item
     360Object Size: alloc interface does not require programmer to mention the object size as CFA allows allocator to determince the object size from returned type of alloc call.
     361\end{itemize}
     362
     363Alloc interface uses polymorphism, backtick routines (FIX ME: cite backtick) and ttype parameters of CFA (FIX ME: cite ttype) to provide a very simple dynamic memory allocation interface to the programmers. The new interfece has just one routine name alloc that can be used to perform a wide range of dynamic allocations. The parameters use backtick functions to provide a similar-to named parameters feature for our alloc interface so that programmers do not have to remember parameter positions in alloc call except the position of dimension (dim) parameter.
     364
     365\subsubsection{Routine: T * alloc( ... )}
     366Call to alloc wihout any parameter returns one object of size of type T allocated dynamically.
     367Only the dimension (dim) parameter for array allocation has the fixed position in the alloc routine. If programmer wants to allocate an array of objects that the required number of members in the array has to be given as the first parameter to the alloc routine.
     368alocc routine accepts six kinds of arguments. Using different combinations of tha parameters, different kind of allocations can be performed. Any combincation of parameters can be used together except `realloc and `resize that should not be used simultanously in one call to routine as it creates ambiguity about whether to reallocate or resize a currently allocated dynamic object. If both `resize and `realloc are used in a call to alloc then the latter one will take effect or unexpected resulted might be produced.
     369
     370\paragraph{Dim}
     371This is the only parameter in the alloc routine that has a fixed-position and it is also the only parameter that does not use a backtick function. It has to be passed at the first position to alloc call in-case of an array allocation of objects of type T.
     372It represents the required number of members in the array allocation as in CFA's aalloc (FIX ME: cite aalloc).
     373This parameter should be of type size_t.
     374
     375Example: int a = alloc( 5 )
     376This call will return a dynamic array of five integers.
     377
     378\paragraph{Align}
     379This parameter is position-free and uses a backtick routine align (`align). The parameter passed with `align should be of type size_t. If the alignment parameter is not a power of two or is less than the default alignment of the allocator (that can be found out using routine libAlign in CFA) then the passed alignment parameter will be rejected and the default alignment will be used.
     380
     381Example: int b = alloc( 5 , 64`align )
     382This call will return a dynamic array of five integers. It will align the allocated object to 64.
     383
     384\paragraph{Fill}
     385This parameter is position-free and uses a backtick routine fill (`fill). In case of realloc, only the extra space after copying the data in the old object will be filled with given parameter.
     386Three types of parameters can be passed using `fill.
     387\begin{itemize}
     388\item
     389char: A char can be passed with `fill to fill the whole dynamic allocation with the given char recursively till the end of required allocation.
     390\item
     391Object of returned type: An object of type of returned type can be passed with `fill to fill the whole dynamic allocation with the given object recursively till the end of required allocation.
     392\item
     393Dynamic object of returned type: A dynamic object of type of returned type can be passed with `fill to fill the dynamic allocation with the given dynamic object. In this case, the allocated memory is not filled recursively till the end of allocation. The filling happen untill the end object passed to `fill or the end of requested allocation reaches.
     394\end{itemize}
     395
     396Example: int b = alloc( 5 , 'a'`fill )
     397This call will return a dynamic array of five integers. It will fill the allocated object with character 'a' recursively till the end of requested allocation size.
     398
     399Example: int b = alloc( 5 , 4`fill )
     400This call will return a dynamic array of five integers. It will fill the allocated object with integer 4 recursively till the end of requested allocation size.
     401
     402Example: int b = alloc( 5 , a`fill ) where a is a pointer of int type
     403This call will return a dynamic array of five integers. It will copy data in a to the returned object non-recursively untill end of a or the newly allocated object is reached.
     404
     405\paragraph{Resize}
     406This parameter is position-free and uses a backtick routine resize (`resize). It represents the old dynamic object (oaddr) that the programmer wants to
     407\begin{itemize}
     408\item
     409resize to a new size.
     410\item
     411realign to a new alignment
     412\item
     413fill with something.
     414\end{itemize}
     415The data in old dynamic object will not be preserved in the new object. The type of object passed to `resize and the returned type of alloc call can be different.
     416
     417Example: int b = alloc( 5 , a`resize )
     418This call will resize object a to a dynamic array that can contain 5 integers.
     419
     420Example: int b = alloc( 5 , a`resize , 32`align )
     421This call will resize object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32.
     422
     423Example: int b = alloc( 5 , a`resize , 32`align , 2`fill)
     424This call will resize object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32 and will be filled with 2.
     425
     426\paragraph{Realloc}
     427This parameter is position-free and uses a backtick routine realloc (`realloc). It represents the old dynamic object (oaddr) that the programmer wants to
     428\begin{itemize}
     429\item
     430realloc to a new size.
     431\item
     432realign to a new alignment
     433\item
     434fill with something.
     435\end{itemize}
     436The data in old dynamic object will be preserved in the new object. The type of object passed to `realloc and the returned type of alloc call cannot be different.
     437
     438Example: int b = alloc( 5 , a`realloc )
     439This call will realloc object a to a dynamic array that can contain 5 integers.
     440
     441Example: int b = alloc( 5 , a`realloc , 32`align )
     442This call will realloc object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32.
     443
     444Example: int b = alloc( 5 , a`realloc , 32`align , 2`fill)
     445This call will resize object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32. The extra space after copying data of a to the returned object will be filled with 2.
  • doc/theses/mubeen_zulfiqar_MMath/benchmarks.tex

    r0640189e r5541ea3d  
    149149*** FIX ME: Insert a figure of above benchmark with description
    150150
    151 \subsubsection{Relevant Knobs}
     151\paragrpah{Relevant Knobs}
    152152*** FIX ME: Insert Relevant Knobs
    153153
     
    202202\paragraph{Relevant Knobs}
    203203*** FIX ME: Insert Relevant Knobs
    204 
    205 \section{Results}
    206 *** FIX ME: add configuration details of memory allocators
    207 
    208 \subsection{Memory Benchmark}
    209 
    210 \subsubsection{Relevant Knobs}
    211 
    212 \subsection{Speed Benchmark}
    213 
    214 \subsubsection{Speed Time}
    215 
    216 \paragraph{Relevant Knobs}
    217 
    218 \subsubsection{Speed Workload}
    219 
    220 \paragraph{Relevant Knobs}
    221 
    222 \subsection{Cache Scratch}
    223 
    224 \subsubsection{Cache Scratch Time}
    225 
    226 \paragraph{Relevant Knobs}
    227 
    228 \subsubsection{Cache Scratch Layout}
    229 
    230 \paragraph{Relevant Knobs}
    231 
    232 \subsection{Cache Thrash}
    233 
    234 \subsubsection{Cache Thrash Time}
    235 
    236 \paragraph{Relevant Knobs}
    237 
    238 \subsubsection{Cache Thrash Layout}
    239 
    240 \paragraph{Relevant Knobs}
  • doc/theses/mubeen_zulfiqar_MMath/intro.tex

    r0640189e r5541ea3d  
    2424\noindent
    2525====================
     26
     27\section{Introduction}
     28Dynamic memory allocation and management is one of the core features of C. It gives programmer the freedom to allocate, free, use, and manage dynamic memory himself. The programmer is not given the complete control of the dynamic memory management instead an interface of memory allocator is given to the progrmmer that can be used to allocate/free dynamic memory for the application's use.
     29
     30Memory allocator is a layer between thr programmer and the system. Allocator gets dynamic memory from the system in heap/mmap area of application storage and manages it for programmer's use.
     31
     32GNU C Library (FIX ME: cite this) provides an interchangeable memory allocator that can be replaced with a custom memory allocator that supports required features and fulfills application's custom needs. It also allows others to innovate in memory allocation and design their own memory allocator. GNU C Library has set guidelines that should be followed when designing a standalone memory allocator. GNU C Library requires new memory allocators to have atlease following set of functions in their allocator's interface:
     33
     34\begin{itemize}
     35\item
     36malloc: it allocates and returns a chunk of dynamic memory of requested size (FIX ME: cite man page).
     37\item
     38calloc: it allocates and returns an array in dynamic memory of requested size (FIX ME: cite man page).
     39\item
     40realloc: it reallocates and returns an already allocated chunk of dynamic memory to a new size (FIX ME: cite man page).
     41\item
     42free: it frees an already allocated piece of dynamic memory (FIX ME: cite man page).
     43\end{itemize}
     44
     45In addition to the above functions, GNU C Library also provides some more functions to increase the usability of the dynamic memory allocator. Most standalone allocators also provide all or some of the above additional functions.
     46
     47\begin{itemize}
     48\item
     49aligned_alloc
     50\item
     51malloc_usable_size
     52\item
     53memalign
     54\item
     55posix_memalign
     56\item
     57pvalloc
     58\item
     59valloc
     60\end{itemize}
     61
     62With the rise of concurrent applications, memory allocators should be able to fulfill dynamic memory requests from multiple threads in parallel without causing contention on shared resources. There needs to be a set of a standard benchmarks that can be used to evaluate an allocator's performance in different scenerios.
     63
     64\section{Background}
     65
     66\subsection{Memory Allocation}
     67With dynamic allocation being an important feature of C, there are many standalone memory allocators that have been designed for different purposes. For this thesis, we chose 7 of the most popular and widely used memory allocators.
     68
     69\paragraph{dlmalloc}
     70dlmalloc (FIX ME: cite allocator) is a thread-safe allocator that is single threaded and single heap. dlmalloc maintains free-lists of different sizes to store freed dynamic memory. (FIX ME: cite wasik)
     71
     72\paragraph{hoard}
     73Hoard (FIX ME: cite allocator) is a thread-safe allocator that is multi-threaded and using a heap layer framework. It has per-thred heaps that have thread-local free-lists, and a gloabl shared heap. (FIX ME: cite wasik)
     74
     75\paragraph{jemalloc}
     76jemalloc (FIX ME: cite allocator) is a thread-safe allocator that uses multiple arenas. Each thread is assigned an arena. Each arena has chunks that contain contagious memory regions of same size. An arena has multiple chunks that contain regions of multiple sizes.
     77
     78\paragraph{ptmalloc}
     79ptmalloc (FIX ME: cite allocator) is a modification of dlmalloc. It is a thread-safe multi-threaded memory allocator that uses multiple heaps. ptmalloc heap has similar design to dlmalloc's heap.
     80
     81\paragraph{rpmalloc}
     82rpmalloc (FIX ME: cite allocator) is a thread-safe allocator that is multi-threaded and uses per-thread heap. Each heap has multiple size-classes and each size-calss contains memory regions of the relevant size.
     83
     84\paragraph{tbb malloc}
     85tbb malloc (FIX ME: cite allocator) is a thread-safe allocator that is multi-threaded and uses private heap for each thread. Each private-heap has multiple bins of different sizes. Each bin contains free regions of the same size.
     86
     87\paragraph{tc malloc}
     88tcmalloc (FIX ME: cite allocator) is a thread-safe allocator. It uses per-thread cache to store free objects that prevents contention on shared resources in multi-threaded application. A central free-list is used to refill per-thread cache when it gets empty.
     89
     90\subsection{Benchmarks}
     91There are multiple benchmarks that are built individually and evaluate different aspects of a memory allocator. But, there is not standard set of benchamrks that can be used to evaluate multiple aspects of memory allocators.
     92
     93\paragraph{threadtest}
     94(FIX ME: cite benchmark and hoard) Each thread repeatedly allocates and then deallocates 100,000 objects. Runtime of the benchmark evaluates its efficiency.
     95
     96\paragraph{shbench}
     97(FIX ME: cite benchmark and hoard) Each thread allocates and randomly frees a number of random-sized objects. It is a stress test that also uses runtime to determine efficiency of the allocator.
     98
     99\paragraph{larson}
     100(FIX ME: cite benchmark and hoard) Larson simulates a server environment. Multiple threads are created where each thread allocator and free a number of objects within a size range. Some objects are passed from threads to the child threads to free. It caluculates memory operations per second as an indicator of memory allocator's performance.
     101
     102\section{Research Objectives}
     103Our research objective in this thesis is to:
     104
     105\begin{itemize}
     106\item
     107Design a lightweight concurrent memory allocator with added features and usability that are currently not present in the other memory allocators.
     108\item
     109Design a suite of benchmarks to evalute multiple aspects of a memory allocator.
     110\end{itemize}
     111
     112\section{An outline of the thesis}
     113LAST FIX ME: add outline at the end
  • doc/theses/mubeen_zulfiqar_MMath/performance.tex

    r0640189e r5541ea3d  
    11\chapter{Performance}
     2
     3\noindent
     4====================
     5
     6Writing Points:
     7\begin{itemize}
     8\item
     9Machine Specification
     10\item
     11Allocators and their details
     12\item
     13Benchmarks and their details
     14\item
     15Results
     16\end{itemize}
     17
     18\noindent
     19====================
     20
     21\section{Memory Allocators}
     22For these experiments, we used 7 memory allocators excluding our standalone memory allocator uHeapLmmm.
     23
     24\begin{tabularx}{0.8\textwidth} {
     25        | >{\raggedright\arraybackslash}X
     26        | >{\centering\arraybackslash}X
     27        | >{\raggedleft\arraybackslash}X |
     28}
     29\hline
     30Memory Allocator & Version     & Configurations \\
     31\hline
     32dl               &             &  \\
     33\hline
     34hoard            &             &  \\
     35\hline
     36je               &             &  \\
     37\hline
     38pt3              &             &  \\
     39\hline
     40rp               &             &  \\
     41\hline
     42tbb              &             &  \\
     43\hline
     44tc               &             &  \\
     45\end{tabularx}
     46(FIX ME: complete table)
     47
     48\section{Experiment Environment}
     49We conducted these experiments ... (FIX ME: what machine and which specifications to add).
     50
     51We used our micro becnhmark suite (FIX ME: cite mbench) to evaluate other memory allocators (FIX ME: cite above memory allocators) and our uHeapLmmm.
     52
     53\section{Results}
     54
     55\subsection{Memory Benchmark}
     56FIX ME: add experiment, knobs, graphs, and description
     57
     58\subsection{Speed Benchmark}
     59FIX ME: add experiment, knobs, graphs, and description
     60
     61\subsubsection{Speed Time}
     62FIX ME: add experiment, knobs, graphs, and description
     63
     64\subsubsection{Speed Workload}
     65FIX ME: add experiment, knobs, graphs, and description
     66
     67\subsection{Cache Scratch}
     68FIX ME: add experiment, knobs, graphs, and description
     69
     70\subsubsection{Cache Scratch Time}
     71FIX ME: add experiment, knobs, graphs, and description
     72
     73\subsubsection{Cache Scratch Layout}
     74FIX ME: add experiment, knobs, graphs, and description
     75
     76\subsection{Cache Thrash}
     77FIX ME: add experiment, knobs, graphs, and description
     78
     79\subsubsection{Cache Thrash Time}
     80FIX ME: add experiment, knobs, graphs, and description
     81
     82\subsubsection{Cache Thrash Layout}
     83FIX ME: add experiment, knobs, graphs, and description
Note: See TracChangeset for help on using the changeset viewer.