The sys_brk() system call is provided by the kernel, to allocate memory without the need of moving it later. This call allocates memory right behind the application image in the memory. This system function allows you to set the highest available address in the data section.
This system call takes one parameter, which is the highest memory address needed to be set. This value is stored in the EBX register.
In case of any error, sys_brk() returns -1 or returns the negative error code itself. the following example demonstrates dynamic memory allocation.
The following program allocates 16kb of memory the usage of the sys_brk() system call –
When the above code is compiled and executed, it produces the following result –
Assembly Programming Related Interview Questions
|C++ Interview Questions||C Interview Questions|
|Embedded Systems Interview Questions||Linux Embedded systems Interview Questions|
|PLC/Microcontrollers/Microprocessors Interview Questions||Microprocessor 8085 Interview Questions|
|Microprocessor 8086 Interview Questions||Embedded C Interview Questions|
Assembly Programming Related Practice Tests
|C++ Practice Tests||C Practice Tests|
|Embedded Systems Practice Tests||Linux Embedded systems Practice Tests|
|PLC/Microcontrollers/Microprocessors Practice Tests|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.