Saturday, February 26, 2011

Dynamic and Relocatable Dynamic Partitioning

Dynamic Partitioning
      In dynamic partitioning, the partitions are of variable length and number. When a process is loaded, it is allocated exactly as much memory as it requires. In the illustration above, the size of the entire memory is 220 k. The operating system has 15 k leaving 205 k of memory space. On the first turnaround, jobs 1 to 6 were loaded to the memory leaving 16 k of memory space which is not suitable for the allocation of job 7 which has a size of 25 k or the job 8 which has a size 55 k, job 9 which has a size of 88 k and job 10 which has a size of 100 k. They are settled in the waiting list because there is no block that will allocate the jobs. On the second turnaround, jobs 2,4 and 6 ended leaving four blocks of free memory space, a block of 10 k, 15 k, 6 k and the remaining 16 k from the first turnaround. Job 7 is still in the waiting list because it will not fit in the free blocks. On the third turnaround, jobs 3 and 5 ended letting job 7 to be allocated at the free memory block of 35 k. The block was now split into two having a free memory block of 10 k. Jobs 8, 9, and 10 are still waiting for a free block that will allocate them. On the fourth turnaround, jobs 1 and 7 ended letting job 8 to be allocated on the free block of 100 k. Still, jobs 9 and 10 are on the waiting list because there are no free blocks that can allocate them. Only job 8 was catered by the memory leaving 6 free blocks. On the fifth turnaround, job 8 was still processed by the memory. While on the sixth turnaround where job 8 ended, there are no free blocks that can allocate the remaining 2 jobs because the main memory becomes fragmented and memory use declines. Job 9 has a size of 88 k so there is no block that can accommodate it, same with job 10 which has a size of 100 k. This phenomenon that the memory external to all partitions becomes increasingly fragmented is called external fragmentation. And the remedy for this is compaction using the Relocatable Dynamic Partition. 

Relocatable Dynamic Partitioning

      The memory size of the illustration above is 220 k with allocated OS of 15 k. There are 10 jobs to be loaded to the memory using relocatable dynamic partition. We have loaded only 6 of the 10 jobs to the memory because there is not enough space for the rest of the jobs to be processed. At the 1st turnaround, Job 2, 4, and 6 ended leaving a block of 10 k after Job 1, a block of 15 k after Job 3, and a block of 22 k after Job 5. When processes finish and new processes are brought in, the main memory becomes more and more fragmented, and memory use declines. To be able to load the remaining jobs to the memory, there must be a block that will allocate the incoming jobs that will fit their sizes. The remedy for this will be Compaction. With compaction, the OS shifts the processes so that the memory left is contiguous in one large block. Jobs 3 and 5 were relocated to gather all of the empty blocks. The empty blocks were compacted to make one block of memory large enough to accommodate some of the jobs waiting to get in. In fig. (c), Job 7 was accommodated because the free size already is 173 letting Job 7 to be processed in the memory. A block of 22 k was left after Job 7 was allocated in the memory. The block will not be able to accommodate Job 8 and the rest so they will have to wait. On the 2nd turnaround, Jobs 3, 5, and 7 ended leaving a block of 105 k for Job 8 only. Job 8 has 55 k of size that will fit in the block of Job 9 has 88 k so it will not be accommodated by the remaining size. Job 9 has to wait. Job 1 is still processed because it has occupied a size of 100 k. On the 3rd turnaround, Job 1 ended letting Job 9 to get in and leaving a block of 12 k to be unattended. Job 10 has to wait because even Jobs 9 and 8 will be compacted, there will still be no enough block of memory that will fit the size of Job 10. When Job 8 ended on the 4th turnaround, Job 10 occupied the block of 100 k. All of the jobs were accomplished because relocatable dynamic partitioning helps in accommodating all of the jobs that the main memory must process.


 

No comments:

Post a Comment

Post a Comment