Question 1 on P'263 - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Question 1 on P'263

Description:

For two-level paging, the main page table has ... Only two of these are used. ... Answer: The first page (1620) gets evicted, because the scan starts from the ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 23
Provided by: Yao51
Category:
Tags: question | scan

less

Transcript and Presenter's Notes

Title: Question 1 on P'263


1
Question 1 on P.263
  • Answer
  • Four programs, A, B, C, and D.
  • Probability for A to be idle waiting for I/O
    ½0.5
  • Probability for B to be idle waiting for I/O
    ½0.5
  • Probability for C to be idle waiting for I/O
    ½0.5
  • Probability for D to be idle waiting for I/O
    ½0.5
  • Probability for CPU to be idle (waste) is
  • 0.5? 0.5? 0.5? 0.50.0625
  • So CPU time waste is 6.25

2
Question 2 on P.263
  • Answer
  • Two jobs, A and B. Each has 50 I/O wait.
  • ?Sequential run job A takes 20 minutes (10
    minutes CPU time, 10 minutes I/O wait), job B
    takes 20 minutes (10 minutes CPU time, 10 minutes
    I/O wait). Totally, they take 40 minutes.
  • ? Parallel run (start simultaneously)
  • Probability for A to be idle waiting for I/O
    ½0.5
  • Probability for B to be idle waiting for I/O
    ½0.5
  • CPU utilization 1-0.5?0.50.7575
  • Each jobs CPU time 75 / 2 0.375
  • 10.375 x 10
  • x 10/0.375 26.67 minutes
  • Run parallel, they will take 26.67 minutes.

3
Question 3 on P.263
  • Answer
  • Worst cast, because word 0 is part of a hole.
  • 32 bits 4 bytes.
  • Read or write 32 bits takes 10 ns, i.e., read or
    write 1 byte takes 2.5 ns
  • Move 1 byte contains read from an address and
    write into another, it will take 5ns5?10-9S
  • Move 128MB (exact number227134,217,728) needs
  • 134,217,728 ?5 ?10-9S 0.671S

4
Question 5 on P.264
  • Answer
  • Hole size 10KB, 4KB, 20KB, 18KB, 7KB, 9KB, 12KB,
    15KB
  • Three successive segments (processes)
  • A 12KB
  • B 10KB
  • C 9KB
  • First fit A ? 20KB B ? 10KB C ? 18KB
  • Best fit A ? 12KB B ? 10KB C ? 9KB
  • worst fit A ? 20KB B ? 18KB C ? 15KB
  • next fit A ? 20KB B ? 18KB C ? 9KB

5
Question 6 on P.264
  • Answer
  • Physical address real memory use physical
    address. These are numbers that the memory chips
    react to on the bus. Virtual addresses are the
    logical address that refer to a process address.

6
Question 7 on P.264
  • Answer
  • 4-KB page
  • (page, offset) pair for 20000 is (4, 3616)
  • (page, offset) pair for 32768 is (8, 0)
  • (page, offset) pair for 60000 is (14, 2656)
  • 8-KB page
  • (page, offset) pair for 20000 is (2, 3616)
  • (page, offset) pair for 32768 is (3, 0)
  • (page, offset) pair for 60000 is (7, 2656)

7
Question 8 on P.264
  • Answer
  • (a) (page, offset) pair for 20 is (0, 20),
  • physical address 8192208212
  • (b) (page, offset) pair for 4100 is (1, 4).
  • physical address 409644100
  • (c) (page, offset) pair for 8300 is (2, 108).
  • physical address 2457610824684

8
Question 11 on P.264
  • Answer
  • Total time for k instruction 10?k n
  • Average time per instruction (10?k n) / k
  • 10 n/k nsec

9
Question 12 on P.264
  • Answer
  • Number of Page entry 232/213 219524,288
  • Loading page table 524,288?100ns 52msec
  • If a process get 100msec, this consists of
    52msec for loading page table and 48 msec for
    running.
  • So 52 of the time is spent on loading page
    table.

