Index: doc/theses/mubeen_zulfiqar_MMath/allocator.tex
===================================================================
--- doc/theses/mubeen_zulfiqar_MMath/allocator.tex	(revision 3d7d407c86239c5ee651fee5045aca8ced5be3fb)
+++ doc/theses/mubeen_zulfiqar_MMath/allocator.tex	(revision 15885de998d9500373efda8e609b893c87e6363a)
@@ -24,6 +24,7 @@
 \end{itemize}
 
-The new features added to uHeapLmmm (incl. @malloc_size@ routine)
+The new features added to uHeapLmmm (incl. @malloc\_size@ routine)
 \CFA alloc interface with examples.
+
 \begin{itemize}
 \item
@@ -117,8 +118,9 @@
 We 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.
 
-\subsubsection void * aalloc( size_t dim, size_t elemSize )
+\subsubsection void * aalloc( size\_t dim, size\_t elemSize )
 aalloc 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.
 \paragraph{Usage}
 aalloc takes two parameters.
+
 \begin{itemize}
 \item
@@ -129,8 +131,9 @@
 It 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.
 
-\subsubsection void * resize( void * oaddr, size_t size )
+\subsubsection void * resize( void * oaddr, size\_t size )
 resize 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.
 \paragraph{Usage}
 resize takes two parameters.
+
 \begin{itemize}
 \item
@@ -141,8 +144,9 @@
 It 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.
 
-\subsubsection void * resize( void * oaddr, size_t nalign, size_t size )
+\subsubsection void * resize( void * oaddr, size\_t nalign, size\_t size )
 This 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.
 \paragraph{Usage}
 This resize takes three parameters. It takes an additional parameter of nalign as compared to the above resize (FIX ME: cite above resize).
+
 \begin{itemize}
 \item
@@ -155,8 +159,9 @@
 It returns an object with the size and alignment given in the parameters. On failure, it returns a NULL pointer.
 
-\subsubsection void * amemalign( size_t alignment, size_t dim, size_t elemSize )
+\subsubsection void * amemalign( size\_t alignment, size\_t dim, size\_t elemSize )
 amemalign 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.
 \paragraph{Usage}
 amemalign takes three parameters.
+
 \begin{itemize}
 \item
@@ -169,8 +174,9 @@
 It 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.
 
-\subsubsection void * cmemalign( size_t alignment, size_t dim, size_t elemSize )
+\subsubsection void * cmemalign( size\_t alignment, size\_t dim, size\_t elemSize )
 cmemalign 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.
 \paragraph{Usage}
 cmemalign takes three parameters.
+
 \begin{itemize}
 \item
@@ -183,38 +189,42 @@
 It 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.
 
-\subsubsection size_t malloc_alignment( void * addr )
-malloc_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.
-\paragraph{Usage}
-malloc_alignment takes one parameters.
+\subsubsection size\_t malloc\_alignment( void * addr )
+malloc\_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.
+\paragraph{Usage}
+malloc\_alignment takes one parameters.
+
 \begin{itemize}
 \item
 addr: the address of the currently allocated dynamic object.
 \end{itemize}
-malloc_alignment returns the alignment of the given dynamic object. On failure, it return the value of default alignment of the uHeapLmmm allocator.
-
-\subsubsection bool malloc_zero_fill( void * addr )
-malloc_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.
-\paragraph{Usage}
-malloc_zero_fill takes one parameters.
+malloc\_alignment returns the alignment of the given dynamic object. On failure, it return the value of default alignment of the uHeapLmmm allocator.
+
+\subsubsection bool malloc\_zero\_fill( void * addr )
+malloc\_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.
+\paragraph{Usage}
+malloc\_zero\_fill takes one parameters.
+
 \begin{itemize}
 \item
 addr: the address of the currently allocated dynamic object.
 \end{itemize}
-malloc_zero_fill returns true if the dynamic object was initially zero filled and return false otherwise. On failure, it returns false.
-
-\subsubsection size_t malloc_size( void * addr )
-malloc_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.
-\paragraph{Usage}
-malloc_size takes one parameters.
+malloc\_zero\_fill returns true if the dynamic object was initially zero filled and return false otherwise. On failure, it returns false.
+
+\subsubsection size\_t malloc\_size( void * addr )
+malloc\_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.
+\paragraph{Usage}
+malloc\_size takes one parameters.
+
 \begin{itemize}
 \item
 addr: the address of the currently allocated dynamic object.
 \end{itemize}
