CSE 120 Lecture Notes - Lecture 8: Binary Tree, Fits, Context Switch
33 views4 pages
8 Feb 2018
School
Department
Course
Professor

Process Memory
Text Area: physical code of program
Data: static vars, heap
Stack: automatic vars, activation records (stack frames)
Other: “shared” memory regions
Characteristics:
- Size, fixed or variable
- Permissions: r, w, x (Read, Write, Execute)
Process’s Memory Address Space
-Note: process ACTS as if it “owns” the whole memory (it doesn’t FYI)
Address Space
- Set of addresses to access memory
- Linear and sequential
- 0 to N-1 (where N is the size of your memory)
Text (of size X): 0 - (X-1)
Data (of size Y): X - (X+Y-1)
Stack: (of size Z): N-Z to N-1
Compiler’s Model of Memory
-compiler generates memory addresses
-allow stack and data to grow
-what does the compiler NOT know?
- physical memory size
- allocated regions of physical memory (to avoid)
Multiple Processes: CPU + Memory
In reality: ONE CPU divided up for each process, and ONE memory divided up for each process
-each subdivison of each process contains its own Text, Data, Stack regions
Sharing Physical Memory
Problem:TOO MUCH OVERHEAD
- Processes moving in and out take so much time!
Solution: keep multiple processes in memory
-context switch ONLY between processes in memory
Memory Management
-Physical memory starts as one “empty hole”
-over time, areas are allocated
-to allocate:
1. Find large enough hole
2. Allocate region within hole