10
Question 15 on P.264
  • Answer
  • For a one-level page table, there are 232/212
    220 (1M) pages needed. Thus the page table must
    have 1M entries.
  • For two-level paging, the main page table has 1K
    entries (10 bits), each of which points to a
    second page table. Only two of these are used. So
    totally only three page table entries are needed,
    one in the top-level table, and one in each of
    the low-level tables.

11
Question 17 on P.265
  • Answer
  • Assume TLB hit rate is h, the overhead time per
    instruction (the instruction which refers to the
    page) is 1h5(1-h)
  • 1h5(1-h) 2 (reduce the mean overhead to 2 ns)
  • h ¾ 0.75
  • So the h must be at least 0.75.

12
Question 20 on P.265
  • Answer
  • With 8KB pages and 48-bit virtual address, the
    number of virtual pages 248/213
    23534,359,738,368

13
Question 23 on P.265
  • Answer (only consider FIFO)
  • Reference string 0172327103

Pages
7
6
5
Page frames
4
3
3
2
2
1
1
0
0
FIFO
14
Question 24 on P.265
  • Answer
  • Because R bits for pages B through A are
    11011011, page D will be evicted.

15
Question 25 on P.265
  • Answer
  • Sequent clock ticks are 0111(page 0 is 0, the
    reset are 1), 1011, 1010, 1101, 0010, 1010, 1100,
    0001.
  • Aging algorithm
  • Value of counter for page 0 01101110
  • Value of counter for page 1 01001001
  • Value of counter for page 2 00110111
  • Value of counter for page 3 10001011

16
Question 26 on P.265
  • Answer The first page (1620) gets evicted,
    because the scan starts from the bottom,
    2204-1620 584 gt ? ( 400),

17
Question 27 on P.266
  • Answer
  • If ? 400,
  • 2204-1213991 gt ?, the page the hands points to
    is replaced.
  • If ? 1000, the page the hands points to will
    not be removed.

18
Question 29 on P.266
  • Answer
  • NRU will replace page 2, because it belongs to
    class 0(RM00).
  • FIFO will replace page 3, because it exists in
    memory longest.
  • LRU will replace page 1, because its last
    referred time is 265(least recently used)
  • Second chance will replace page 2 because its R
    bit is 0.

19
Question 31 on P.266
  • Answer
  • Page size 4KB, total page number 65536/4096
    16
  • text of the program needs 32768/ 40968 pages
  • data of the program need 16386/ 40964.0005 ?5
    pages
  • stack of the program need 15870/ 40963.87 ?4
    pages
  • Totally this program needs 17 pages. The program
    does not fit the address space.
  • (2) Page size 512 bytes, total page number
    65536/512 128
  • text of the program needs 32768/ 51264 pages
  • data of the program need 16386/ 51232.004 ? 33
    pages
  • stack of the program need 15870/ 51230.996 ? 31
    pages
  • Totally this program needs 128 pages. The
    program fits the address space.

20
Question 32 on P.266
  • Answer
  • If the pages can be shared, some of those pages
    may be in multiple users working set at the same
    time.

21
Question 33 on P.266
  • Answer
  • It is possible. Assuming that segmentation is
    not present, the protection information must be
    in the page table. If each process has its own
    page table, each one also has its own protection
    bits. They could be different.

22
Question 34 on P.266
  • Answer
  • The program is getting 15,000 page faults, each
    of which uses 2 msec of extra processing time.
    Together, the page fault overhead is 15,000230
    sec.
  • A program execution time is 60 sec, half was
    spent on page fault overhead, the exact running
    time is 30 sec.
  • If we run the program with twice as much memory,
    we get half as memory page faults, the page fault
    overhead is 15,000/2215sec.
  • So the total run time will be 301545 sec.
Write a Comment
User Comments (0)
About PowerShow.com