Tính Toán OSG

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Consider a computer system that has cache memory, main memory (RAM) and

disk, and OS uses virtual memory. It takes 2 nsec to access a word from the
cache, 20 nsec to access a word from RAM, and 10 msec to access a word from
the disk. If the cache hit rate is 95% and main memory hit rate is 99%, what is
average time to access a word? *
1/1
5,001.9 nsec
2.89 nsec
5,002.89 nsec
5,000.99 nsec

95% will hit the cache, and 4.95% will hit the RAM and .05% will hit the disk
therefor ( (95 × 2) +(4.95 × 20) +(.05 × 10 × 1000000) )/100 = 5002.89 nsec

Consider a computer system that has cache memory, main memory (RAM) and
disk, and OS uses virtual memory. It takes 1 nsec to access a word from the
cache, 10 nsec to access a word from RAM, and 10 msec to access a word from
the disk. If the cache hit rate is 95% and main memory hit rate is 99%, what is
average time to access a word? *

5,001.445 nsec
5,000.95 nsec
1.445 nsec
5,000.495 nsec

Consider a computer system that has cache memory, main memory (RAM) and
disk, and OS uses virtual memory. It takes 2 nsec to access a word from the
cache, 10 nsec to access a word from RAM, and 10 msec to access a word from
the disk. If the cache hit rate is 95% and main memory hit rate is 99%, what is
average time to access a word? *
2.395 nsec
5,000.495 nsec
5,002.395 nsec
5,001.9 nsec
Consider a computer system that has cache memory, main memory (RAM) and
disk, and OS uses virtual memory. It takes 2 nsec to access a byte from the cache,
20 nsec to access a byte from RAM, and 10 msec to access a block of 1000 bytes
from the disk. If a book has 1000 pages, each with 50 lines of 80 characters each,
How long it will take to electronically scan the text for the case of the master
copy being in each of the level as one proceeds down the memory hierarchy
(from inboard memory to offline storage)? *
? đề?
1 msec, 10 msec, 5 sec
4 msec, 40 msec, 20 sec
2 msec, 20 msec, 10 sec
1 msec, 10 msec, 10 sec
1000.80.50=4000000 bytes
=>time to access from cache 4000000.10^-6.2=8msec

Consider a computer system that has cache memory, main memory (RAM) and
disk, and OS uses virtual memory. It takes 1 nsec to access a byte from the cache,
10 nsec to access a byte from RAM, and 5 msec to access a block of 1000 bytes
from the disk. If a book has 1000 pages, each with 25 lines of 80 characters each,
How long it will take to electronically scan the text for the case of the master copy
being in each of the level as one proceeds down the memory hierarchy (from
inboard memory to offline storage)?

a. 1 msec, 10 msec, 5 sec


b. 4 msec, 40 msec, 20 sec
c. 1 msec, 10 msec, 10 sec
d. 2 msec, 20 msec, 10 sec

Dung lượng của cuốn sách là 1000*25*80=2000000 bytes

Vậy để ổ đĩa truy cập thì cần 5*(2000000/1000)=10000msec=10s


Để ram cần: 10*2000000*10^-6=20msec (Do 1msec=10^-6nsec)

Để cache: 1*2000000*10^-6=2msec

If there are 256 pages and the page size is 4K words, what is the length of logical
address?

a. 15 bits
b. 14 bits
c. 17 bits
d. 20 bits
4K=4.2^10 bytes
256*4K=2^20 =>20 bit
A system with 32 bit virtual address. If the page size is 16 KB and each table entry
occupies 4 bytes, what is the size of the page table?

a. 2 MB
b. 1 MB
c. 4 MB
d. 3 MB
Since we have a virtual address space of 2^32B and each page size is 16.2^10B,
we can store (2^32/2^14) = 2^18 pages. Since each entry into this page table has
an address of size 4 bytes, then we have 2^18*4 =2^20=1MB. So the page table
takes up 1MB in memory.

A system with 32 bit virtual address. If the page size is 4 KB and each table entry
occupies 4 bytes, what is the size of the page table? (key: 4MB)

If there are 64 pages and the page size is 2048 words, what is the length of logical
address?
Hint: 64 = 2^6 and 2048 = 2^11 => length = 6 + 11 =
[A]
17 bits
[B]
15 bits
[C]
16 bits
[D]
14 bits

A computer with a 32-bit address uses a two-level page table. Virtual addresses are
split into a 9-bit top-level page table field, an 11-bit second-level page table field,
and an offset. How many pages are there in the address space? *
Offset = 32 – 9 – 11 = 12 bits

Page size = 2^12 B = 4 KB (How large are the pages)

Total number of pages possible = 2^9 * 2^11 = 2^20

Page in the address space = 2^32/2^12=2^20 pages

A computer has four page frames. The time of loading, time of last access, and the R and M bits
for each page are as shown below (the times are in clock ticks). Which page will LRU replace?
FIFO replace?Second chance replace?NRU replace?

Page_____|______Loaded _______|________Last ref.__ ___|________ R ___|___M____


0 _____ __|________226 ______ __|_________280 ____ __|____ _0 _|___0______
1 _______|_______ 160 ________|________265 ________ _|_________0 _ _|__ 1_______
2 _______|________110 _______|_________270 _____ _ __|__________1 __ _|___0______
3 ____ __|_______ 120 ________|_________285 ______ _ _|___________1 __|____1____
A. 2
B. 0
C. 3
D. 1
NRU thay thế khi cả R và M bằng 0.
FIFO thay thế ở page có loaded nhỏ nhất.
LRU thay thế ở page có last ref nhỏ nhất.
Second change thay thế ở page có…(chưa tìm hiểu ra)
1/ Imagine that a certain printer can print 400 characters per second and that
the time to write a character to the printer's output register is so short it can be
ignored. If to run this printer using interrupt-driven I/O and each character
printed requires an interrupt that takes 50 µsec all-in to service. How many
percent of the CPU is available to do other work? *
400 kí tự => 1s
I/O: 1 kí tự => 50.10^-6 s => 400 kí tự mất 0.02s
=> CPU làm việc khác là : (1-0.02)/1*100 = 98%
How many percent of the CPU does the interrupt overhead cost?
 0.02/ 1 * 100 = 2%
2/

You might also like