[NSWI004] Fifth assignment scoring (virtual memory)

Vojtech Horky horky at d3s.mff.cuni.cz
Fri Jan 10 15:25:20 CET 2020


Hello,

we finished checking assignment 05 (TLB and virtual emory). Again, our 
comments are in your home directories on lab.d3s.mff.cuni.cz.

You should see the exact commit hash we looked at in the notes. If you 
believe we should have looked at other commit or we overlooked something 
etc., please, contact as as soon as possible.

There were two common issues this time.

Heap allocator shall be built on top of frame allocator. The main reason 
is that while frame allocator is responsible for management of all 
physical memory, heap allocator works only on portions of it and also 
provides finer granularity. Note that real frame allocators usually 
allow you to specify (via flags, for example) where the memory shall 
actually reside (e.g. KSEG vs USEG on MIPS).

In the end I decided to penalize solutions with obvious memory leaks. 
While memory leaks of this type (see typical pseudocode below) are not a 
problem in managed environments, they can happen there with other 
resources too (opened files, network connections) and thus should be 
prevented.

thread = kmalloc(..)
if (thread == NULL)
    return ENOMEM;
...
err = frame_alloc(1, &phys)
if err != EOK
     // leak of thread
     return ENOMEM


And that's it - otherwise the code was rather good in most cases. Though 
several solutions are starting to show signs of unpaid technical debt 
from the first assignments.

Cheers,
- VH


More information about the NSWI004 mailing list