Exclusive Access 0xFFFF 0xFFFF Device drivers Operating system - - PDF document

exclusive access
SMART_READER_LITE
LIVE PREVIEW

Exclusive Access 0xFFFF 0xFFFF Device drivers Operating system - - PDF document

10/30/2018 Exclusive Access 0xFFFF 0xFFFF Device drivers Operating system CSC 452: Memory Management (ROM) (ROM) User program (RAM) User program (RAM) Jonathan Misurda User program (RAM) jmisurda@cs.arizona.edu Operating system


slide-1
SLIDE 1

10/30/2018 1

CSC 452: Memory Management

Jonathan Misurda jmisurda@cs.arizona.edu

Exclusive Access

Operating system (RAM) User program (RAM)

0xFFFF 0xFFFF

User program (RAM) Operating system (ROM) Operating system (RAM) User program (RAM) Device drivers (ROM)

Fixed Partitions

OS Partition 1 Partition 2 Partition 3 Partition 4 100K 500K 600K 700K 900K OS Partition 1 Partition 2 Partition 3 Partition 4 100K 500K 600K 700K 900K

Relocation and Protection

Process partition OS

0xFFFF

Limit Base

0x2000 0x9000

Logical address: 0x1204 Physical address: 0x1204+0x9000 = 0xa204

Degree of Multiprogramming Swapping

OS OS OS OS OS OS OS A A B A B C B C B C D C D C D A A

slide-2
SLIDE 2

10/30/2018 2

Room to Grow

OS Code Data Stack Code Data Stack Process B Process A Room for B to grow Room for A to grow

Allocation Management

Bitmaps

A B C D

11111100 00111000 01111111 11111000

8 16 24 32

Memory regions Bitmap

Linked Lists

A B C D Memory regions

A 6

  • 6

4 B 10 3

  • 13 4

C 17 9

  • 29 3

D 26 3

8 16 24 32

Allocation Strategies

  • First fit

– Find the first free block, starting from the beginning, that can accommodate the request

  • Next fit

– Find the first free block, starting where the last search left off, that can accommodate the request

  • Best fit

– Find the free block that is closest in size to the request

Allocation Strategies Continued

  • Worst fit

– Find the free block with the most left over after fulfilling the allocation request

  • Quick fit

– Keep several lists of free blocks of common sizes, allocate from the list that nearest matches the request

slide-3
SLIDE 3

10/30/2018 3

Reclaiming Freed Memory

A X B A X X B X A B A B

malloc() and free()

_end brk $sp Stack Heap Globals Unallocated Space

Overlays

Hand-written dynamic loading of subsets

  • f a program’s code and data.

Virtual Memory

Attempt to simulate more memory than exists on the system through automatic “overlays”

Page Table

0–4K 4–8K 8–12K 12–16K 16–20K 20–24K 24–28K 28–32K 7 0–4K 4 4–8K 8–12K 12–16K 16–20K 20–24K 24–28K 3 28–32K 32–36K 36–40K 1 40–44K 5 44–48K 6 48–52K

  • 52–56K

56–60K

  • 60–64K

Virtual address space Physical memory

  • Translation

p Page Number d Page Offset f

1 p-1 p+1

f d Page Frame Number

. . .

Physical Memory

1

. . .

f-1 f f+1 f+2

. . .

Page Frame Number

CPU

p

slide-4
SLIDE 4

10/30/2018 4

Page Table Entry

Page frame number V R D Protection Valid bit Referenced bit Dirty bit

Multilevel Page Tables

1st Level Page Table 2nd Level Page Tables Main Memory

. . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . .

. . .

Two Level Translation

. . . . . .

p1 = 10 bits p2 = 9 bits

  • ffset = 13 bits

Page Offset Page Number

. . .

1 p1

. . .

1 p2 19 Physical Address

1st Level Page Table 2nd Level Page Table

Main Memory 1

Frame Number

13

. . . . . .

Virtual Address

Translation Lookaside Buffer

Cache for Page Table Entries

Inverted Page Table

Instead of a PTE per page, make one per frame

Inverted Page Table Translation

pidk pid0 19 bits Process ID p = 19 bits

  • ffset = 13 bits

Page Number 13 bits Physical Address Main Memory

. . .

1

. . .

Page Frame Number Page Offset pid p p0 pk

. . . . . .

1 k Search! k Virtual Address pid1 p1