recategorized by
7,941 views
21 votes
21 votes

A computer installation has $1000k$ of main memory. The jobs arrive and finish in the following sequences.

    Job 1 requiring 200k arrives
    Job 2 requiring 350k arrives
    Job 3 requiring 300k arrives
    Job 1 finishes
    Job 4 requiring 120k arrives
    Job 5 requiring 150k arrives
    Job 6 requiring 80k arrives
  1. Draw the memory allocation table using Best Fit and First Fit algorithms.

  2. Which algorithm performs better for this sequence?

recategorized by

3 Answers

Best answer
33 votes
33 votes

Initial there is $1000k$ main memory available.

Then job $1$ arrive and occupied $200k$, then job $2$ arrive, occupy $350k$, after that job $3$ arrive and occupy $300k$ (assume continuous allocation ) now free memory is $1000-850(200+350+300)= 150k$ (till these jobs first fit and best fit are same)

Now, job $1$ is finished. So, that space is also free. So, here $200k$ slot and $150k$ slots are free.

Now, job $4$ arrives which is $120k$.

Case 1:

  • First fit, so it will be in $200$ k slot (free slot ) and now free is $= 200-120=80k$,
  • Now $150k$ arrive which will be in $150$ $k$ slot
  • Then, $80k$ arrive which will occupy in $80k$ slot $(200-120)$ so, all jobs will be allocated  successfully.

Case 2:

  • Best fit : $120 k$ job will occupy best fit free space which is $150k$ so, now remaining $150-120=30k$,
  • Then $150k$ job arrive it will be occupied in $200k$ slot, which is best fit for this job. So, free space $=200-150= 50$,
  • Now, job $80k$ arrive, but there is no continuous $80k$ memory free. So, it will not be allocated successfully.

So, first fit is better.

edited by
8 votes
8 votes
First fit, in best fit 80K will not be served
0 votes
0 votes
Yes in this case First Fit algorithm will willperform better than Best Fit as in case of BEST FIT last job is not allocated due to non- availability of Contiguous memory.

Related questions

25 votes
25 votes
3 answers
4
Kathleen asked Oct 8, 2014
10,687 views
In a virtual memory system the address space specified by the address lines of the CPU must be _____ than the physical memory size and ____ than the secondary storage siz...