Q1: Why there is infinitive loop?
A1: get_proc is looply called to get new task in src/os.c until all the the task
are done or all ready_queue are empty.
Q2:The 'Slot' in each mlq is the max number of processes each queue can run or the
max time slot each queue can run?
A2:Slot is about the time. The maximum slot is the max time each queue can run
Q3:We have 5 instruction types. How much time does a type need to complete its
execution?
A3:There are two type of instruction the memory allocation and the calculation. The
memory instruction is finished
in one time slot while each calc() do it work in one time slot (they are equal by
chance), but in generall calc() might
take different number of time slot (depend on it is a long or a short instruction)
Q4:In 'mm-vm.c', function 'validate_overlap_vm_area': Do we expect to handle the
case where the vmastart and vmaend overlap with each other (having the same value),
or a different kind of overlap?
A4:It is used to validate is the upcoming memory area we plan to allocated the new
space is overlap with any existed memory space.
Curently, it is non overlapped since we keep you in entrance stage by assuming we
have only one memory segment (or vm_area).
But in general case or in the next few classes where we might make a different
assumption that there are multiple segments then the validation check will return
true/false in different memory status.
Q5:In 'mm.c', function 'pte_set_swap': It's used to update the pte after swapping,
whose swptyp and swpoff should we pass into this method to update the pte?
A5:There are 4 swap spaces which is mapped to different swptyp (swap type).
Currently, we use only one swap then we have only one swptyp (may be assuming
swptyp=0 or swptyp=1 up to you)
Q6:What exactly does MEMPHY_dump() function do in mm-memphy.c? Does it simply free
mp->storage.
A6: MEMPHY_dump is used to dump the memory content, and obviously for debugging
purpose.
If you dont need that, you can disable the MEMPHY DEBUG
Q7:Can u explain a little bit what is difference between page table and page
directory (pgd) in mm_struct
A7:pgd is denoted page directory, it is an alias of page mapping and page table but
because it used spreadily
by open source community then I keep that term to make you familiar with the real
developer name variable (in Linux source code).
In summary, page directory or page mapping or page table are the same, it contains
a table of page table entry (pte)
Q8:In 'mm.c', method 'vmap_page_range': When there is not enough frames to map all
the pages, what should we do with the remaining pages,
or throwing error? In accordance to that, the scenario of getting less free frame
than it should have been will be
caught by the 'alloc_pages_range' in 'vm_map_ram' method, and it will return an
error, and how should we modify that for the OS to perform as intended?
A8: page replacement algorithm is employed when you have no free frame in main
memory (RAM)
Q9:I see the function "Get_vm_area_node_at_brk" in "mm-vm.c" do not check if the
increase the sbrk will exceed the end of vm_area or not ?
A9:You do the task of checking, and lifting the end value if needed
Q10: In free function, if the range we free is contiguous with one in the mmap, do
we need to merge them to a bigger block?
A10: Keep it simple. In some program language they do what you describe as garbage
collector but you don't need to make it complicated
like that (out-of-scope OS course). You can add it to free list and focus on frame
management, there are a lot of works overthere
Q11: Can u explain what does "vmap_page_range" in "mm.c" do ? Because i don't
really understand the code
A11: It maps virtual address to the new frame to extend the vm_area size. Check
this step in allocation procedure,
you reach this function because the free region list does not have any empty region
that match your allocation demand.
Q12: In function "alloc_mem" and "free_mem" in "mem.c", two these funtions have
comment "/* DO NOTHING HERE.
This mem is obsoleted */" so do we need to code something in these functions ?
A12: mem.c is obsoleted, it is the old version of dummy memory and has been
replaced by our work of memory paging.
You don't touch it and there is no description about that old [Link] document of
the assignment has identified the 3 source code file
implements the Memory Paging Management is mm-vm.c, mm.c and mm-memphy.c.
Q13: Do we have any requirement or suggested algorithm to perform page replacement
in function find_victim_page or is it up to us to decide
A13: page replacement is the page replacement in theory, what is the suggestion
about it?
Did you mean FIFO, LRU, or second chance? FIFO is the easiest one but remember it
might happen the abnormal Belady,
since then LRU and LRU approximation are developed. You miss that part you got fail
when the testcase falls in to
out-of-memory status and requires to find a victim page then your code has no thing
work to find that victim page
Q14: How can we run the file to check the output of the question 2.1 (implement
queue.c and sched.c)
A14: The module scheduler is all included test when we run ./os config_file_name.
To avoid touching memory management,
just run in the config file the program with only CALC instruction, don't include
any memory instruction (NO ALLOC, NO FREE, NO READ, NO WRITE)
then you are fine to test