Saturday, February 26, 2011

Fixed Partitioning

Loading jobs into memory using fixed partition following a certain memory allocation method. (a. best-fit, b. first-fit, c. worst-fit).

BEST - FIT

1st Turnaround
2nd Turnaround
3rd Turnaround
4th Turnaround
5th Turnaround
6th Turnaround
7th Turnaround
Size
Job 3 (35 k)
Job 3 (35 k)
FREE
FREE
FREE
FREE
FREE
50 k
Job 5 (23 k)
Job 5 (23 k)
Job 9 (88 k)
Job 9 (88 k)
Job 9 (88 k)
FREE
FREE
200k
Job 4 (15 k)
Job 7 (25 k)
Job 8 (55 k)
Job 8 (55 k)
FREE
FREE
FREE
70 k
Job 1(100 k)
Job 1(100 k)
Job 1(100 k)
Job10(100k)
Job10(100k)
Job10(100k)
FREE
115k
Job 2 (15 k)
Job 6 (6 k)
FREE
FREE
FREE
FREE
FREE
15 k


In Best Fit, the allocator places a process in the smallest block of unallocated memory in which it will fit. 

FIRST - FIT

1st Turnaround
2nd Turnaround
3rd Turnaround
4th Turnaround
5th Turnaround
6th Turnaround
7th Turnaround
Size
Job 2 (15 k)
Job 5 (23 k)
Job 5 (23 k)
FREE
FREE
FREE
FREE
50 k
Job1(100 k)
Job1(100 k)
Job1(100 k)
Job10(100k)
Job10(100k)
Job10(100k)
FREE
200k
Job 3 (35 k)
Job 3 (35 k)
Job 8 (55 k)
FREE
FREE
FREE
FREE
70 k
Job 4(15 k)
Job 7(25 k)
Job 9(88 k)
Job 9(88 k)
FREE
FREE
FREE
115k
Job 6 (6 k)
FREE
FREE
FREE
FREE
FREE
FREE
15 k 

In First Fit, it simply scans the free list until a large enough hole is found. Despite the name, first-fit is generally better than best-fit because it leads to less fragmentation.

WORST - FIT

1st Turnaround
2nd Turnaround
3rd Turnaround
4th Turnaround
5th Turnaround
6th Turnaround
7th Turnaround
Size
Job 4 (15 k)
Job 7 (25 k)
FREE
FREE
FREE
FREE
FREE
50 k
Job 1(200 k)
Job 1(200 k)
Job 1(200 k)
Job 9 (88 k)
Job 9 (88 k)
Job 9 (88 k)
FREE
200k
Job 3 (35 k)
Job 3 (35 k)
Job  (55 k)
FREE
FREE
FREE
FREE
70 k
Job 2 (10 k)
Job 5 (23 k)
Job 5 (23 k)
Job10(100k)
Job10(100k)
Job10(100k)
Job10(100k)
115k
Job 6 (6 k)
FREE
FREE
FREE
FREE
FREE
FREE
15 k

In Worst Fit, the memory places processes in the largest block unallocated memory available. The idea is that this placement will create the largest hole after the allocations, thus increasing the possibility that, compared to best fit, another process can use the hole created as a result of external fragmentation.

No comments:

Post a Comment