logo
Operating Systems

03. Memory Management

Memory Management

1. Basics of Memory Management

  • Program loading and linking
  • Logical address and physical address space
  • Memory protection

2. Contiguous Allocation Management

  • Single contiguous allocation, fixed partition, variable partition
  • First-fit, best-fit, worst-fit algorithms

3. Non-contiguous Allocation Management

  • Paging: divides memory and process space into pages and frames, page table mapping
  • Segmentation: divides by logical modules, segment table mapping
  • Segmented-paging: combines advantages of paging and segmentation

4. Virtual Memory Management

  • Basic concept: extends main memory with secondary storage
  • Demand paging management
  • Page replacement algorithms: OPT, FIFO, LRU, CLOCK
  • Page allocation strategies, working set, thrashing

Exercises

  1. Briefly describe the difference between logical and physical addresses.
  2. What is the main difference between contiguous allocation and paging management?
  3. What are the advantages and disadvantages of paging and segmentation?
  4. What are common page replacement algorithms?
  5. What is thrashing? How can it be avoided?
Reference Answers

1. Logical vs. physical address

Logical address is generated by the program, physical address is the actual address in memory.


2. Contiguous allocation vs. paging

Contiguous allocation requires a process to occupy contiguous space, paging allows non-contiguous distribution.


3. Advantages and disadvantages of paging and segmentation

Paging: eliminates external fragmentation, supports virtual memory, does not reflect program logic structure; segmentation: facilitates modularity, prone to external fragmentation.


4. Page replacement algorithms

OPT, FIFO, LRU, CLOCK, etc.


5. Thrashing and avoidance

Thrashing: frequent page replacement, low system efficiency; avoidance: increase allocated pages, use working set model.