Fall 2003 Midterm Solutions |
Problem | Grader |
---|---|
1 | Kelly |
2 | Sameer |
3 | Mendel |
Space sharing:
- Resource divided up into chunks
- Different chunks allocated to different entities at the same time
- ex) memory
Note: Saying space sharing is when you share space is not a reasonable
answer.
I took off points if you only specified that resources were used by
compilation and said nothing about the relationship between compilation
and optimizations.
Answer (thanks to Ian Comfort):
The original suggestion must have been based on the fact that swapping out
unmodified pages requires only a disk read (of the new page) while swapping out
modified pages requires both a disk write (of the page being replaced) and
a disk read.
Some students with the correct answer also said that it takes twice the amount of time to evict a modified page as compared to evicting an unmodified page (because of the extra write). This is not entirely true, because writes are usually slower than reads -- so the time for evicting a modified page is actually more than twice the time for evicting an unmodified page. But no points were taken off for this small technical detail.
Answer (thanks to Seungbeom Kim):
The use_bit will occupy the highest-order bit, while past use_count will be
shifted down. The effect is that use_count for a more recently used page will
have a high value (MSB set), while a page not recently used will have a lower
value because the "history" of use_count will decay exponentially.
Answer (thanks to Lei Zhang):
Pure paging system needs page table to map virtual pages for the entire
address space. Adding segmentation will require page tables for the segments
that are in use, which is significantly smaller than entire address space.
Also, it does not require contiguous memory to store page tables for the
entire address space.
Answer (thanks to Eric Sirianni):
Yes. It would allow the memory allocated within the base-and-bound chunk to
come from non-contiguous locations in physical memory (via paging). This would
significantly reduce external fragmentation while adding only minimal
internal fragmentation.
Answer (thanks to Seungbeom Kim):
Yes. For example, if allocation requests are made so that the smallest (best)
size of the free memory block is almost always a little larger than the
requested size (instead of exactly the same), a best-fit allocator will leave
a lot of very small free memory blocks that are not very useful ("sawdust").
In this case, which we can expect not to be very rare, a first-fit allocator
can have less fragmentation.
move variable into register R1.(b)
add one to R1 putting result into register R2.
Compare variable with R1 if match swap variable with R2.
if compare fail, goto try_again;
It also was acceptable to argue the concurrency of threads in the same address space would cause more difficulties than simply subdividing threads into different address spaces. Hence it would be easier to start with OS-B.
You grade was based on how well your justified your answer.