COMP 3430 – Operating Systems
Free space management and paging part 1
April 11th, 2022
Copyright By PowCoder代写 加微信 powcoder
By the end of today’s lecture, you should be able to:
▶ Compare and contrast free space management policies.
▶ Describe general strategies related to free space management.
▶ Describe the concept of paging.
The Woggle-Bug Book (Public Domain)
Heap allocators
Here are some heap allocators:
1. jemalloc 2. mimalloc 3. glibcmalloc
That’s a heap. (Pixabay License)
For each of these heap allocators, try to determine which strategy the allocator uses:
▶ Best fit ▶ Worst fit ▶ First fit ▶ Next fit
DON’T look at the code (or do, whatever, I’m not your mother); search for keywords.
One fish two fish red fish blue fish (©Random House, Fair use)
Best policy for workload?
Different policies behave differently with different workloads.
Workload (in the context of free space management) How
malloc is called (how much space are you asking for)
How often malloc is called How often free is called
Best policy for workload?
Which policy would you pick for each workload?
▶ Always calling malloc(sizeof(thing)) (# bytes is always the same).
▶ Calling malloc with different sizes, frequently freeing.
Why not the kernel?
Why not discuss free-space management and segmentation from the perspective of the Linux kernel?
Tux! (©gg3po, , , GPL)
▶ Full address spaces: internal fragmentation
▶ Segmentation: external fragmentation ▶ Paging: Similar idea to segmentation
▶ Don’t allocate full address spaces.
▶ Logically separate both physical and
virtual memory into chunks.
▶ Chunks are fixed in size.
Drawers and boxes. (Pexels License)
▶ Memory allocators use different strategies for managing free space.
▶ Sometimes use multiple strategies.
▶ Segmentation is an architecture-specific VM feature.
▶ Not generally used.
▶ Paging solves external fragmentation.
▶ At the cost of complexity (speed and space)!
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com