-free()를 통한 메모리 반환이 이뤄지면 어떤 일이 일어날까?
- 다음 free space(next : 16708)를 가리키게 됨
- 할당되었던 모든 공간에 대해 다 free()가 이루어지면, merge작업을 통해 하나로 합쳐서 하나의 빈 공간으로 됨
17.3 Basic Strategies
- "best" approach란 없다. 메모리 요청과 free는 프로그래머에 의해 발생하는, arbitrary한 것이기 때문
Best Fit
- 남은 공간들 중, request된 size보다 크면서 가장 작은 공간 할당하는 방법
Worst Fit
- best fit과 반대 개념. 가장 큰 chunk를 할당
First Fit
- request 된 size보다 큰 가장 첫 번째 chunk를 할당
Next Fit
17.4 Other Approaches
Segregated Lists
- If a particular application has one (or a few) popular-sized request that it makes, keep a separate list just to manage objects of that size; all other requests are forwarded to a more general memory allocator.
Buddy Allocation
- The beauty of buddy allocation is found in what happens when that block is freed. When returning the 8KB block to the free list, the allocator checks whether the "buddy" 8KB is free; if so, it coalesces the two blocks into a 16KB block. The allocator then checks if the buddy of the 16KB block is still free; if so, it coalesces those two blocks. This recursive coalescing process continues up the tree, either restoring the entire free space or stopping when a buddy is found to be in use.
-출처-
<OPERATING SYSTEMS three easy pieces>
REMZI H. ARPACI-DUSSEAU
ANDREA C. ARPACI-DUSSEAU
UNIVERSITY OF WISCONSIN-MADISON
'CS > 운영체제' 카테고리의 다른 글
19. Paging: Faster Translations(TLBs) (0) | 2019.12.11 |
---|---|
18. Paging: Introduction (0) | 2019.12.10 |
17. Free-Space Management(1) (1) | 2019.11.23 |
16. Segmentation (0) | 2019.11.23 |
15. Mechanism: Address Translation (0) | 2019.11.10 |
댓글