Question

# How much internal fragmentation would you have - in paging Cassume a page size of n...

How much internal fragmentation would you have - in paging Cassume a page size of n bytes) in

a) the best case

b) worst case

c) average case

2‌)‌ ‌Assuming‌ ‌a‌ ‌page‌ ‌size‌ ‌of‌ ‌100‌ ‌bytes‌ ‌in‌ ‌paging‌,‌ ‌‌it‌ ‌a‌ ‌program‌ ‌

references‌ ‌logical‌ ‌address‌ ‌235‌,‌ ‌‌tell‌ ‌me:‌ ‌ ‌

a)‌ ‌what‌ ‌the‌ ‌page‌ ‌number‌ ‌and‌ ‌the‌ ‌offset‌ ‌ ‌

(displacement)‌ ‌will‌ ‌be‌ ‌ ‌

b)describe‌ ‌how‌ ‌the‌ ‌page‌ ‌number‌ ‌and‌ ‌the‌ ‌offset‌ ‌‌will‌ ‌be‌ ‌‌used‌ ‌to‌ ‌

come‌ ‌up‌ ‌with‌ ‌the‌ ‌actual‌ ‌physical‌ ‌address‌ ‌and‌ ‌how‌ ‌many‌ ‌

memory‌ ‌accesses‌ ‌will‌ ‌required‌ ‌to‌ ‌do‌ ‌that‌ ‌

Que:- How much internal fragmentation would you have - in paging (assume a page size of n bytes) in

a) the best case

b) worst case

c) average case

Ans:- It is given that size of a page in paging memory management technique in OS is n bytes

a) In best case there will 0 (zero) byte internal fragmentation, It can be the case when the process size is the multiple of page size. (For example if process of size 400 bytes and the page size is of 100 bytes then there will be exactly 4 pages required to accomodate the process.

b) In worst case there will (n- 1) bytes internal fragmentation, It can be the case when the process required M whole pages plus one byte, in such case total number of pages required (M+1). In M+1th page only 1 byte will be used and remaining n-1 bytes will be internal fragmentation.

c) In average case there will be n/2 bytes internal fragementation. In such case last page of the process will be half filled and remaining half page will be internal fragmentation.

Que 2‌)‌ ‌Assuming‌ ‌a‌ ‌page‌ ‌size‌ ‌of‌ ‌100‌ ‌bytes‌ ‌in‌ ‌paging‌,‌ ‌‌if‌ ‌a‌ ‌program‌ references‌ ‌logical‌ ‌address‌ ‌235‌,‌ ‌‌tell‌ ‌me:‌ ‌

a)‌ ‌what‌ ‌the‌ ‌page‌ ‌number‌ ‌and‌ ‌the‌ ‌offset‌ ‌ ‌(displacement)‌ ‌will‌ ‌be‌ ‌ ‌?

b) Describe‌ ‌how‌ ‌the‌ ‌page‌ ‌number‌ ‌and‌ ‌the‌ ‌offset‌ ‌‌will‌ ‌be‌ ‌‌used‌ ‌to‌ ‌come‌ ‌up‌ ‌with‌ ‌the‌ ‌actual‌ ‌physical‌ ‌address‌ ‌and‌ ‌how‌ ‌many‌ ‌ memory‌ ‌accesses‌ ‌will‌ ‌required‌ ‌to‌ ‌do‌ ‌that‌?

Ans-2:-  ‌GIven that

page size =100

Logical address (referenced by program) A= 235

a) The logical address will be at 3rd page (because as page size is 100, logical addresses 0-99 will be at PAGE0, 100-199 will be PAGE1, 200-299 will be at PAGE2.

So page number will be 2, because in paging page numbers starts from 0 (Zero).

Offset = A mod Page_size

= 235 mod 100

= 35

b) To obtain the physical address first we see the frame number in the page table. multiply (Frame number-1) by page size then add the offset in that. By that way way we can calculate the physical address and access the particular logical address on a particular page in the main memory.

Step-1: first we find the page number on the basis of page size. (Page# = logical address/Page_size)

Step-2: Search the Page map table in the memory and check whether it is in main memory or not on the basis of bit.

Step-3: If it is there then directly access the logical address else there will be a page fault and first that page will be swap into the main memory from the secondary storage and make the entry in PMT and access the address at the page in that particular frame in the main memory.

#### Earn Coins

Coins can be redeemed for fabulous gifts.