OPS Written Assignment Unit 5
OPS Written Assignment Unit 5
OPS Written Assignment Unit 5
-------------------------------------------------------------
| Virtual Memory |
-------------------------------------------------------------
| Stack Area |
| (Stores function calls, local variables, and parameters) |
| |
| |
| |
| |
-------------------------------------------------------------
| Heap Area |
| (Dynamic memory allocation for objects and data structures)|
| |
| |
| |
| |
| |
-------------------------------------------------------------
| Code/Data Area |
| (Stores program instructions and global variables) |
Explanation:
• Virtual Memory: This represents the entire memory space accessible by the program.
• Stack Area: The stack is used for storing function calls, local variables, and
parameters. Each time a function is called, a new stack frame is created and pushed
onto the stack. When the function returns, its stack frame is popped off the stack.
• Heap Area: The heap is used for dynamic memory allocation, allowing objects and
Memory in the heap is typically managed by the programmer using functions like
• Code/Data Area: This section stores program instructions (code) and global variables.
• The operating system is responsible for mapping these virtual addresses to physical
addresses in RAM.
• Virtual memory management techniques such as paging and segmentation are used to
efficiently manage memory allocation and ensure that processes can access the
References:
Geeks for geeks. (20 Mar, 2023). Function Call Stack in C. Retrieved from
https://www.geeksforgeeks.org/function-call-stack-in-c/
Walls, C. (n.d.). Dynamic Memory Allocation and Fragmentation in C and C++. Design
reuse. https://www.design-reuse.com/articles/25090/dynamic-memory-allocation-
fragmentation-c.html