-malloc_size returns the allocation size of the given dynamic object. On failure, it return zero.
-
-\subsubsection void * realloc( void * oaddr, size_t nalign, size_t size )
+malloc\_size returns the allocation size of the given dynamic object. On failure, it return zero.
+
+\subsubsection void * realloc( void * oaddr, size\_t nalign, size\_t size )
 This 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.
 \paragraph{Usage}
 This realloc takes three parameters. It takes an additional parameter of nalign as compared to the default realloc.
+
 \begin{itemize}
 \item
@@ -237,8 +247,9 @@
 It returns a dynamic object of the size of type T. On failure, it return NULL pointer.
 
-\subsubsection T * aalloc( size_t dim )
+\subsubsection T * aalloc( size\_t dim )
 This 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.
 \paragraph{Usage}
 aalloc takes one parameters.
+
 \begin{itemize}
 \item
@@ -247,8 +258,9 @@
 It 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.
 
-\subsubsection T * calloc( size_t dim )
+\subsubsection T * calloc( size\_t dim )
 This 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.
 \paragraph{Usage}
 This calloc takes one parameter.
+
 \begin{itemize}
 \item
@@ -257,8 +269,9 @@
 It 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.
 
-\subsubsection T * resize( T * ptr, size_t size )
+\subsubsection T * resize( T * ptr, size\_t size )
 This 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.
 \paragraph{Usage}
 This resize takes two parameters.
+
 \begin{itemize}
 \item
@@ -269,8 +282,9 @@
 It 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.
 
-\subsubsection T * realloc( T * ptr, size_t size )
+\subsubsection T * realloc( T * ptr, size\_t size )
 This 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.
 \paragraph{Usage}
 This realloc takes two parameters.
+
 \begin{itemize}
 \item
@@ -281,8 +295,9 @@
 It 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.
 
-\subsubsection T * memalign( size_t align )
+\subsubsection T * memalign( size\_t align )
 This 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.
 \paragraph{Usage}
 memalign takes one parameters.
+
 \begin{itemize}
 \item
@@ -291,8 +306,9 @@
 It returns a dynamic object of the size of type T that is aligned to given parameter align. On failure, it return NULL pointer.
 
-\subsubsection T * amemalign( size_t align, size_t dim )
+\subsubsection T * amemalign( size\_t align, size\_t dim )
 This 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.
 \paragraph{Usage}
 amemalign takes two parameters.
+
 \begin{itemize}
 \item
@@ -303,8 +319,9 @@
 It 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.
 
-\subsubsection T * cmemalign( size_t align, size_t dim  )
+\subsubsection T * cmemalign( size\_t align, size\_t dim  )
 This 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.
 \paragraph{Usage}
 cmemalign takes two parameters.
+
 \begin{itemize}
 \item
@@ -315,8 +332,9 @@
 It 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.
 
-\subsubsection T * aligned_alloc( size_t align )
-This 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.
-\paragraph{Usage}
-This aligned_alloc takes one parameter.
+\subsubsection T * aligned\_alloc( size\_t align )
+This 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.
+\paragraph{Usage}
+This aligned\_alloc takes one parameter.
+
 \begin{itemize}
 \item
@@ -325,8 +343,9 @@
 It returns a dynamic object of the size of type T that is aligned to the given parameter. On failure, it return NULL pointer.
 
-\subsubsection int posix_memalign( T ** ptr, size_t align )
-This 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.
-\paragraph{Usage}
-This posix_memalign takes two parameter.
+\subsubsection int posix\_memalign( T ** ptr, size\_t align )
+This 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.
+\paragraph{Usage}
+This posix\_memalign takes two parameter.
+
 \begin{itemize}
 \item
@@ -335,4 +354,5 @@
 align: required alignment of the dynamic object.
 \end{itemize}
+
 It 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.
 
@@ -349,7 +369,8 @@
 It 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.
 
-\subsection{Alloc Interface}
+\subsection Alloc Interface
 In 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.
 This interface helps programmers in three major ways.
+
 \begin{itemize}
 \item
@@ -371,5 +392,5 @@
 This 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.
 It represents the required number of members in the array allocation as in CFA's aalloc (FIX ME: cite aalloc).
-This parameter should be of type size_t.
+This parameter should be of type size\_t.
 
 Example: int a = alloc( 5 )
@@ -377,5 +398,5 @@
 
 \paragraph{Align}
-This 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.
+This 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.
 
 Example: int b = alloc( 5 , 64`align )
@@ -385,4 +406,5 @@
 This 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.
 Three types of parameters can be passed using `fill.
+
 \begin{itemize}
 \item
