31
Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

  • View
    235

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Memory Problems (I.1.1)

Prof. Sin-Min Lee

Department of Mathematics and Computer Science

Page 2: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 3: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 4: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 5: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 6: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 7: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 8: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

The code and any static data will not grow or shrink during execution.

Page 9: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

A processes logical addresses are usually contiguous in the range (0,N-1).

Page 10: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 11: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 12: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Swapping is used only when it is necessary to remove an entire process from memory.

Page 13: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 14: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

PDP-11, UNIVAC 1100 and others. Seperate instruction and data spaces

Page 15: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 16: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 17: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 18: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 19: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Example: A virtual memory has a page size of 1024 words, eight virtual pages, and four physical page frames. The page table is as follows:

a. List the virtual addresses that will cause page faults.

Page 20: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

b. What are the physical addresses for virtual addresses 0, 3728, 1023, 1024, 1025, 7800, and 4096?

Page 21: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

the page is the same size as the page frame

Page 22: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Each page is placed in a page frame.

We have internal fragmentation

Page 23: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Explain the difference between internal and external fragmentation.

Answer: Internal fragmentation is the area in a region or a page that is not used by the job occupying that region or page. This space is unavailable for use by the system until that job is finished and the page or region is released .

Page 24: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Given memory partitions of l00K. 500K, 200K, 300K, and 600K (in order), how would each of the First-fit algorithm place processes of 212K, 417K, 112K, and 426K (in order)?

Answer:

First-fit: 212K is put in 500K panition

417K is put in 600K partition

112K is put in 288K partition

(new partition 288K = 500K-212K)

426K must wait

100

500

200

300

600

(1)212

(2)417

(3)112

Page 25: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Given memory partitions of l00K. 500K, 200K, 300K, and 600K (in order), how would each of the Best-fit algorithm place processes of 212K, 417K, 112K, and 426K (in order)? Answer:

Best-fit: 212K is put in 300K partition

417K is put in 500K partition

112K is put in 2OOK partition

426K is put in 600K partition

100

500

200

300

600

(2)417

(1)212-

(3) 112

(4) 426

Page 26: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Given memory partitions of l00K. 500K, 200K, 300K, and 600K (in order), how would each of the Worst-fit algorithm place processes of 212K, 417K, 112K, and 426K (in order)?

Answer:

Worst-fit:

212K is put in 600K partition

417K is put in 500K partition

112K is put in 388K partition

426K must wait

100

500

200

300

600(1)212

(2)417

(3)112

Page 27: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science

Consider the following segment table:

Segment Base Length

0 219 600

1 2300 14

2 90 100

3 1327 580

4 1952 96

What are the physical addresses for the following logical addresses? a. 0,430 b. 1,10 c. 2,500 d. 3,400 e. 4,112

Answer: a. 219 + 430 = 649 b. 2300 + 10 = 2310

c. illegal reference. trap to operating system d. 1327 + 400 =1727 e. illegal reference, trap to operating system

Page 28: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 29: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 30: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science
Page 31: Memory Problems (I.1.1) Prof. Sin-Min Lee Department of Mathematics and Computer Science