Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next-fit #4

Merged
merged 2 commits into from
Sep 11, 2023
Merged

Next-fit #4

merged 2 commits into from
Sep 11, 2023

Conversation

ChoiWheatley
Copy link
Owner

cur의 위치를 전역변수 g_cur로 보존한 뒤에 find_fit 호출 시 처음부터 탐색하는 것이 아니라 g_cur의 위치부터 탐색을 시작합니다.

coalesce

prev일 때에만 g_cur를 수정했는데, 그러지 말고 모든 경우의 수에 해당하는 free block의 위치를 g_cur에 할당을 해 주어야 합니다. 예를 들어 next만 가용이고 prev가 채워져 있는 경우일지라도 일단 g_cur = bp를 해 주어야만 overlap이 일어나지 않더라구요.

next_fit

void * 비교연산은 굳이 char *로 바꾸지 않아도 가능하다는 사실.

g_cur 에서 출발해 epliogue로 도착하는 반복문 하나, prologue에서 출발해 g_cur로 도착하는 반복문 하나, 이때 언제나 allocate 여부를 조사하기 때문에 g_cur를 항상 가용 블럭으로 줄 필요가 없습니다.

place

모든 mm_malloc 작업의 마지막을 장식하는 place에서 g_cur의 값을 바꿔주었습니다.

@ChoiWheatley ChoiWheatley merged commit 1c3b341 into main Sep 11, 2023
1 check passed
@ChoiWheatley ChoiWheatley deleted the next-fit branch September 11, 2023 05:14
@ChoiWheatley
Copy link
Owner Author

performance index

Perf index = 45 (util) + 40 (thru) = 85/100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant