CS241 Section: Week 101Topics• LMP2 changes• Problem solving session: Memory2LMP2 Changes• In .c and .h file, change the return type of my_mwrite to int, instead of void• In the tester programs, change the following line:–sprintf(filename[i], "file%d", i+1); –sprintf(filename[i], "file%d", i+1); to– sprintf(filename[i], "tester/file%d", i+1);• File map table: initialization and maintenance may be done in the encrypt and decrypt function3Memory: Problem Solving SessionSession4Problem 1Consider a system in which the memory has the following hole sizes inthe following memory order:1KB, 4 KB, 15 KB, 20 KB, 4 KB, 7 KB, 18 KB, 12 KB, 15 KB, 9 KBYou are given successive requests for program segments in thefollowing order:10KB,5KB,3KB,2KB,19KB,9KB,24KB,10KB.10KB,5KB,3KB,2KB,19KB,9KB,24KB,10KB.For each of the following algorithms, show how the holes get filled foreach of the above requests. If a particular request cannot be satisfied,you can skip it (but do mention which ones cannot be satisfied):– First fit– Best fit– Worst fit– Next fit5Problem 2For each of the following decimal virtual addresses, compute the virtual page number and offset for a 4 KB page and for and 8 KB page: 20000, 32768, 60000.page: 20000, 32768, 60000.6Problem 3Consider the page table of the figure. Give the physical address corresponding to each of the following virtual addresses:– 29–4100–4100– 83007Problem 4A machine has 48 bit virtual addresses and 32bit physical addresses. Pages are 8 KB. Howmany entries are needed for the page table?8Problem 5Consider a machine such as the DEC Alpha 21064which has 64 bit registers and manipulates 64-bitaddresses.Ifthepagesizeis8KB,howmanybitsofvirtualpageIfthepagesizeis8KB,howmanybitsofvirtualpagenumber are there?If the page table used for translation from virtual tophysical addresses were 8 bytes per entry, how muchmemory is required for the page table and is thisamount of memory feasible?9Problem 6A computer with a 32-bit address uses a two-level page table. Virtual addresses are split into 9-bit top-level page table field, an 11 bit second-level page table field, and an offset. second-level page table field, and an offset. How large are the pages and how many are there in the address space?10Problem 7Virtual Address (bits)Page Size # of Page Frames# of Virtual PagesOffset Length(bits)Addressable Physical MemoryFill in the following table:(bits)(bits)Memory16 256 B 2^232 1 MB 2^432 1 KB 2^864 16 KB 2^2064 8 MB 2^1611Problem 8Fill in this table with the correct page evictions. Physical memory contains 4 pages.Page Accesses0 1 2 3 4 1 3 4 4 5 3 1 2 0 4 5 4AccessesOptimal - - - - 0 - - - - 4 - - - 3 2 - -FIFO - - - -LRU - - - -LFU - - - -MRU - - -
View Full Document