Category Archives: Technical

Memory Allocation for Process in Unix

Memory Allocation for Process in Unix Most of the persons feel that main is the function which got executed first, but before that their is one function that got called, instructions for that is added by the linker, and that function calls the main function. As part of ISO standards, signature of the main function should be

main(int argc, char **argv)

earlier defination of this is

main(int argc, char **argv, char **environ)

Why ISO removed the environ, as this is a global variable that can be accessed using the extern from any file. Their are some alternatives, to use the getenv / setenv / putenv / clearenv to get the envrionment variables. As per naming conventions, data inside these should be in Name=Value pair. Their are various memory areas those you should be aware of

  1. Text Area
  2. Initialized Data Section
  3. uninitialized Data Section
  4. Stack
  5. Heap

Details of each and every area Text Area This area is readonly, so that no one can change the instructions lying in that area, it started at fixed memory location in case of unix