0% found this document useful (0 votes)
42 views4 pages

OPS Written Assignment Unit 5

Written Assignment Unit 5 University of the People CS 2301: Operating Systems 1 Shozab Khurshid (Instructor)

Uploaded by

me.mdouboye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views4 pages

OPS Written Assignment Unit 5

Written Assignment Unit 5 University of the People CS 2301: Operating Systems 1 Shozab Khurshid (Instructor)

Uploaded by

me.mdouboye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Written Assignment Unit 5

University of the People

CS 2301: Operating Systems 1

Shozab Khurshid (Instructor)


Below is a simplified diagram illustrating how memory and virtual memory addressing work,

specifically in the context of stacks and heaps:

-------------------------------------------------------------
| 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.

It consists of the stack, heap, and code/data areas.

• 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.

(Geeks for geeks 2023).

• Heap Area: The heap is used for dynamic memory allocation, allowing objects and

data structures to be allocated and deallocated as needed during program execution.

Memory in the heap is typically managed by the programmer using functions like

malloc() and free() in languages like C and C++. (Walls, n.d.).

• Code/Data Area: This section stores program instructions (code) and global variables.

It also includes static variables that are initialized at compile time.

In terms of memory addressing:

• Each area of memory is assigned a range of virtual addresses.

• 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

memory they need without conflicting with other processes.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy