0% found this document useful (0 votes)
6 views6 pages

Tutorial7 Answers

The document provides solutions to various memory management problems, including allocation strategies like best-fit and first-fit, physical address calculations, and memory overhead comparisons for different management methods. It also discusses the allocation of memory partitions to processes and the implications of paging systems. Key findings include the completion time for allocation requests and the relationships among storage overheads in memory management methods.

Uploaded by

drishtig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

Tutorial7 Answers

The document provides solutions to various memory management problems, including allocation strategies like best-fit and first-fit, physical address calculations, and memory overhead comparisons for different management methods. It also discusses the allocation of memory partitions to processes and the implications of paging systems. Key findings include the completion time for allocation requests and the relationships among storage overheads in memory management methods.

Uploaded by

drishtig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Tutorial-7, CSN-232 (Solution)

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

Allocation Request 2k 14k 3k 6k 6k 10k 7k 20k


Sizes

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)

C 20k R2 (finishes at t=10)

D 2k R1 (finishes at t=4)

At t=8:
Memory Size Job
Block

A 4k

B 8k R5 (finishes at t=14)

C 20k R2 (finishes at t=10)

D 2k

At t=10:
Memory Size Job
Block
A 4k

B 8k R5 (finishes at t=14)

C 20k R6 (finishes at t=11)

D 2k

At t=11:
Memory Size Job
Block

A 4k

B 8k R5 (finishes at t=14)

C 20k R7 (finishes at t=19)

D 2k

So, R7 finishes at t=19.


2. Consider a user program of logical address of size 6 pages and page size is 4
bytes. The physical address contains 300 frames. The user program consists of
22 instructions a, b, c, . . . u, v. Each instruction takes 1 byte. Assume at that
time the free frames are 7, 26, 52, 20, 55, 6, 18, 21, 70, and 90. Find the
physical address for the instructions m,d,v,r?
Answer:
The physical address = page size * frame number + offset
The physical address of m = 4*20 +0 = 80
The physical address of d = 4*7+3 = 31
The physical address of v = 4* 6 +1 = 25
The physical address of r = 4*55+ 1= 221
3. Suppose there is a main memory system which consists of 8 memory modules
attached to the system bus, which is one word wide. When a write request is
made, the bus remind occupied for 100 ns (nanoseconds) by the data, address
and control signals. During the same 100ns and for 500 ns thereafter, the
addressed memory module executes one cycle accepting and storing data. The
operation of different memory modules may overlap in time, but only one
request can be on the bus at any time. What is the maximum number of stores
(of one word each) that can be initiated in 2 milliseconds?
Answer:
When a write request is made, the bus is occupied for 100 ns. So between two writes,
100 ns interval must be there.
Now, after a write request, for 100+500=600 ns, the corresponding memory module is
busy storing data. But, assuming the next stores are to a different memory module
(total 8 modules as given ), we can have consecutive stores at interval of 100ns.
So maximum number of stores in 2 ms is :
−3 −9
(10 *2) / (100*10 ) = 20, 000.

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

8. A 1000 Kbyte memory is managed using variable partitions but no compaction. It


currently has two partitions of sizes 200 Kbytes and 260 Kbytes respectively. What is the
smallest allocation request in Kbyte that could be denied?
Answer:
Since the total size of the memory is 100KB.
Lets assume partitioning is done in such a way that it leaves minimum free space.
[180-200-180-260-180] KBs.
So minimum size allocation request in Kbyte that could be denied is 181 KB.

9. Consider 6 memory partitions of sizes 200KB,400KB,600KB,500KB,300KB and 250KB,


where KB is kilobytes. These need to be allocated to four processes of sizes 357KB, 210KB,
468KB, 491KB in that order. If the best-fit algorithm is used, which partitions are not
allocated to any process?
Answer:
357 KB is allocated to 400KB
210 KB is allocated to 250 KB
468 KBis allocated to 500KB
491 KB is allocated to 600KB

Two partitions are remaining ie 200Kb and 300KB.

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy