Strangely, the hyperlink does not work I don't know why, you can still copy paste the links.
Anyway, here is the assignment:
Memory: User created Heap
write a program to have an array of 2mb character storage. segment the memory
into a linked list as per following rules:
1.each node in the list has a header and payload.
2.header should have 2 members
i.pointer to the next node
ii.allocation status of the current node
3.payload should be 16byte chunk of memory .all ur applications dynamic
memory requirement where buffer size is less than or equal to 16 should not use
malloc ,memory should be allocated from local linked lists
4.user should allocate/free the memory in any order
5.design two functions to allocate/free memory names of functions should
be getbuf and freebuf
fn prototypes are
void *getbuf(size_t size);
void freebuf(void* buf);
6.if all ur 16byte buffers int the list are exhausted or if the size of memory
asked by user is more than 16bytes call malloc from within getbuf()
And here is the code that I have done: