CS 620

Assignment 4 (Total 50 points)

Due Date: 04/03/2008 (Thursday)

The assignment is to be handed in class. No late assignments will be accepted.

1. (2 points)

What is reentrant code? Explain why sharing a reentrant module is easier when segmentation is used than when pure paging is used.

----------------------

2. (7 points)

Consider a paging system with the page table stored in memory.

a. (1 points) If a memory reference takes 100 nanoseconds, how long does a paged memory reference take?
b. (2 points) If we add associative registers, and 75 percent of all page-table references are found in the associative registers, what is the effective memory reference time? (Assume that finding a page-table entry in the associative registers takes zero time, if the entry is there.)
c. (4 points) Now assume the page table is held in registers. It takes 10 milliseconds to service a page fault if an empty frame is available or if the replaced page is not modified, and 25 milliseconds if the replaced page is modified. Assume that the page to be replaced is modified 60 percent of the time. What is the maximum acceptable page-fault rate for an effective access time of no more than 200 nanoseconds.

----------------------

3. (3 points)

a. (1 points) What is the cause of thrashing?
b. (1 points) How does the system detect thrashing?
c. (1 points) Once it detects thrashing, what can the system do to eliminate this problem?

----------------------

4. (10 points)

Given memory partitions of 300K, 350K, 190K, 600K, 250K and 700K(in order), how would each of the
a. First-fit
b. Next-fit
c. Best-fit
d. Worst-fit
algorithms place processes of 255K, 450K, 185K, 310K, 650K(in order)? For first-fit algorithm, searching starts at the beginning of the set of holes every time. For next-fit algorithm, searching starts at the beginning of the set of holes the first time.

------------------------

5. (5 points)

Consider the two-dimensional array A:

               var A: array[1..200]of array [1..200] of integer;
Where A[1][1] is at location 200, in a paged memory system with pages of size 200. A small process is in page 0(location 0 to 199) for manipulating the matrix; thus, every instruction fetch will be from page 0. For three page frames, how many page faults are generated by the following array-initialization loops, using LRU repacement, and assuming page frame 1 has the process in it, and the other two are initially empty:
     a.            for j:= 1 to 200 do
                       for i:= 1 to 200 do 
                           A[i][j]:=0;

     b.            for i:= 1 to 200 do  
                       for j:= 1 to 200 do
                           A[i][j]:=0;


-----------------------

6. (9 points)

Consider the following page reference string:

           A B C D B A E F C D B C G E B A B D F G
How many page faults would occur for the following replacement algorithms, assuming four frames? Remember all frames are initially empty, so your first unique pages will all cost one fault each. Please show complete working and how you have arrived at the answer.

a. Least Recently Used (LRU) replacement
b. Not Used Recently (NUR) replacement
c. Optimal (OPT) replacement

----------------------

7. (6 points)

For the following reference string:

          A C F B C E B C F D A E F F C D A A D E

How many page faults would occur for the Working set replacement algorithm with a window size of 3 assuming three and four frames respectively?
All frames are initially empty, so your first unique pages will all cost one fault each. Assume that the stack is ordered first-in-first-out. Please show complete working and how you have arrived at the answer.

-----------------------

8. (8 points)

In the following problem, main memory consists of 64 10-bit words. The contents of main memory are as follows:

 

Address

Contents

Address

Contents

Address

Contents

Address

Contents

0

778

16

681

32

315

48

75

1

488

17

842

33

733

49

468

2

50

18

147

34

713

50

538

3

64

19

611

35

423

51

173

4

411

20

508

36

23

52

14

5

389

21

333

37

667

53

915

6

121

22

795

38

191

54

877

7

793

23

285

39

590

55

25

8

470

24

234

40

17

56

911

9

293

25

238

41

866

57

505

10

29

26

318

42

639

58

0

11

152

27

687

43

594

59

65

12

480

28

801

44

172

60

408

13

830

29

192

45

88

61

268

14

16

30

611

46

741

62

654

15

168

31

45

47

816

63

237

Note: the addresses in the problems below are virtual addresses. The normal convention is to place the most significant portion of the address in the most significant bits of the address. Thus, the virtual addresses below will be formatted as follows:

paging

page # | word #

Consider an operating system using paging. Main memory is divided into 4-word page frames. In a page table descriptor, the low order bits contain the frame in which the page resides. To the left of the frame number is the residency bit and the remaining bits are used by the operating system (protection, whether the page has been modified, etc.).
Thus the page descriptor looks like:

OS  ResidencyBit Frame#

The page table pointer for a process points to address 27. Give the results of the following memory references by that process:

a. 60

b. 18

c. 47

d. 25



*****************************************************************************************************************
Return to the CS 620 Home Page