Lecture 15 Flashcards
Function of operating system
“Middleman” to run your executable codes on the computers.
Need to put your programs into the physical memory space before they are run by CPU.
How to manage programs
The first approach: simply allocate them
based on the size of program code (called
“process” in OS)
Eventually see “holes” scattered in different places
Paging system
Divide the physical memory space into pages.
First-fit Strategy
Allocate the FIRST hole that is big enough
reason: simple
Best-Fit Strategy
Allocate the SMALLEST hole that is big enough
reason: produce the smallest left-over hole
Worst-Fit Strategy
Allocate the LARGEST hole
reason: produce the largest left-over hole
External Fragmentation
Total free-memory exists to satisfy a request, but it is not contiguous
(solution: compact the free memory into one contiguous space)
Internal Fragmentation
Part of the nature in the paging system
solution: use smaller page size
How to manage memory with a Linked List and keep track of all allocated and free memory pages
–When a request (called “job” in OS) comes, use the specific strategy to find the “hole”
–Allocate the free-memory pages to the allocated-memory pages
–Update BOTH linked lists
–Calculate the fragmentation
–Do the compaction if necessary