Vous êtes sur la page 1sur 3

#1 Shortest Job First Algorithm

P1 = 650k = 9;

P2 = 1000k = 4;

P3 = 250k = 19;

P4 = 800k = 7;

P5 = 400k = 14;

2000k – 1000k = 1000k still good mem

1000k – 800k = 200k good mem

Not enough memory to allocate so the first job is released

200k + 1000k – 650 = 550k

550k – 400k = 150k;

Not enough memory so second job is released

150k + 800k – 250k = 750k

Order,

P2, P4, P1, P5, P3

Practice #2

Order of partitions: 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB

Fitters = 115 KB, 500 KB, 358 KB, 200 KB, and 375 KB (in order)

First Fit = 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB

115 -> 300Kb = (185 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB)

500 -> 600kb = (185 KB, 100 KB, 350 KB, 200 KB, 750 KB, and 125 KB)

358 -> 750kb = (185 KB, 100 KB, 350 KB, 200 KB, 392 KB, and 125 KB)

Doesn’t fit in the other 2 so it goes to the 750

200 -> 350kb = (185 KB, 100 KB, 150 KB, 200 KB, 392 KB, and 125 KB)

375 -> 392kb = (185 KB, 100 KB, 150 KB, 200 KB, 17 KB, and 125 KB)

Best Fit

115 -> 125Kb = (300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 10 KB)

500 -> 600kb = (300 KB, 100 KB, 350 KB, 200 KB, 750 KB, and 10 KB)
358 -> 750kb = (300 KB, 100 KB, 350 KB, 200 KB, 392 KB, and 10 KB)

200 -> 200kb = (300 KB, 100 KB, 350 KB, 0 KB, 392 KB, and 10 KB)

375 -> 392kb = (300 KB, 100 KB, 350 KB, 0 KB, 17 KB, and 10 KB)

Worst Fit

115 -> 750 = 300 KB, 600 KB, 350 KB, 200 KB, 635 KB, and 125 KB)

500 -> 635kb = 300 KB, 600 KB, 350 KB, 200 KB, 135 KB, and 125 KB)

358 -> 600kb = (300 KB, 242 KB, 350 KB, 200 KB, 135 KB, and 125 KB)

200 -> 350kb = (300 KB, 242 KB, 150 KB, 200 KB, 135 KB, and 125 KB)

200 -> 350kb = (300 KB, 242 KB, 150 KB, 200 KB, 135 KB, and 125 KB)

375 goes no where doesn’t fit

Problem #3

Swap p3 with 200k so only 200k gets moved. Then all the memory will be one single block

Problem #4

158 KB +215 KB + 127KB = 500 = partitioned space

1200 – 500 = 700 freespace

701kb will be denied no space

Problem #5

Logical addresses are arrays so you have to go up to the limit -1

C goes beyond the limit

Problem #6
logical address space = # of pages * page size
size of physical address space = # of frames * frame size
a. 2048 * 4kB * 1024 * 2^3 = = 67108864 bits
2^11 * 2^12 * 2^3 = 2^26 = 67108864 bits
Page size = frame size

b. 512 * 2^15= 16777216 bits

Problem #7
a. Int (3085 / 1024) = 3 pages
i. 3085 – (1024 * 3) = 13 offset
b. Int (42095 / 1024) = 41 pages
i. 42095 – 41*1024 = 111 offset
c. Int (650000 / 1024) = 634 pages
i. 42095 – 634*1024 = 754 offset

Problem #8

a. 2 * 50ns = 100ns
50ns hit time
100ns miss time
75% * 50ns + 25% * 100ns +2ns = 62.5

Vous aimerez peut-être aussi