CS604 ASSIGNMENT NO. 2 SPRING 2023 || 100% RIGHT SOLUTION || OPERATING SYSTEM || BY VuTech
Visit Website For More Solutions
www.vutechofficial.blogspot.com
KINDLY, DON’T COPY PASTE
QUESTION-1
Process | Max Need | Allocated |
P0 | 11 | 4 |
P1 | 6 | 3 |
P2 | 13 | 4 |
P3 | 15 | 3 |
P4 | 7 | 2 |
Suppose a system has resource type C with 16 instances and 5 processes and the current system state is shown in the following table.
Calculate the Need for each resource by using the need formula and draw the Need Matrix.
ANSWER:
To calculate the Need for each resource, we can use the formula:
Need = Max Need - Allocated
Let's calculate the Need for each process and create the Need Matrix based on the given data:
Process | Max Need | Allocated | Need |
P0 | 11 | 4 | 11 - 4 = 7 |
P1 | 6 | 3 | 6 - 3 = 3 |
P2 | 13 | 4 | 13 - 4 = 9 |
P3 | 15 | 3 | 15 - 3 = 12 |
P4 | 7 | 2 | 7 - 2 = 5 |
Need Matrix:
Process | Need |
P0 | 7 |
P1 | 3 |
P2 | 9 |
P3 | 12 |
P4 | 5 |
QUESTION-2
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
ANSWER:
To calculate the parameters related to paging, let's analyze the given information:
Logical address space:
Number of pages (p): 64
Words per page: 2048
Physical memory:
Number of frames (f): 32
To determine the number of bits needed for each parameter, we can use the following formulas:
Number of bits needed for p = log2(p)
Number of bits needed for f = log2(f)
Number of bits needed for d = log2(words per page)
Logical address size = Number of bits needed for p + Number of bits needed for d
Physical address size = Number of bits needed for f + Number of bits needed for d
Let's calculate each parameter step by step:
Number of bits needed for p = log2(64) = log2(2^6) = 6 bits
Number of bits needed for f = log2(32) = log2(2^5) = 5 bits
Number of bits needed for d = log2(2048) = log2(2^11) = 11 bits
Logical address size = Number of bits needed for p + Number of bits needed for d
= 6 bits + 11 bits
= 17 bits
Physical address size = Number of bits needed for f + Number of bits needed for d
= 5 bits + 11 bits
= 16 bits
Therefore, the calculated parameters are:
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
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.
To calculate the Effective Memory Access Time (`T_effective`) in the context of paging, we need to consider the time required for accessing the TLB (Translation Lookaside Buffer) and the time required for accessing the main memory.
Let's break down the calculation step by step:
Calculate the average time for accessing the TLB (`T_TLB`) when there is a hit:
Given: `T_TLB` = 20 nsec
Hit ratio = 90%
The average time for accessing the TLB on a hit can be calculated as:
Average time for TLB hit = `T_TLB` * Hit ratio
Substituting the values, we get:
Average time for TLB hit = 20 nsec * 0.9 = 18 nsec
Calculate the time for accessing the main memory when there is a TLB miss:
Given: `T_mem` = 200 nsec
When there is a TLB miss, we need to access the main memory directly. Therefore, the time for accessing the main memory on a TLB miss is simply equal to `T_mem`.
Time for main memory access on TLB miss = `T_mem` = 200 nsec
Calculate the average time for accessing the main memory taking into account TLB hits and misses:
Given: Hit ratio = 90%
The average time for accessing the main memory can be calculated as:
Average time for main memory access = (Time for main memory access on TLB miss) * (1 - Hit ratio)
Substituting the values, we get:
Average time for main memory access = 200 nsec * (1 - 0.9) = 200 nsec * 0.1 = 20 nsec
Calculate the Effective Memory Access Time (`T_effective`):
The `T_effective` is the weighted sum of the average time for TLB hits and the average time for main memory access, based on their respective probabilities (hit ratio and miss ratio):
`T_effective` = (Average time for TLB hit) + (Average time for main memory access)
Substituting the values, we get:
`T_effective` = 18 nsec + 20 nsec = 38 nsec
Therefore, the Effective Memory Access Time (`T_effective`) in this case is 38 nsec.
KINDLY, DON’T COPY PASTE
SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES
SEND WHATSAPP OR E-MAIL FOR ANY QUERY
0325-6644800
kamranhameedvu@gmail.com
Visit Website For More Solutions
www.vutechofficial.blogspot.com