





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






December 9, 2009
Instructions:
Problem 1. (10 points):
Multiple choice. For each question, circle the letter corresponding to the single best answer.
(a) Quadruple word block alignment (b) Deferred coalescing (c) Address-based free list ordering (d) Next-fit free block search
(a) pipe (b) socket (c) rio_readn (d) select
(a) temporal locality (b) spatial locality (c) small function size (d) minimal coupling
(a) it is easier to share data amongst processes (b) process context switches are more efficient (c) thread concurrency is unpredictable (d) a single misbehaved thread may crash the entire application
(a) the lack of true parallelism (b) the inability to use file descriptors without blocking (c) implicit barriers to data sharing (d) the need to synchronize parallel control flows
The diagram below shows the format of a virtual address. Label it with the fields (indicate their positions) that would be used to determine the following:
VPO : The virtual page offset VPN : The virtual page number TLBI : The TLB index TLBT : The TLB tag
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The diagram below shows the format of a physical address. Label it with the fields (indicate their positions) that would be used to determine the following:
PPO : The physical page offset PPN : The physical page number CO : The cache block offset CI : The cache set index CT : The cache tag
11 10 9 8 7 6 5 4 3 2 1 0
For the virtual address on this and the following page, fill in the diagrams and tables in parts A-D using the address translation and cache structures described. If a page fault occurs, you should leave parts C and D blank.
Virtual Address: 0x051F
A. Virtual address format 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
B. Address translation Parameter Value VPN 0x TLB Index 0x TLB Tag 0x TLB Hit? (Y/N) Page Fault? (Y/N) PPN 0x
C. Physical address format 11 10 9 8 7 6 5 4 3 2 1 0
D. Physical memory reference Parameter Value Cache offset 0x Cache Index 0x Cache Tag 0x Cache Hit? (Y/N) Cache Byte returned 0x
Problem 3. (12 points):
Consider an allocator that uses an explicit (circular) free list. Each block of memory is double-word aligned, and is prefaced by a header that occupies four words of memory: the first word contains the total block size (including payload and boundary tags) and allocated bit, and the second and third words contain pointers to the beginning of the prior and next free blocks (when the block is free). The fourth word in the header is unused. A footer is also present for each block, and consists of two words: the first contains the size and allocated bit and the second is unused.
The diagram below shows the structure of a block:
Answer the following questions based on this allocator, assuming a word size of 4 bytes. If you need additional space, use the back of this sheet.
void *next =
Problem 4. (12 points):
Consider an allocator that uses an implicit free list. Each memory block is word-aligned (4-byte words), with word-sized boundary tags that use their LSBs for the allocated bit and the rest of the bits for storing the size of the block. The allocator performs immediate coalescing, and splits blocks during allocation whenever possible (zero payload is not allowed).
Starting with the heap on the left below, show the resulting heap following each successive call to malloc and free. Use a best-fit allocation policy that starts searching from the bottom of the heap shown. Note that you only need to show header/footer word contents.
Start state:
Addr. Data 0x80005068 0x 0x...5064 โ 0x...5060 โ 0x...505c โ 0x...5058 0x 0x...5054 0x 0x...5050 โ 0x...504c โ 0x...5048 0x 0x...5044 0x 0x...5040 โ 0x...503c โ 0x...5038 0x 0x...5034 0x 0x...5030 โ 0x...502c โ 0x...5028 โ 0x...5024 0x 0x...5020 0x 0x...501c โ 0x...5018 โ 0x...5014 โ 0x...5010 โ 0x...500c โ 0x...5008 โ 0x...5004 โ 0x80005000 0x
After malloc(6): Addr. Data 0x 0x... 0x... 0x...505c 0x... 0x... 0x... 0x...504c 0x... 0x... 0x... 0x...503c 0x... 0x... 0x... 0x...502c 0x... 0x... 0x... 0x...501c 0x... 0x... 0x... 0x...500c 0x... 0x... 0x
After malloc(23): Addr. Data 0x 0x... 0x... 0x...505c 0x... 0x... 0x... 0x...504c 0x... 0x... 0x... 0x...503c 0x... 0x... 0x... 0x...502c 0x... 0x... 0x... 0x...501c 0x... 0x... 0x... 0x...500c 0x... 0x... 0x
After free(0x8000504C): Addr. Data 0x 0x... 0x... 0x...505c 0x... 0x... 0x... 0x...504c 0x... 0x... 0x... 0x...503c 0x... 0x... 0x... 0x...502c 0x... 0x... 0x... 0x...501c 0x... 0x... 0x... 0x...500c 0x... 0x... 0x