You are on page 1of 6

Teaca Maria 343C3

01. [10p] Memory usage

do_append appends size elements to an array, while do_allocate initializes the vector to size
and then sets the elements.

Before do_append After do_append

We can see how the memory usage slowly increases (the free column goes down
gradually).
The same happens for do_allocate because of on-demand paging (i.e. our result
array is “allocated” but it appears in memory only when it’s set). Arrays in python are arrays
of references, anyway, so it’s not like the array itself uses up a lot of space: rather, the
messages themselves start taking up more and more space as they are created.
For experiment 3, memory gets used, then freed, then used again:
Teaca Maria 343C3

For experiment 4, because references to the arrays are kept, more and more memory gets
used (stopped it early so it doesn’t eat away at my computer)

For changing the code so both experiments 3 and 4 use the same amount of memory, I think
we’d have to convince python that the two messages created in the two functions are the
same and so the reference may be reused, but I’m unsure how.

02. [20p] Swap space

We got a swap file!

[10p] Task A - Swap File

Sorry, but I really don’t want to risk messing up my machine. And I sadly don’t have enough
space for a VM so welp.
Teaca Maria 343C3

[10p] Task B - Does it work?

Same thing. Here’s some pros and cons though:

+ file + partition

Easily resized Can be reused between multiple OSs on


the same machine

Don’t take up more than they use, so better Reduced fragmentation as it is isolated from
space management main filesystem

03. [30p] Kernel Samepage Merging

0 before, quite a few after. Sadly it all happened so fast that the vmstat didn’t register a spike
in pages used :(
Teaca Maria 343C3

04. [40p] Intel PIN

[5p] Task A - Setup

Nice!

[10p] Task B - Instrumentation Callbacks

Looks fun! I’m guessing that’s the bytecode of each instruction?


Teaca Maria 343C3

[10p] Task C - Analysis Callbacks (Read)

No, it was the value read from memory by each of these instructions. Close enough!

Write instructions have entered the arena: the red output is probably the value written by the
instruction, while the yellow represents what was there beforehand.

[10p] Task D - Analysis Callbacks (Write)

Somewhat boring, this one.


Teaca Maria 343C3

05. [10p] Feedback

There we go!

You might also like