exclusive access
play

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


  1. 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 (RAM) Operating system (RAM) 0 0 Fixed Partitions Relocation and Protection 900K 900K 0xFFFF 0x2000 Partition 4 Partition 4 Limit 700K 700K Process Partition 3 Partition 3 partition 600K 600K Partition 2 Partition 2 Base 500K 500K 0x9000 Partition 1 Partition 1 Logical address: 0x1204 100K 100K OS Physical address: 0x1204+0x9000 = 0xa204 OS OS 0 0 0 Degree of Multiprogramming Swapping C C C C C B B B B A A A A D D D OS OS OS OS OS OS OS A 1

  2. 10/30/2018 Room to Grow Stack Room for Allocation Management Process B to grow B Data Code Stack Room for Process A to grow A Data Code OS Bitmaps Linked Lists A B C D A B C D 8 16 24 32 8 16 24 32 Memory regions Memory regions 11111100 A 0 6 - 6 4 B 10 3 - 13 4 C 17 9 00111000 01111111 Bitmap 11111000 D 26 3 - 29 3 Allocation Strategies Allocation Strategies Continued • First fit • Worst fit – Find the first free block, starting from the beginning, – Find the free block with the most left over after fulfilling that can accommodate the request the allocation request • Next fit • Quick fit – Find the first free block, starting where the last search – Keep several lists of free blocks of common sizes, left off, that can accommodate the request allocate from the list that nearest matches the request • Best fit – Find the free block that is closest in size to the request 2

  3. 10/30/2018 Reclaiming Freed Memory malloc() and free() A X B A B Stack A X A X B B $sp X Unallocated Space brk Heap _end Globals Overlays Virtual Memory Hand-written dynamic loading of subsets Attempt to simulate more memory than exists on the system through automatic of a program’s code and data. “overlays” Page Table Translation 60–64K - Page Frame Number - 56–60K - Page Number Page Offset Page Frame Number 52–56K 0 48–52K 6 44–48K 5 1 CPU p d f d 40–44K 1 . 36–40K - . - . 32–36K 28–32K 3 28–32K 0 f-1 24–28K - 24–28K 20–24K - 20–24K 1 f . 16–20K 0 16–20K . - 12–16K 12–16K . f+1 - 8–12K 8–12K f+2 p-1 4–8K 4 4–8K . . 0–4K 7 0–4K f p . Virtual Physical p+1 address memory Physical Memory space 3

  4. 10/30/2018 Page Table Entry Multilevel Page Tables 1st Level 2nd Level Main Memory Page Table Page Tables . . . . . . . . . Protection D R V Page frame number . . . . . . . . . . Dirty bit Referenced bit Valid bit . . . . . . . . . . . . . . . . . . . . . . . Two Level Translation Virtual Address Page Number Page Offset Frame p 1 = 10 bits p 2 = 9 bits offset = 13 bits Translation Lookaside Buffer Number 0 Physical Address Cache for Page Table Entries 1 . . 19 13 . 0 . . 1 . 0 . . . 1 . . . p 1 . . . p 2 . Main Memory . . 1st Level Page Table 2nd Level Page Table Inverted Page Table Translation Virtual Address Page Number Page Offset Process ID p = 19 bits offset = 13 bits Inverted Page Table Page Frame Number Instead of a PTE per page, make one per 0 pid p Physical Address 1 frame 19 bits 13 bits . . Search! . 0 pid 0 p 0 1 . pid 1 p 1 . . . . . Main Memory k pid k p k k . . . 4

Recommend


More recommend