Coconote
AI notes
AI voice & video notes
Export note
Try for free
Process Execution and Memory Management
Jun 23, 2024
Process Execution and Memory Management
Key Concepts
Process Execution
: For a process to execute, it must be in the main memory (physical memory).
Main Memory (Physical Memory)
: Finite in size, sometimes smaller than the process size.
Secondary Memory
: Where processes reside before being loaded into main memory.
Handling Large Processes
Loading only parts of a process into main memory can be more efficient.
Processes can be divided into
pages
(equal-sized portions).
Example: If CPU needs page 3, only that page is loaded into main memory.
Paging
: Process of breaking a process into pages.
Demand Paging
: Pages loaded on demand (only when needed).
Virtual Memory
By loading only required pages, it seems main memory is larger than it is.
Virtual Memory
: Concept where a portion of the hard disk is used as an extension of main memory.
Page Faults
Occur when the required page is not in main memory.
Handling Page Faults
:
OS contacts the hard disk to locate the required page.
If main memory is full, a page must be swapped out to load the new one.
Swapping
: Swapping a page into main memory and another out into secondary memory.
Page Replacement Algorithms
First-In-First-Out (FIFO)
: Replaces the oldest page in memory.
Page Table
: Keeps track of which pages are in main memory and which are in secondary.
Valid/Invalid Bits
: Indicate if a page is in main memory (valid) or not (invalid).
Example Scenario
Frames
: Allocated slots in main memory.
Page References
: Order in which CPU requests pages.
FIFO Algorithm Application
:
Load pages into frames sequentially.
When frames are full, oldest page is swapped out.
Page Faults and Hit Ratio
Page Fault
: Page not found in main memory, leading to a swap/miss.
Hit Ratio
: Number of hits (page found in memory) divided by total requests.
Example Calculation:
Total requests: 19
Hits: 6
Hit Ratio: 6/19
Practical Example
When fast-forwarding a movie in VLC player, a short delay occurs due to page faults.
Further Topics
Discussion on
LRU (Least Recently Used)
and
Optimal Page Replacement
techniques in upcoming lectures.
📄
Full transcript