Skip to content

Commit 6ef44be

Browse files
authored
Update build.sh to use /usr/bin/env shebang (#121)
* use /usr/bin/env in build.sh shebang * fix typos in code for heap initialization * fix typo in heap initialization
1 parent 03a9d6a commit 6ef44be

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

04_Memory_Management/05_Heap_Allocation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ And that's it!
458458

459459
### Part 7: Heap Initialization
460460

461-
Each heap will likely have different requires for how it's initialized, depending on whether it's a heap for a user program, or it's running as part of a kernel. For a userspace program heap we may want to allocate a bigger initial size if we know the program will need it. As the operating system grows there will be more instances of the heap (usually at least one per program + global kernel heap), and it becomes important to keep track of all the memory used by these heaps. This is often a job that the VMM for a process will take on.
461+
Each heap will likely have different requirements for how it's initialized, depending on whether it's a heap for a user program, or it's running as part of a kernel. For a userspace program heap we may want to allocate a bigger initial size if we know the program will need it. As the operating system grows there will be more instances of the heap (usually at least one per program + global kernel heap), and it becomes important to keep track of all the memory used by these heaps. This is often a job that the VMM for a process will take on.
462462

463463
What is really needed to initialize a heap is an initial size (for example 8k), and to create a single starting node:
464464

@@ -468,9 +468,9 @@ Heap_Node *heap_start;
468468
Heap_Node *heap_end;
469469
void initialize_heap() {
470470
heap_start = INITIAL_HEAP_ADDRESS //Remember is a virtual address;
471-
heap_start->next = NULL;
471+
heap_start->prev = NULL;
472472
heap_start->next = NULL; // Just make sure that prev and next are not going anywhere
473-
heap_start->status = free;
473+
heap_start->status = FREE;
474474
heap_start->size = INITIAL_HEAP_SIZE // 8096 = 8k;
475475
heap_end = heap_start
476476
}

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
get_entries() {
44
echo $(find $1 -maxdepth 1 -regextype egrep -regex '.*\/[0-9A-Z]{1,2}_[A-Za-z_.]*' | sort)

0 commit comments

Comments
 (0)