留学生辅导 COMP1411: Introduction to Computer Systems

PowerPoint Presentation

Concurrency & Virtual Memory
COMP1411: Introduction to Computer Systems

Copyright By PowCoder代写 加微信 powcoder

Dr. Xianjin XIA
Department of Computing
The Polytechnic University
Spring 2022
These slides are only intended to use internally. Do not publish it anywhere without permission.

How many “Example” output lines does this program print?
void try()
printf(“Example\n”);

int main()
printf(“Example\n”);

Solution to Problem 1

Problem 2: address translation
A main memory (hardware) has size 1MB
A program (virtual memory) has size 16MB
In a paging system, the size of one page is 1KB

How many frames does the main memory contain?
How many virtual pages does the program contain?

How many bits are needed to address a byte in the main memory?
How many bits are needed to address a byte in the virtual memory?
How many bits are needed to address a byte in a page?

Problem 2: address translation

1MB / 1KB = 1024
16MB / 1KB = 16k

Problem 2: address translation

11……1111 = (M-1)10
1M  20 bits
How many bits are needed to address a byte in the main memory?

Problem 2: address translation

16M  24 bits
How many bits are needed to address a byte in the virtual memory?
11……1111 = (M-1)10

Problem 2: address translation

1K  10 bits
How many bits are needed to address a byte in a page?
11……1111 = (M-1)10

Problem 3: address translation
Assume we use 24 bits for an address
Assume the first virtual page/physical page is numbered from 0

Given virtual address 0x000856, which virtual page does this address belong to?

Problem 3: address translation
0, 1, 2, 3, 4, 5, ……, 1023
00..0000, 00..0001, 00..00010, ……, 00..00001111111111

0000……..0000 0000 0000

0000……0011 1111 1111
0000……..0100 0000 0000

0000……0111 1111 1111
0000……..1000 0000 0000

0000……1011 1111 1111
0000……..1100 0000 0000

0000……1111 1111 1111
Problem 3: address translation
Starting address? Ending address?

Problem 3: address translation

Virtual Page 2
 0000 0000 0000 1000 0101 0110

Problem 4: address translation
Virtual page 2 is mapped to physical page 5
What’s the physical address of 0x000856?

Problem 4: address translation
00000000000010
0001010110

0001010110
0000000101

Generic address translation
Page offset
Virtual page number
Page offset
Virtual address
Virtual page
number Physical page number

Physical page number
Physical address
Page table

/docProps/thumbnail.jpeg

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com