Tutorial7 Answers
Tutorial7 Answers
1. Suppose there is a memory having four free blocks of size: 4k, 8k, 20k, 2k.
These blocks are using a best-fit strategy for allocation. A queue is used for
allocation requests as given here:
Allocation Request No. R1 R2 R3 R4 R5 R6 R7 R8
Usage Timings 4 10 2 8 4 1 8 6
At what time the request for R7 will be completed?
Answer:
At t=0:
Memory Size Job
Block
A 4k R3 (finishes at t=2)
B 8k R4 (finishes at t=8)
D 2k R1 (finishes at t=4)
At t=8:
Memory Size Job
Block
A 4k
B 8k R5 (finishes at t=14)
D 2k
At t=10:
Memory Size Job
Block
A 4k
B 8k R5 (finishes at t=14)
D 2k
At t=11:
Memory Size Job
Block
A 4k
B 8k R5 (finishes at t=14)
D 2k
4. The primary memory in a computer installation is 1000k. These are the orderly arrival and
completion of the jobs:
A. Using the algorithms for Best Fit and First Fit, tabulate the memory allocation.
B. Which algorithm suits better to perform for this sequence?
Answer:
Initial there is 100,000 main memory available.
Then job 1 is arrive and occupied 200,000 then job 2 arrive and occupy 350,000, after
that job 3 arrive and occupy 300,000 – assuming continues allcation : thus free
memory = 1000 – 850(200+350+300) = 150,000 (till these job first fit and best fit are
same)
Now, job 1 is completed. So, that space is also free. So, here 200,000 slot and 150,000
slot are free. Now job 4 arrive which is of 120,000.
Case1: First fir, so it will be in 200,000 slot (free slot) and now free is = 200 –
120=80,000
Now, 150k arrive which will be in 150,000 slot
Then, 80,000 arrive which will occupy in 80,000 slot (200-120) so, all jobs will be
allocated succsfully.
Case2: Best fit: 120,000 job will occupy best fit free space which is 150,000 so now
reaming 150-120=30,000
Then 150,000 jb arrive it will be occupied in 200,000 slot, which is best fit for this job,
so free space = 200-150 = 50.
Now, Job 80,000 memory free . so it, will not be allocated successfully. So, first fit is
better.
5. The number in segments and total size in KB are tabulated below for process A1,
A2, A3, and A4 each.
Process Total size (KB) No. of segments
A1 195 4
A2 254 5
A3 45 3
A4 364 8
The page size is 1KB. The size of an entry in the page table is 4bytes. The size of an
entry in the segments table is 8 bytes. The maximum size of a segments is 256KB. The
paging methods for memory managements uses two -level paging, and its storage
overhead is M. The storage overhead for the segmentation method is N. The storage
overhead for the segmentation and paging method is O. What is the relation (in
ascending order) among the overheads for the different methods of the memory
management in the concurrent execution of the above four process?
Answer:
For 2 level paging.
Page size is 1KB So, no. of pages required for A1=195. An entry in page table is of
size 4 bytes and assuming an inner level page table takes the size of a page (this
information is not given in question), we can have up to 256 entries in a second level
page table and we require only 195 for A1. Thus only 1 second level page table is
enough. So, memory overhead = 1 KB (for first level) (again assumed as page size as
not explicitly told in question) +1KB for second level = 2KB
For A2 and A3 also, we get 2KB each and for A4 we get 1+2=KB as it requires 1 first
level page table and 2 second level page table (364>256). So, total overhead for their
concurrent execution = 2X3+3=9KB.
Thus, M=9KB.
For Segmentation method
A1 uses 4 segments == 4 entries in segment table == 4X8=32 bytes.
Similarly, for A2, A3 and A4 we get 5X8 3X8 and 8X8 bytes respectively an the total
overhead will be 32+40+24+64=160 bytes.
So, N=160B
For segmentation with paging
Here we segment first and then page. So, we need the page table size. We are given
maximum size of a segment is 256KB and page size is 1KB and thus we require 256
entries in the page table. So, total size of page table = 256X4 = 1024 bytes (exactly 1
page size).
So, now for A1 we require 1 segment table of size 32 bytes plus table of size 1KB
similarly,
A2-40 bytes and 1KB
A3-24 bytes and 1KB
A4-64 bytes and 1KB
Thus, total overhead = 160 bytes + 4KB = 4096 + 160 = 4256 bytes
So, O = 4256B
So answer : N<O<M
6. Suppose there are free segments with sizes: 6,17,25,14, and 19. Place a program with
size 13 kB in the free segment using first-fit, best-fit, and worst-fit.
Answer:
first-fit 17kB
Worst -fit 25kB
Best-fit 14kB
7. A logical address space of 64 pages of 1024 words each, mapped onto a physical
memory of 32 frames. How many bits are there in the logical and physical address?
Answer:
a. Logical address: 16 bits
b. Physical address: 15 bits
10. In a paging system with 2^24 bytes of physical memory,256 pages of logical address space,
and a page size of 2^10 bytes.
a) How many bytes are in the page frame?
b) how many bits are in the logical address?
Answer:
a) 2^10 bytes
b) total logical address space = a number of pages * page size = 28 * 210 = 218
bytes for 218 bytes address space, 18-bit address is required.