• Course: CS110
• Name: SooYoung Jung
• Homework Assignment #4
• Due Date: 10/22/00
• Date: 10/22/00
• Formatter: HTML

1. Paul, #5.1, pg 177 - 5 points
• Attached
1. Paul, #5.5, pg 178 - 5 points

• Attached
1. S&G, #8.2, pg 284 - 3 Points
Explain the difference between internal and external fragmentation.

• Internal fragmentation allocates memory more for each allocation than is actually requested so there is always wasted space within a memory block.
• External fragmentation exists when enough total memory space exists to satisfy a request, but it is not contiguous.  As processes are loaded and removed from memory, the free memory space is broken into little pieces.
1. S&G, #8.5, pg 285 - 5 Points
Given memory partitions of 100K, 500K, 200K, 300K, and 600K (in order), how would each of the First-fit, Best-fit, and Worst-fit algorithms place processes of 212K, 417K, 122K, and 426K (in order)? Which algorithm makes the most efficient use of memory?

• First-fit :
212K process in the memory partition of 500K (288K left)
417K process in the memory partition 600K (183K left)
122K process in the memory partition 288K (leftover of the first process 500K ? 212K fit.)
426K process cannot be allocated in the memory because of external fragmentation.

• Best-fit:
212K process in the memory partition of 300K.
417K process in the memory partition of 500K.
122K process in the memory partition of 200K.
426K process in the memory partition of 600K.

• Worst-fit:
212K process in the memory partition of 600K. (388K left)
417K process in the memory partition of 500K.  (83K left)
122K process in the memory partition of 388K.  (Leftover of the first process 600K ? 212K fit)
426K process cannot be allocated in the memory because of external fragmentation.

• Since only the Best-fit can allocate all processes in the memory, it is the best algorithm to make the most efficient use of memory.
1. S&G, #8.8, pg 285 - 5 points
Consider a logical address space of eight pages of 1024 words each, mapped onto physical memory of 32 frames.
1. How many bits are there in the logical address?
• 8 * 1024 = 8192 = 2^13. Therefore, 13 bits.

2. How many bits are there in the physical address?
• 32 * 1024 = 32768 = 2^15. Therefore, 15 bits
1. S&G, #8.10, pg 285 - 5 points
Consider a paging system with the page table stored in memory.
• If a memory reference takes 200 nanoseconds, how long does a paged memory reference take?
• First access memory for the page table and frame number, which is 200 nanoseconds, and then access the desired byte in memory, which is 200 nanoseconds.
200 + 200 = 400 nanoseconds.

• If we add associative registers,and 75 percent of all page-table references are found in the associative registers, what is the effective memory reference time? (Assume that finding a page-table entry in the associative registers takes zero time, if the entry is there)
• effective memory reference time = 0.75 * (0 + 200) + 0.25 * (0 + 400) = 250 nanoseconds
1. S&G, #8.14, pg 286 - 3 points
Explain why it is easier to share a reentrant module using segmentation that it is to do so when pure paging is used.
•  When pure paging is used, there is one ore more pages. On the other hand, when we use segmentation, there is only 1 segment required, which means it is easy to manage sharing memory.
1. Tanenbaum #5, pg 142. 3 Points
A minicomputer uses the buddy system for memory management. Initially it has one block of 256k at address 0. After successive requests for 5k, 25k, 35k, and 20k come in how many blocks are left and what are their sizes and addresses?

• The first request for 5K will break up a block of 256K to 8K, 8K, 16K, 32K, 64K, and 128K and the first 8K will be taken.
Request for 25K will take 32K and request for 35K will take 64K.
• Request for 20K will break up 128K into 64K and one of 64K will break up to two 32Ks.
The first 32K will be taken by request for 20K.
• There will be 4 block will be left and size and address are:
• 8K at 8K
• 16K at 16K
• 32K at 160K
• 64K at 192K

 Address Memory Size => Address Memory Size 0 5K 8K 0 5K 8K 8K 8K 8K 8K 16K 16K 16K 16K 32K 25K 32K 32K 25K 32K 64K 35K 64K 64K 35K 64K 128K 128K 128K 20K 32K 160K 32K 192K 64K