120 likes | 351 Views
A Lazy Buddy System Bounded by Two Coalescing Delays per Class. R. E. Barkley, T. Paul Lee SOSP '89: Proceedings of the twelfth ACM Symposium on Operating Systems Principles , pp. 167~176, 1989. Speaker : 백승재
E N D
A Lazy Buddy System Bounded by Two Coalescing Delays per Class R. E. Barkley, T. Paul Lee • SOSP '89: Proceedings of the twelfth ACM Symposium on Operating Systems Principles, pp. 167~176, 1989 Speaker : 백승재 ibanez1383@gmail.com
Lazy... CoW, vfork(), Lazy TLB, ...
8 9 Standard Buddy 동작 예 – 1/3 . . 4 alloc 2 page 요청 free 3 2 12 9 1 8 8 0 10 5 free_area.free_list free_area[order].map -> 0 Physical Memory
12 9 8 13 Standard Buddy 동작 예 – 2/3 . . 4 alloc 2 page 요청 13 free 12 3 2 12 9 1 14 8 0 10 5 free_area.free_list free_area[order].map -> 1 -> 0 Physical Memory
11 Standard Buddy 동작 예 – 3/3 . . 4 alloc 11번 page 해제 요청 free index = page_idx >> (order + 1)=> 11 >> ( 0 + 1 ) = 5 11 8 3 12 2 1 8 0 10 5 free_area.free_list index >>= 1 free_area[order].map -> 0 -> 0 -> 0 -> 1 Physical Memory
Basic Idea • Cost of malloc() and free() • Dominated by the costs of fragmenting or coalescing memory • Reducing the number of times we have to fragment and coalesce memory
Related Works • (θl, θs) • θl : lazy ratio, θs : speed up ratio • (0 ≤θl ≤θs ≤ 1/2) • Watermark-based lazy buddy policy • Block class mode (θ = free / total) • (θ≤θl) = lazy : coalescing is not necessary • (θl < θ≤θs) = reclaiming : coalescing is needed • (θs < θ) = accelerated : allocator must coalesce faster • Globally free, Locally free • Depends on the mode of the class • Normally lazy mode
The State-driven DELAY-2 Algorithm • (N,Fl,Fg) • N : Total number of blocks in that class • Fl : number of locally free blocks in the free list • Fg : number of globally free blocks in the free list • (i) 0 ≤ Fg ≤┌ N/2 ┐ • (ii) Fg ≤ N-2Fl • No watermark, focuses directly on maintaining the state of each block class within the lazy space • More aggressive, more lazier • The state S of a class of blocks • Lazy space • First, desreaseFl,then check the state
Algorithm and State Transition Diagram • (i) 0 ≤ Fg ≤┌ N/2 ┐ • (ii) Fg ≤ N-2Fl
A Slack Variable-based Implementation D = N - 2Fl - Fg Initially 0