Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Next-fit is an allocation algorithm that starts by using the first-fit algorithm

ID: 3747937 • Letter: N

Question

Next-fit is an allocation algorithm that starts by using the first-fit algorithm, but it keeps track of the partition that was last allocated, so that it can start its next search from that exact spot instead of restarting the search with Block 1. In other words, it starts searching from the most recently allocated block when the next job arrives. Using the following configuration with jobs arriving in order (Job A, B, C, and D) and with blocks shown in order from low-order memory to high-order memory: Job List: Job Number Job A Job B Job C Job D Memory Requested 625K 44K 900K 220K Memory Block List: Memory Block Block 1 Block 2 Block 3 Block 4 Block 5 Memory Block Size 250K 900K 280K 200K 50K a. Indicate which memory blocks are allocated to each of the arriving jobs. b. Explain in your own words what advantages the next-fit algorithm could offer.

Explanation / Answer

Table that gives which block is allocated to which job is given below:

When the first job, job A arrives, the first block that is free and also that fits is block 2 as job A requested 625k and block 2 has memory size 900k. Now this block 2 gets partitioned and the first partition is of size 625k and the remaining memory of size 275k(900-625) in that block which is free is the second partition. This partition is available and will be searched first for the next fit when a new job arrives.

This new partition is now assigned to next job B which requested 44k. The next job C's request is 900k. But none of the free memory block is of size equal to or greater than 900k. Hence job C cannot be allocated.

Job D which requested 220k is allocated to next available memory block 3 which is of size 280k.

The advantage of next fit algorithm is speed. Instead of searching from the beginning of the memory blocks every tme, by keeping the track of last allocated block, memory gets allocated to jobs. Thus all the memory blocks are evenly allocated than getting allocated in the beginning of the list of free blocks itself.

Block Number Block size Job Block 1 250 Block 2 900 Job A(request- 625k), Job B(request- 44k) Block 3 280 job D(220k) Block 4 200 Block 5 50
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote