Group3 Os
Group3 Os
Group3 Os
Group3 Members:
Name ID NO.
2. Yawukal Addis..….….……..…….………..3616
BONGAETHIOPIA
1
Together we can!!!
Q1. The following job are loaded in to memory show how they are loaded
using best fit, first fit ,worst fit memory allocated methods list of jobs are
100k,10k,35k,23k,15k,6k,25,55k,88k,100k and memory block are
50k,200k,70k,115k,15k.
Solution:
The given list of jobs and memory blocks becomes as follows:
2
Best-fit
List of job
Memory
block
size List of job size
Block 1 50k Job 3
Block 2 200k Job 5
Block 3 70k Job 4
Block 4 115k Job 1
Block 5 15k Job 2
Memory
block
Block 1 50k Job 3
Block 2 200k Job 5
Block 3 70k Job 7
Block 4 115k Job 1
Block 5 15k Job 6
Memory size
size ListList
of of
jobjob
block
Block 1 50k
3
Block 2 200k Job 9
Block 3 70k
Block 4 115k Job 10
Block 5 15k
Memory
block
Block 1 50k
Block 2 200k
Block 3 70k
Block 4 115k Job 10
Block 5 15k
Worst-fit
List of job
Memory
block
size List of job size
Block 1 50k Job 4
Block 2 200k Job 1
Block 3 70k Job 3
Block 4 115k Job 2
Block 5 15k Job 6
Memory
block
Block 1 50k Job 7
Block 2 200k Job 1
Block 3 70k Job 3
Block 4 115k Job 5
Block 5 15k
Memory size
size ListList
of of
jobjob
block
Block 1 50k
Block 2 200k Job 9
Block 3 70k
Block 4 115k Job 10
Block 5 15k
Memory
block
Block 1 50k
Block 2 200k
Block 3 70k
Block 4 115k
Block 5 15k
First-fit
List of job
Memory
block
size List of job size
Block 1 50k Job 2
Block 2 200k Job 1 5
Block 3 70k Job 3
Block 4 115k Job 4
Block 5 15k Job 6
Memory
block
Block 1 50k Job 5
Block 2 200k Job 1
Block 3 70k Job 3
Block 4 115k Job 7
Block 5 15k
Memory size
size ListList
of of
jobjob
block
Block 1 50k
Block 2 200k Job 10
Block 3 70k
Block 4 115k Job 9
Block 5 15k
Memory
block
Block 1 50k
Block 2 200k Job 10
Block 3 70k
Block 4 115k
Block 5 15k
6
Memor size List of job
y block
Block 1 50k
Block 2 200k
Block 3 70k
Block 4 115k
Block 5 15k
in best-fit memory allocation. During the first processing cycle, jobs 1 to 5 are
submitted and processed in the order they are received. Subsequently, job 2 and job 4,
located in block 5 and block 3 respectively, are replaced by job 6 and job 7, each with
one turnaround. Jobs 1, 3, and 5 remain in their designated blocks. Continuing with
the illustration, in the third cycle, job 1 remains in block 4. Job 8 and job 9 replace
job 7 and job 5 respectively, both experiencing two turnarounds. Moving forward to
the next cycle, job 9 and job 8 remain in their respective blocks, while job 10 replaces
job 1, having three turnarounds. By the fifth cycle, only job 9 and job 10 are left to be
processed, with three available memory blocks for incoming jobs. However, since
there are only 10 jobs in total, these memory blocks remain unoccupied. In the sixth
cycle, job 10 is the sole remaining job to be processed. Ultimately, in the seventh
cycle, all jobs are successfully executed, and each memory block is freed up for future
use.
in First-Fit Memory Allocation: During the first cycle, jobs 1 to 4 are submitted, while
job 6 occupies block 5 as the remaining memory space sufficiently meets its memory
requirements. However, job 5 awaits processing as block 5 fails to fulfill its memory
needs. Moving on to the next cycle, job 5 replaces job 2 in block 1, and job 7 replaces
job 4 in block 4 once both jobs 2 and 4 complete processing. Job 8 joins the waiting
queue due to insufficient space in the remaining block to accommodate its memory
size. Continuing to the third cycle, job 8 replaces job 3, and job 9 occupies block 4
after job 7's completion. Job 1 and job 5 retain their designated blocks. By the end of
the third cycle, blocks 1 and 5 become available to serve incoming jobs; however,
with 10 jobs in line, these blocks remain vacant. Eventually, job 10 occupies block 2
after job 1 completes its turn. Meanwhile, jobs 8 and 9 continue to reside in their
respective blocks.
In Worst-Fit Memory Allocation:
1. First Cycle:
o Job 5 waits in the queue while jobs 1 to 4 and 6 are processed.
o Job 5 replaces job 2, occupying the available free block (block 5).
7
o Now block 5 can only accommodate smaller jobs as it lacks sufficient space
for job 8, leading to job 8 being placed in the waiting queue.
2. Next Cycle:
o Block 3 accommodates job 8 while jobs 1 and 5 remain in their respective
memory blocks.
o This cycle presents two free memory blocks.
3. Fourth Cycle:
o Only job 8 remains in block 3, while jobs 1 and 5 are respectively replaced by
job 9 and job 10.
o Like the previous cycle, there are still two available free memory blocks.
4. Fifth Cycle:
o Job 8 completes its processing, while job 9 and job 10 remain in block 2 and
block 4, respectively.
o An additional memory block becomes free.
5. Sixth Cycle:
o The same scenario persists, with job 9 and job 10 still in their respective
blocks.
o Another memory block becomes available.
6. Seventh Cycle:
o Both job 9 and job 10 complete their processes.
o In this cycle, all jobs are successfully executed, and all memory blocks
become free.