0% found this document useful (0 votes)
10 views3 pages

CS604 2

Uploaded by

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

CS604 2

Uploaded by

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

Operating System (CS604) Total Marks = 20

Spring 2023
Assignment # 02 Deadline Date
13/07/2023

Question No. 01 05 Marks


Suppose a system has resource type C with 16 instances and 5 processes and the current
system state is shown in the following table.

Process Max Need Allocated


P0 11 4
P1 6 3
P2 13 4
P3 15 3
P4 7 2

Calculate the Need for each resource by using the need formula and draw the Need Matrix.

PO P1 P2 P3 P4
C 7 3 9 12 5

Question No. 2 10 Marks


Assume a logical address space of 64 pages of 2048 words, each mapped into a physical
memory of 32 frames. You are required to calculate the following parameters related to paging.

No. of bits needed for p = ? bits


No. of bits needed for f = ? bits
No. of bits needed for d = ? bits
Logical address size = ? bits
Physical address size = ? bits

To calculate the parameters related to paging, we can use the following formulas:
Given information: -
Logical address space has 64 pages of 2048 words. –
Physical memory has 32 frames.
No. of bits needed for p (page number):
Since we have 64 pages, we need to represent them using 6 bits (2^6 = 64). So, p
= 6 bits.
No. of bits needed for f (frame number):
Since we have 32 frames, we need to represent them using 5 bits (2^5 = 32). So, f
= 5 bits.
No. of bits needed for d (offset within a page):
Each page has 2048 words, which requires 11 bits to represent (2^11 = 2048).|
So, d 11 bits.
Logical address size:
The logical address consists of the page number (p) and the offset within a page
(d). Logical address size = p + d = 6 bits + 11 bits = 17 bits.
I Physical address size:
The physical address consists of the frame number (f) and the offset within a
page (d). Physical address size = f+d=5 bits + 11 bits = 16 bits.|

Therefore, the parameters related to paging are as follows:


No. of bits needed for p = 6 bits
No. of bits needed for f= 5 bits
No. of bits needed for d = 11 bits
Logical address size = 17 bits
Physical address size = 16 bits.

Question No. 03 05 Marks


The performance measure in paging is the effective memory access time. With part of the
page table in the TLB and the rest in the main memory. In the context of paging, you are
required to calculate the Teffective by considering the following factors.

Tmem = 200 nsec


TTLB = 20 nsec
Hit ratio = 90%

Calculate the Effective Memory Access Time (Teffective) by using the formula. Show each
step of the calculation.

Miss ratio (MR) = 1 - HR = 1-0.9 = 0.1

Substituting the values into the formula:

Teffective = HR (TTLB + Tmem) + MR (TTLB + 2Tmem)

Teffective = 0.9 (20+200) +0.1 (20+2 * 200)

Teffective = 0.9 (220) + 0.1 (20 + 400)

Teffective = 0.9 (220) + 0.1 (420)


Teffective 198 +42

Teffective 240 nsec

The End

You might also like