Hi ,
Lets discuss about memory allocation techniques we use either in user space program or kernel space program .
1. Malloc :-
void *malloc(size_t size);
The malloc() function allocates size bytes and returns a pointer to the
allocated memory. The memory is not initialized. If size is 0, then
malloc() returns either NULL, or a unique pointer value that can later
be successfully passed to free().
2. Kmalloc
void *kmalloc(size_t size , flage);
Kmalloc allocates memory from kernel space and returns a pointer to the allocated memory .kmalloc allocated physically contiguous memory . if kernel doesn’t find contiguous memory of required size then this call fails .
3. vmalloc
void * vmalloc(size_t size);
vmalloc allocates virtually contiguous memory not necessary to be physically contiguous .vmalloc is a slower operation (slower because it makes an extra table to map the contiguous virtual memory to non-contiguous physical memory) . vmalloc is used when we need a large memory from kernel space .
Thank you ……