We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

# www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

# CS604 –Operating System Dear Students, Assignment No.4 has been uploaded on LMS...SOLUTION Discus Here Due Date:- 10-02-2016

Assignment No. 04
Semester: Fall 2015

CS604 –Operating System

Total Marks: 20

Due Date:- 10-02-2016

Assignment Objective:

• To know how to change logical to physical address
• Page table entries for mapping to frames

• Your assignment must be in .doc format (Any other formats like scan images, PDF, bmp, etc will not be accepted).
• No assignment will be accepted through email.

Rules for Marking:

It should be clear that your assignment will not get any credit if:

• The assignment is submitted after due date.
• The submitted assignment does not open or file is corrupted.
• Your assignment is copied from internet, handouts or from any other student

(Strict disciplinary action will be taken in this case).

Assignment

Consider logical memory address space 32 bytes in which page size is of 8 bytes and physical memory is of 0.125 K bytes

Find

1. Number of pages
2. Number of bits required for pages
3. Number of memory frames
4. Number of bits required for memory frames
5. Show the physical memory mapping in the form of table from the following logical memory and page table.
6. Find physical address according to the following page number and offset (p,d)
• (2,3)
• (3,6)

Logical Memory       Page Table               Physical Memory

 0 3 1 8 2 13 3 10

 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

Views: 16738

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Attachments:

### Replies to This Discussion  solution dy do .................. jinho ny kr li plzzzzzzzzzzzzzzz

CS604 assignment solution 2016

Attachments:

Sample

Q1) In a  paging system, what is the effective access time (EAT) assuming that a memory access takes 200 ns, the TLB search takes 30 ns, and the hit ratio is 90% ?

EAT     = hit ratio * (time to search TLB + time for memory access)

+ miss ratio * (time to search TLB + 2*time for memory access)

= 0.9*(30+200) + 0.1*(30+2*200)

= 0.9*230 + 0.1*430

= 207+43

= 250 ns

Q2) Consider that the   Physical memory is 128K, logical memory (per process): 32K and page size: 2K. Calculate the following values:

a)    Pages per process?

Logical memory size / page size = 32K/2K = 16 pages

b)      Frames in physical memory?

Physical memory size / frame size = 128K/2K = 64 frames

c)      Bits indicating page number?

Since there are 16=24 pages, hence 4 bits are needed for the page number.

d) Bits indicating offset?

Since the page size = 2K = 2*210= 211, hence 11 bits are required for the offset.

Q3) Consider a logical address space of eight pages mapped onto a physical memory of 32 frames. Given that the frame size is 1024 bytes, calculate the following:

a)      How many bits for page number?

Since there are 8=23 pages, hence 3 bits are needed for the page number.

b)      How many bits offset?

Since the page size = 1024 = 210, hence 10 bits are required for the offset.

c)      How many bits are there in the logical address?

Number of bits for page number + number of bits for offset = 3+10 = 13 bits

Number of pages in logical address space * page size = 8*1024 = 8K

Number of frames in physical memory * frame size = 32*1024 = 32K

Q4) Consider a simple segmentation system that has the following segment table:

 Process X Segment # Base Limit 0 3000 450 1 2000 350 2 2650 350 3 1050 350

For each of the following logical addresses, determine the physical address or indicate if a segment fault occurs:

a) (0, 240)                    b) (2, 350)                   c) (1, 000)

a) Check if (offset < segment limit) (240<450) OK

Physical address = 3000 + 240 = 3240

b) Check if (offset < segment limit) (350<350) ERROR

illegal reference, trap to operating system

c) Check if (offset < segment limit) (000<350) OK

Physical address = 2000 + 000 = 2000

Sample

Q1) In a  paging system, what is the effective access time (EAT) assuming that a memory access takes 200 ns, the TLB search takes 30 ns, and the hit ratio is 90% ?

EAT        = hit ratio * (time to search TLB + time for memory access)

+ miss ratio * (time to search TLB + 2*time for memory access)

= 0.9*(30+200) + 0.1*(30+2*200)

= 0.9*230 + 0.1*430

= 207+43

= 250 ns

Q2) Consider that the    Physical memory is 128K, logical memory (per process): 32K and page size: 2K. Calculate the following values:

a)    Pages per process?

Logical memory size / page size = 32K/2K = 16 pages

b)      Frames in physical memory?

Physical memory size / frame size = 128K/2K = 64 frames

c)      Bits indicating page number?

Since there are 16=24 pages, hence 4 bits are needed for the page number.

d) Bits indicating offset?

Since the page size = 2K = 2*210= 211, hence 11 bits are required for the offset.

Q3) Consider a logical address space of eight pages mapped onto a physical memory of 32 frames. Given that the frame size is 1024 bytes, calculate the following:

a)      How many bits for page number?

Since there are 8=23 pages, hence 3 bits are needed for the page number.

b)      How many bits offset?

Since the page size = 1024 = 210, hence 10 bits are required for the offset.

c)      How many bits are there in the logical address?

Number of bits for page number + number of bits for offset = 3+10 = 13 bits

Number of pages in logical address space * page size = 8*1024 = 8K

Number of frames in physical memory * frame size = 32*1024 = 32K

Q4) Consider a simple segmentation system that has the following segment table:

 Process X Segment # Base Limit 0 3000 450 1 2000 350 2 2650 350 3 1050 350

For each of the following logical addresses, determine the physical address or indicate if a segment fault occurs:

a) (0, 240)                            b) (2, 350)                            c) (1, 000)

a) Check if (offset < segment limit) (240<450) OK

Physical address = 3000 + 240 = 3240

b) Check if (offset < segment limit) (350<350) ERROR

illegal reference, trap to operating system

c) Check if (offset < segment limit) (000<350) OK

Physical address = 2000 + 000 = 2000

sb aik hi incompletew solution kio dy rhy hn........ corect solution dyn plzzzzzzzzzzz

Code:

#include<graphics.h>
#include<conio.h>
#include<stdio.h>
void main()
{
int gd=DETECT,gm;
int i,j,k,t,q;
float x,y;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setcolor(2);
int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX;
&nbsp;setcolor(2);
&nbsp;i=0;
for(t=0;t<getmaxx();t+=120)
{
line(t,250,t+60,170);
line(t+60,170,t+120,250);
}
line(0,400,getmaxx(),350);
setfillstyle(11,CYAN);
floodfill(2,420,2);
setfillstyle(4,LIGHTGREEN);
floodfill(1,300,2);
i=0;
while(i!=150)
{
setcolor(BLACK);
setfillstyle(SOLID_FILL,BLACK);
fillellipse(k,j,30,30);
setfillstyle(SOLID_FILL,LIGHTRED);
fillellipse(170+i,235-i,30,30);
j=235-i;
k=170+i;
i++;
setcolor(2);
for(t=0;t<getmaxx();t+=120)
{
line(t,250,t+60,170);
line(t+60,170,t+120,250);
}
setfillstyle(1,GREEN);
floodfill(202,200,GREEN);
delay(25);
}
for(i=36;i<80;i++)
for(j=0;j<=360;j+=20)
{
x=319+i*cos(((float)j*3.14)/180);
y=86+i*sin(((float)j*3.14)/180);
putpixel(x,y,LIGHTRED);
delay(1);
}
getch();
}

WA

.