Вы находитесь на странице: 1из 4

KSU/CCIS

HOMEWORK # 4 Memory Management


SUMMER 2010
Solution

CSC227

Question # 1:
Consider the fixed partition scheme with a single job queue. The 500KB user memory is divided into
5 fixed partitions of sizes 50KB, 100KB, 50KB, 200KB and 100KB in this order. The following
requests are to be loaded in the FCFS order:
Job Name
Memory

Job 1
75 KB

Job 2
45 KB

Job 3
175 KB

Job 4
120 KB

Job 5
35 KB

Job 6
50 KB

Job 7
80 KB

Compute the total internal fragmentation size if the allocation technique is the Best-fit.

50K

J2 45K
5K

100K

J1 75K
25K

50K
200K

J3 175K
25K

100K

J4, J5, J6 and J7 will wait because there is no space for J4 and the CPU schedule is FCFS.
Total internal fragmentation (not total memory space not used!!!!)
TIF = 5 + 25 + 25 = 55 K

Question # 2:
In fact the above measure is not meaningful. The correct and precise measure is to observe the
memory at regular interval of the time and then take the average. Assume that the Job Scheduler =
FCFS and the CPU scheduler = FCFS, compute the Average Fragment Size when serving the
following Jobs using First-fit memory allocation technique.
Job Name
Memory
CPU burst

Job 1
75 KB
20min

Job 2
45 KB
20min

Job 3
175 KB
20min

Job 4
35 KB
20min

Job 5
100 KB
20min

Job 6
50 KB
20min

Job 7
80 KB
20min

The memory is observed every 20 min starting from time=10 min; i.e. the internal fragmentation size
is calculated at time 10, 30, 50, 70 and 90 min and then averaged.

T=10
50K

T=30(J1 finish)
J2 45K

50K

5K
100K
50K
200K
100K

J1 75K
25K
J4 35K
15K
J3 175K
25K
J5 100K

IF = 5 + 25 + 15 + 25 = 70K

J2 45K
5K

100K
50K
200K
100K

J6 50K
50K
J4 35K
15K
J3 175K
25K
J5 100K

IF = 5 + 50 + 15 + 25 = 95K

T=50(J2 finish)
T=70 (J3 finish)
50K

50K
100K
50K
200K
100K

J6 50K
50K
J4 35K
15K
J3 175K
25K
J5 100K

IF = 50 + 15 + 25 = 90K

100K
50K
200K
100K

J6 50K
50K
J4 35K
15K
J8 80K
120K
J5 100K

IF = 50 + 15 + 120 = 185K

T=90 (J4 finish)


50K
100K

J6 50K
50K

50K
200K
100K

J8 80K
120K
J5 100K

IF = 50 + 120 = 170K

Average Fragment Size = (70 + 95 + 90 + 185 + 170)/5 = answer.

Question # 4:
Consider a segmentation system, where the virtual space can have up to 214 segments of 218 bytes
a) How many bits represent the address field? 32 bits
b) What is the maximum size of the SMT? length is 214 (number of segments) each filed assume
4 bytes, then size is 214 * 22 = 216 bytes.
c) Assume a program P1 is loaded into memory with the following SMT, Translate the address
<1, 50> to an absolute address.
Segment
0
1

Base
1000
2000

Limit
4000
8000

<#segment, Offset>  <1, 50>  offset is less than limit 50 < 8000 (OK)
 <base, offset>  <2000 , 50>  2000 + 50 = 2050.
d) If access time to memory is 200 ns, how long does a memory reference take? (There is no
associative memory)
One access for table + one access to physical address  200 + 200 = 400ns
e) Same as in d) but using associative memory with access time 4 ns and hit ration 80%
(200 + 4) * 0.80 + (400 + 4) * 0.20 = answer

Вам также может понравиться