By%20Juthawut%20Chantharamalee - PowerPoint PPT Presentation

About This Presentation
Title:

By%20Juthawut%20Chantharamalee

Description:

Operating System 2 By Juthawut Chantharamalee Suan Dusit Rajabhat University (Computer Science) ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 78
Provided by: mook7
Category:

less

Transcript and Presenter's Notes

Title: By%20Juthawut%20Chantharamalee


1
Operating System 2
  • By Juthawut Chantharamalee

Suan Dusit Rajabhat University (Computer Science)
2
????? 2 ???????????????????? (Memory Management)

????? 2
Suan Dusit Rajabhat University (Computer Science)
3
???????????????????? (Memory Management)
  • ??????????????????????????????????????????????????
    ????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????? ???????????????????????????????????????
    ???? ??????????????????????????
    ??????????????????????????????????????????????????
    ???????? ?????????????????????????????????????????
    ??? 2 ???? ?????? 1.??????????????? (Main
    Memory) 2.????????????????? (Virtual Memory)
    ???????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??? ????????? 2.1

Suan Dusit Rajabhat University (Computer Science)
4
??????????????? (Main Memory)
  • ??????????????????????????? (large array)
    ??????????????????????? (words) ??????? (bytes)
    ?????????????????????????? (address)
    ????????????? ????????????????????????????????????
    ???????????????????????????????????? (a typical
    instruction-execution cycle) ?????????????????????
    ???? (Central Processing Unit CPU)
    ?????????????????????????????????????????????????
    ??????????????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
5
?????? 2.1.????????????????????????????????????
(Main Memory)
Suan Dusit Rajabhat University (Computer Science)
6
????????????????? (Virtual Memory)
  • ???????????????????????????? (Process)
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????? ??????????????????????????????
    (Share files) ??????????? (Address Space)
    ????????????????????????????????????????????
    ????????????????????????????????????????????????
    ? (Physical Memory)

Suan Dusit Rajabhat University (Computer Science)
7
?????? 2.2 ??????????????????????????????????????
(Virtual Memory) ???????????????????????
(Physical Memory)
Suan Dusit Rajabhat University (Computer Science)
8
??????????????????? (Address Binding)
  • ??????????????????????????????????????????????????
    ????????????????????????????? ????????????????????
    ??????????????????????????????????????????????????
    ???????????????? ?????????????????????????????????
    ????????????????????????? (input queue)
    ??????????????????????????????????????????????????
    ?????????????????????????????????????
    ??????????????????????????????????????????????????
    ? 00000 ???????????????????????????????? ???????
    ??????? (Absolute address) ???????????????????????
    ?????? ???????????????????????? (Relative
    address) ?????????????????? ??????????????????????
    ????

Suan Dusit Rajabhat University (Computer Science)
9
??????????????????????????????????????????????????
??????????????????????????????????????????????????
???
  • 1.??????????????? (Compile time) ???
    ??????????????????????????????????????????????????
    ?????????????????? (Compiler) ????????????????????
    ?????????????? (Absolute Code) ???????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????? ??????????????????????
    ????????? ???????????????????????????????
    (Recompile) ????????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
10
??????????????????????????????????????????????????
??????????? ??????????????????????????????????????
????
  • 2.???????????? (Load time) ???????????????????????
    ??????????????????????????????????????????????????
    ???????????????????????????????????????
    (Relocation code)?????????? ??????????????????????
    ??????????????????????????????????????????????????
    ?????????????????????????????????????????
    (Absolute Code) ?????????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????????? ???????????????????????????????
    ?????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
11
??????????????????????????????????????????????????
??????????? ??????????????????????????????????????
????
  • 3.???????????????? (Execution time)
    ??????????????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????????????????????? ???????????????????
    ???????????????????????????????????????? (Run
    time) ????????????????????????????????????????????
    ??????????????????????? ??????????????????????????
    ?????????????????

Suan Dusit Rajabhat University (Computer Science)
12
?????? 2.2 ???????????????????????????? (Address
Binding)
Suan Dusit Rajabhat University (Computer Science)
13
??????????????????????????????????????????????????
???(Logical- Versus Physical-Address Space)
  • ????????????????????????????????????????? 2
    ????????? 1.???????????????????
    ??? (Logical Address Space) ??????????????????????
    ?? ????????????? (Virtual Address)
    ???????????????? (Generate) ????????????????????
    (CPU) ?????????????????????????????
    ????????????????????????????????? (Logical
    Address Space) ?????????????????????????
    2.??????????????????????? (Physical Address
    Space) ?????????????????????????????????? (Memory
    Unit) ?????????????????? (Corresponding)
    ??????????????????? (Logical Address) ????

Suan Dusit Rajabhat University (Computer Science)
14
?????? 2.3 ??????????????????????????????????????
?????? (Memory Management
Unit MMU)
Suan Dusit Rajabhat University (Computer Science)
15
??????????????? (Dynamic Loading)
  • ??????????????????????????????????????????????????
    ??????? (Physical Memory) ????????????????????
    ????????????????????????????????????????????????
    (Process) ????????????????????????????????????????
    (Physical Memory) ???????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????????? ???????????????????????????????
    ??????? ??????????????????????????????????????????
    ????? ?????????????????????????????????
    ??????????????? (Dynamic Loading)
    ???????????????????????????????????? (Routine)
    ???????????????????????? (Call)
    ???????????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
16
??????????????? (Dynamic Loading)
  • ?????????????????????? (Main Program)
    ???????????????????????????????????????????
    ??????????????????????????? (Routine)
    ???????????????????????????????????? (Routine
    First) ????????????????????????????????????????
    ?????????????????????????????? ???????????????????
    ??????? (Relocation linking Loader)
    ??????????????????????????????????????????????????
    ???? (Address Table) ?????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????????????????????????
    ?????????????????????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
17
???????????????????? ???????????????????????
(Dynamic Linking and Shared Libraries)
  • ???????????????????????? (Dynamic Linking)
    ???????????????????????????????? (Dynamic
    Loading) ?????????????????????????????????????????
    ?????????????????????????????????????????
    (Subroutine Libraries) ???????????????????????????
    ?????? ????? (Stub) ??????????????????????????????
    ???? ?????????????????????????????????????????????
    ???????????????????????????????
    ?????????????????????? (Stub) ????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????? ??????????????????????
    ?? (Dynamic Linking)

Suan Dusit Rajabhat University (Computer Science)
18
???????????????????? ???????????????????????
(Dynamic Linking and Shared Libraries)
  • ?????????? ???????????????????????????????????????
    ????????????????????????????????????? (Library
    code) ???????????????????????????? .dll
    ?????????????????????????????????? (Update
    library) ?????????????????? (Old
    Library) ??????????????????? (New Library)
    ???????????????????????????????????????????
    ????????????????????????????????? .dll
    ???????????????????? ??????????????????????????
    (Shared Libraries)

Suan Dusit Rajabhat University (Computer Science)
19
??????????? (Overlay)
  • ??????????????????????????????????????????????????
    ?????????????? ???????????????????????????????????
    ????????????????????? (Overlay)
    ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????
    ?????????????????????????????????????????????
    (Overlay Driver) ?????????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????

Suan Dusit Rajabhat University (Computer Science)
20
???????? (Example)
  • ??????????????????????????????????????????????????
    ?? 2 ?????? ???????????? 1 ???????????????????????
    ?????? (Symbol Table) ?????? 2 ???????????????????
    ??????????????? (Machine-language code)
    ??????????????????????????????????????????????????
    ???????????????????????????????????????? 1
    ????????? 1 ?????????????????????????? (Symbol
    Table) ?????????????????? (Common Routine)
    ?????????????????????????????????
    ????????????????????????????????????????????
  • ????????????????? 1 (Pass 1) 70
    KB ????????????????? 2 (Pass 2) 80
    KB ?????????????? (Symbol Table) 20
    KB ??????????????? (Common Routine) 30 KB

Suan Dusit Rajabhat University (Computer Science)
21
???????? (Example)
  • ??????????????? ??????????????????????? (Two
    Overlays) ??? Overlay A ??????????????????????
    (Symbol Table) ????????????????? (Symbol Table)
    ??????????????? (Common Routine)
    ???????????????????? 1 (Pass 1) ???? Overlay B
    ??????? (Symbol Table) ??????????????? (Common
    Routine) ???????????????????? 2 (Pass 2)
    ??????????????????????????????????? (Overlay
    Driver) ???? 10 KB ????????????????? Overlay A
    ??????????????????????????? 120KB ????????????
    ??????????????????????????????????????????????????
    ???????????????? Overlay B ???????????????????????
    ???? 130KB ??????????????? (Overwriting) Overlay
    A ???????????????? 2.4 ??????????????????????
    ?????????????????????????????????????????? 150KB
    ???

Suan Dusit Rajabhat University (Computer Science)
22
?????? 2.4 ???????????????????????????????????????
??????????????? 1 - 2 ?????????????????
(Overlays for two-pass assembler)
Suan Dusit Rajabhat University (Computer Science)
23
????????????????????????????? (Memory Strategy)
  • ??????????????????????????????????????????????????
    ????????? ????????????????????????????????????????
    ????????????????? ??????????????????????
    ??????????? 3 ???? ??????
  • 1.?????????????? (Fetch Strategy)
    ???????????????????????????????????????????????
    ?????????????????????????????????????????????
    ??????????? 2 ???? 1.1 Demand Fetch
    Strategy ??? ?????????????????????????????????????
    ??????????????????????????????????????
    1.2 Anticipate Fetch Strategy ???
    ??????????????????????????????????????????????????
    ?????????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
24
????????????????????????????? (Memory Strategy)
  • 2. ????????????? (Placement Strategy)
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????? ??? (Hole)??????????????????????????????
    ??? ????????????????????????????????????????
  • 3. ???????????????? (Replacement Strategy)
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??? (Main Memory) ?????????????????? 5 ??????????
  • 2.1 ???????? (Random) ??? ????????????????????????
    ????????? ????????????????????????????????????????
    ????????? 2.2 ????????????????????
    (First-in, First-out FIFO) ???
    ??????????????????????????????????????????????????
    ?????????????????????????

Suan Dusit Rajabhat University (Computer Science)
25
????????????????????????????? (Memory Strategy)
  • 2.3 NFU (Not Frequency Use) ???
    ??????????????????????????????????????????????????
    ????? ????????????????????????????????????????????
    ??????????????????????????????????????????????
    ???????????????????????????????????? 2.4
    LRU (Lead Recently Use) ??? ??????????????????????
    ???????????????????????? ?????????????????????????
    ????????????????????????????????????????????
    2.5 NRU (Not Recently Use) ???
    ??????????????????????????????????????????????????
    ??????? 2 ????????????? ?????????? (Reference
    Bit) ??????????? (Modify Bit) ??????????????? 0
    ??????????????????????????????????????????????? 1
    ???????????????

Suan Dusit Rajabhat University (Computer Science)
26
????????????? (Swapping)
  • ??????????????????????????????????????????????????
    ????????????????????????? ????????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??? (Backing Store) ???????????????? 2.5 ??????
    Priority-base Scheduling Algorithms ?????????????
    Higher-priority process ??????????????????????????
    ??????????????? ??????????????????????????????????
    ????????? Lower-priority process
    ??????????????????????????? Higher-priority
    process ????????????????? ???????????
    Lower-priority process ??????????????? (Swap
    back) ???????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
27
????????????? (Swapping)
  • ?????????????????????????????????????????
    ??????????? (Roll in) ??????????? (Roll out)
    ??????????????????????????????????????????????????
    ???????????-??? ????????????????????
  • 1. ????????? (Process) ??????????????????
    2. ????????? (Process)
    ?????????????????????? I/O 3. ?????????
    (Process) ??????????????? (Quantum Time)
    ?????????????????????????????????? (Swapping)
    ?????????????????????????????????????? (Transfer)
    ??????????????????????????????????????????????????
    ?????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
28
?????? 2,5 ???????????????????? 2 ??????
???????????????????????????????????
(Swapping of two processes using a disk as a
backing store)
Suan Dusit Rajabhat University (Computer Science)
29
??????????????????????????????????? (Continues
Memory Allocation)
  • ??????????????????????????????????????????????????
    ????????????????????????????????????????????
    ???????????????????? (Process) ???????????????????
    ??????????????????????????????????
    ??????????????????????????????????????????????????
    ????????????????????????????????????????????
    ???????????????????????????????? (Main Memory)
    ???????????????? 2 ???? ??? ??????????????????
    (High Memory) ????????????????????????????????????
    ???? (User) ??????????????????????? (Low Memory)
    ????????????????????????????? (Operating System)
    ???????????????????? 2.6

Suan Dusit Rajabhat University (Computer Science)
30
?????? 2.6 ??????????????????????????????
(The Level of Main Memory)
Suan Dusit Rajabhat University (Computer Science)
31
??????????????????????????????????? (Continues
Memory Allocation)
  • ?????????????????????????????????????????? (Main
    Memory) ???????????????????????
    ??????????????????????????????????? (User
    Processes) ???????????????????????????????????????
    ?????? ?????????????????????????????????????
    (Register) ????? ?????????????????????????????????
    ?????????????????????????? (Operating System)
    ?????????????????? (User) ????????????????? ????
    1. ?????????????????????
    (Relocation Register) ????????????????????????????
    ?????????????????????????????????? (Smallest
    Physical)

Suan Dusit Rajabhat University (Computer Science)
32
??????????????????????????????????? (Continues
Memory Allocation)
  • 2. ???????????????? (Limit Register)
    ??????????????????????????????????????????????????
    ??????? (Logical Address) ????
    ????????????????????? (Relocation Register)
    100040 ???????????????? (Limit Register)
    74600 ??? Logical Address
    lt Limit Register)
    ????????????????????????? (Main Memory Unit MMU)
    ????????????? (Map) ??????????????? (Logical
    Address) ???????? (Dynamically)
    ?????????????????????????????????????????
    (Relocation Register) ????????????????????????????
    ????????? (Main Memory) ????? ????????????????
    2.7

Suan Dusit Rajabhat University (Computer Science)
33
?????? 2.7 ????????????????????????????????????
???????????????????????????????????????
(Hardware Support for relocation
and limit registers)
Suan Dusit Rajabhat University (Computer Science)
34
???????????????????????????????????????? 2 ??????
??????
  • 1.???????????????????????????????????
    (Single-partition Allocation) ????????????????????
    ????????????????? ????????????????????????????????
    ???????????????????????????????? (Low Memory)
    ??????????????????????????????????????????????????
    ??? (High Memory) ????????????????????????????????
    ????? (Relocation Register) ??????????????
    (Process) ????????????????????????????????????????
    ????????????????????? (Limit Register)
    ?????????????????????????????????????????????????
    (Logical Address) ????????????????????? (Logical
    Address) ???????????????????????????? (Limit
    Register) ????

Suan Dusit Rajabhat University (Computer Science)
35
???????????????????????????????????????? 2 ??????
??????
  • 2.??????????????????????????????????
    (Multiple-partition Allocation)
    ??????????????????????????????????? Process
    ??????????????? 2 ?????? ??????2.1
    ??????????????? (Fixed Partition)
    ???????????????????????????????????????? ?
    ?????????? (Partition) ???????????????????????????
    ????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????? ?????????????????
    ??????????????????????????????????????????????????
    ????????????????????????????????????????????????
    (????????????????????????????) ???????????????????
    ??????????? Internal Fragmentation
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ????????????????

Suan Dusit Rajabhat University (Computer Science)
36
???????????????????????????????????????? 2 ??????
??????
  • 2.2 ??????????????? (Dynamic Partition)
    ??????????????????????????????????
    ???????????????????????????????????????? ???
    (Hold) ???????????????????????????????????????????
    ??? ??????????????????????????????????????????
    (Hold) ?????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????????????????? (Free Partition Hold)
    ????????????????????????????????????
    ?????????????????? (Job Queue) ???????????????????
    ???????????? (Use time) ????????????????
    ????????????? 2.8

Suan Dusit Rajabhat University (Computer Science)
37
?????? 2.8 ??????????????????????????????
(Dynamic Partition)
Suan Dusit Rajabhat University (Computer Science)
38
????????????????????????????????????????
(Dynamic Storage-allocation Problem)
  • ??????????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????? ??? (Hold) ??????????????????????????
    (Placement) ??????????????????????????????????????
    ??????????????????????????????????????????????????
    ? ?????? - First fit
    ????????????????????? (First Hold)
    ??????????????????????????????????????????????????
    ????????????????? ????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
39
????????????????????????????????????????
(Dynamic Storage-allocation Problem)
  • - Best fit ??????????????????????????????????
    (smallest Hold) ??????????????????????????????????
    ????????????????????????? ????????????????????????
    ????????????????????? (Hold) ???????
    ??????????????????????????????????????????????????
    ???????????????????????????????????????????????
    (smallest leftover hold) ?????????????????????
    - Worst fit ????????????????????????????
    ???? (Largest Hold) ??????????????????????????????
    ????????????????????????????? ????????????????????
    ????????????????????????? (Hold) ???????
    ?????????????????????? Best fit
    ????????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
40
?????? 2.9 ????????????????? (Placement) ????????
Suan Dusit Rajabhat University (Computer Science)
41
??????????????????????????????????????????????????
  • 1. ????????? (Compression) ???????????????????????
    ? (Defragmentation) ??????????????????????????????
    ???????? ?????????????????????????????????????
    ??????????????????????????? ??????????????????????
    ??????????????????????????????????????????????????
    ????? (Dynamic Allocation) ???????????????????????
    ??????????????????????? ??????????????????????????
    ???????????? 2.
    ??????????????????????????????? (Logical Address)
    ???????????????????????????? (Noncontiguous)
    ??????????????????????????????????????????????????
    ????? (Allocated Physical Memory)
    ??????????????????????????????????????????????????
    ???

Suan Dusit Rajabhat University (Computer Science)
42
??????????? (Paging)
  • ??????????? (Paging) ?????????????????????????????
    ???????? ?????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????????????????????????
    ??????????????????????????????????????????????????
    ?? ??????????? 2 ?????? ?????? 1.
    ????????????????????????????? (Paging Model of
    Physical Memory) ?????????????????????????????????
    (Fixed-Size Block) ????????????????????? ????
    (Frames) ????????????????????????????????????
    ????????????????????????? 2 ????????????????? 512
    ??????? 16 MB ?????? ?????????????????????????????
    ???????

Suan Dusit Rajabhat University (Computer Science)
43
??????????? (Paging)
  • 2. ????????????????????????????
    (Paging Model of Logical Memory)
    ?????????????????????????????? (Block)
    ?????????????????????? ??? (Pages)
    ?????????????????????????????? ?????? 2.10
    ??????????????????????????????????????????????
    ???? ?????????????????????????????????????? (CPU)
    ?????????????? ??????? ???

Suan Dusit Rajabhat University (Computer Science)
44
??????????? (Paging)
  • 2.1 ?????????? (Page Number p)
    ???????????????????????? (Index)
    ????????????????????? (Page Table)
    ????????????????????????????? (Base Address)
    ????????????????????????????????? (Physical
    Memory)
  • 2.2 ????????? (Page Offset d) ???
    ???????????????????????? ?????????????????????????
    ??? (Base Address) ????????????????? (Page Table)
    ?????????????????????????????????????????????
    (Physical Memory)

Suan Dusit Rajabhat University (Computer Science)
45
?????? 2.10 ????????????????????? (Hardware
Paging)
Suan Dusit Rajabhat University (Computer Science)
46
?????? 2.11 ???????????????????????????????????
????????????????????????????? (Paging
model of logical and physical memory)
Suan Dusit Rajabhat University (Computer Science)
47
?????????????????????????????????? (Hardware
Support)
  • ?????????????????????????????????????????????
    (Page Table) ???????????? ???????????????????????
    ???????????????????? ?????????????????????????????
    ???????????? (Physical Memory) ???????????
    ???????????????????????? (Page Table)
    ??????????????????????????????????????? (Physical
    Address) ?????????????????????????????????????????
    ?? ???????????????????????????????????????????????
    ???????????????????????????? (Hardware Cache)
    ???????????????????????????? (Fast-Lookup)
    ???????????????????????????? Translation
    Look-aside Buffer (TLB)

Suan Dusit Rajabhat University (Computer Science)
48
?????????????????????????????????? (Hardware
Support)
  • ?????????????????????????????????????? (Physical
    Memory) ??????????????? ????????????? TLB
    ??????????????????????????????????? (High Speed
    Memory) ?????????????????????????????? ???
    ????????????????????? (Key) ?????????? (Tag)
    ????????????????? (Value) ????????????????????????
    ??????????????????? ??????????????????????????????
    ?? ????????????????????????????????????????????
    (Value Field) ?????????????????????
    ???????????????????????????????????
    ?????????????????????????????? ???????????????????
    ???????????????? TLB ?????????????????????????????
    ??????????? 64 ??? 1024 ???

Suan Dusit Rajabhat University (Computer Science)
49
?????? 2.12 ?????????????????????????
????????????? TLB (Paging hardware with Table
look-aside buffer)
Suan Dusit Rajabhat University (Computer Science)
50
?????????????????????????????????? (Hardware
Support)
  • ????????? TLB ???? ???????????????????????????????
    ???????????? (Flushed or Erased)
    ???????????????????????????????? ???????? TLB
    ??????????????????????????????????????
    ?????????????????? Wired Down ????
    ???????????????????????????????? (Kernel Code)
    ??????? ????????????????????????????????
    ????????????? (Page Numbers) ??????? TLB
    ??????????? ?????????????? (Hit Ratio) ????
    80 ????????????????????????? ????????????????????
    ?????????? TLB ??????? 80 ??????????????

Suan Dusit Rajabhat University (Computer Science)
51
?????????????????????????????????? (Hardware
Support)
  • ????????????? 20 Nano sec ?????????? ?? TLB ???
    100 Nano sec ??????????????????????? (Access
    Memory) ?????????????????????????? (Mapped-Memory
    Access) ????????? 120 Nanoseconds ???????????????
    (Page Numbers) ?????? TLB ?????????????????????
    (Page Numbers) ?? TLB ?????????????? 20 Nano sec
    ??????????????????????????????????????????????????
    ?????????????????? (Page Table) 100 Nano sec
    ????????????????????????????????????????????
    (Frame Numbers) ??? 100 Nano sec
    ????????????????????????????????????? 200 Nano
    sec

Suan Dusit Rajabhat University (Computer Science)
52
????????????????????????????????????????????????
(Effective Memory-Access Time)
  • Effective Memory-Access Time 0.80 X 120 0.20
    X 220 140 Nanoseconds
    ?????????? ???????????????? 40
    ??????????????????????? (?????? 100 ????
    140 ??????????) Ex ???
    98 ???????????????????????????????????
    ??????????????? Effective Memory-Access Time
    0.98 X 120 0.02 X 220 122
    Nanoseconds ?????????? ???????????????? 22
    ??????????????????????? (?????? 100 ???? 122
    ??????????)

Suan Dusit Rajabhat University (Computer Science)
53
????????????????????? (Memory Protection)
  • ??????????????? (Bits) ?????????????????????
    (Page Table) ?????????????????????????????????????
    ?????????????? ????-????? (Read-Write)
    ?????????????????????? (Read-Only)
    ??????????????????????? ???????????????
    (Associating Protection Bits) ?????????? ????
    ???????????????????? (Main Memory)
    ??????????????????????? 2 ??? ???
    1. ???????????? (Valid Bit)
    ??????????????????????????????????????????????????
    ???????????????????? ???????????????????????????

Suan Dusit Rajabhat University (Computer Science)
54
????????????????????? (Memory Protection)
  • 2. ??????????????? (Invalid Bit)
    ??????????????????????????????????????????????????
    ????????????????????? (Physical Memory)
    ????????????????????????? ????????????????????????
    ??????????????????????????????????????????????????
    ???? (Main Memory) ???????????????????????????????
    ?????????? (Swapped) ?????????????????????
    ????????????????????????????????????????
    ?????????? (Page Fault) ????????????????????????
    ??????????????????????????????????????????????????
    ????????? (Invalid Bit) ???????????????????
    (Valid Bit) ??????????????????????????????????????
    ?????????

Suan Dusit Rajabhat University (Computer Science)
55
?????? 2.13 ??????????????????????
????????-?????????????????? (Valid
(v) or Invalid (i) Bit in a Page Table)
Suan Dusit Rajabhat University (Computer Science)
56
???????????????? (Shared Pages)
  • ??????????????????????????????????????????????????
    ??? (Time-Sharing) ???????????????????????????????
    ??????????????????????????????????
    (Non-Self-modifying Code) ?????????????????????
    ??????????????????? ?????????????????????
    Reentrant Code ???? Pure Code
    ?????????????????????????????? (Logical Address)
    ???????? ?????????????????????? (Own Data Page)
    ?????????????

Suan Dusit Rajabhat University (Computer Science)
57
???????????????? (Shared Pages)
  • ?????? 2.14 ?????????????????????????????????
    ???????????????? 3 ?????? ??? P1, P2, ??? P3
    ???????????????????? Text Editor ????????? Page
    0, Page1 ??? Page3 ???????????????????????????????
    ? 3, 4 ??? 6 ?????????????????????????????????????
    ????? 40 ?? ?????????????????? Text Editor
    ?????????????? 150 KB ?????????????????????????
    50 KB ????????????????????????????????????????????
    ????????????????????????????????????????????????
    40 x (150 50) 8000 KB

Suan Dusit Rajabhat University (Computer Science)
58
???????????????? (Shared Pages)
  • ??????????????????????????????????????????????????
    ????????????????? 150 (40 x 50) 1250 KB
    ???????????????????????????????????????????
    ??????????????????????????????????????????????????
    ?????????????????????????????????? (Shared Pages)
    ??? ??????????????????????????????????????????????
    ?????????????????????????????????????????
    ????????????????????????????????? ???? ??????????
    (Compilers) ???????????????????????? (Run-Time
    Libraries) ????????????? (Database System)
    ???????

Suan Dusit Rajabhat University (Computer Science)
59
?????? 2.14 ????????????????????????????????
???? (Sharing of Code In a
Paging Environment)
Suan Dusit Rajabhat University (Computer Science)
60
???????????????????? (Memory Protection)
????????????????????????????????? 3 ?????? ??????
  • 1.????????????????????? (Hierarchical Paging)
    ?????????????????????????????????????????????
    ?????????? (Logical-Address Space) ???????? (232
    ??? 264) ?????????????????????????????????????????
    ????????????????????????? (Page Table) ?????????
    ?????????????????????????????? 2 ????? (Two-Level
    Page Table) ?????? 1.1 ?????????? (Page Number)
    1.2 ????????? (Page Offset)

Suan Dusit Rajabhat University (Computer Science)
61
???????????????????? (Memory Protection)
????????????????????????????????? 3 ?????? ??????
  • Ex ??????????????????? 32 ??? ?????????????????
    (Page Size) 4 KB ?????????????????????????? 2
    ???? ??? ??????????? 20 ??? (Bits) ??????????????
    (Page Number) ????????????????? 12 ??? (Bits)
    ????????????? (Page Offset) ??????????????????????
    ???????

Suan Dusit Rajabhat University (Computer Science)
62
?????? 2.15 ??????????????????????????????
? 2 ????????? 32 ??? (Address Translation
for a Two-Level 32-Bit Paging Architecture)
Suan Dusit Rajabhat University (Computer Science)
63
???????????????????? (Memory Protection)
????????????????????????????????? 3 ?????? ??????
  • 2.???????????????????? (Hash Page Table)
    ??????????????????????????????????????
    ??????????????????????????????? 32 ???
    ???????????????????????????????????????
    (Virtual-Page Number) ?????????????? (Elements)
    ????????????????????????????? (Link List)
    ???????????????????????????????????????????
    ??????????????????????????????????? 2.1
    ??????????????????? (Virtual-Page Number)
    2.2 ??????????????????????????? (Page Frame)
    2.3 ?????????????? (Pointer)
    ?????????????????????????????? Link List

Suan Dusit Rajabhat University (Computer Science)
64
?????? 2.16 ???????????????????????? (Hashed Page
Table)
Suan Dusit Rajabhat University (Computer Science)
65
???????????????????? (Memory Protection)
????????????????????????????????? 3 ?????? ??????
  • 3.???????????????????? (Inverted Page Table)
    ??????????????????????????????????????
    ??????????????????????? Page Table
    ????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ??? (Virtual-Address of Page) ????????????????????
    ???????? (Real Memory) ????????? 2.17
    ?????????????????????? (One Page Table)
    ???????????????????????????? ?????????????????????
    ?????? (Virtual-Address of Page) ????????????
  • lt process-id, page-number, offset gt

Suan Dusit Rajabhat University (Computer Science)
66
?????? 2.17 ????????????????????? (Inverted Page
Table)
Suan Dusit Rajabhat University (Computer Science)
67
??????????? (Segmentation)
  • ??????????????????????????????????????????????????
    ????????? ??????????????????????????????
    ?????????????????? Segment ???????????????????????
    ??????????? (Segments) ??????????????????? ????
    ??????????? ????????? ???????? ?????? ????? ?????
    ?????????????? ??????????? ???????????????????????
    ?????????????? ????????????? 2.18

Suan Dusit Rajabhat University (Computer Science)
68
?????? 2.18 ????????????????????????
(Segmentation)
Suan Dusit Rajabhat University (Computer Science)
69
??????????? (Segmentation)
  • Ex ????????? 2.19 ?????????????????????
    (Segment) ??????? 5 ???? (Segment)
    ???????????????? 0 ??? 4 ???????????? (Segment)
    ???????????????????????????????????? (Physical
    memory) ??????????????????????????????????????
    ????????????????????????????????????????? (Base)
    ????????????????????????????? Limit
    ??????????????? 1.???????? Segment 2
    ????????? 400 ?????????????????????? (Base of
    Segment) ??? 4300 ????????????????????????????????
    ?? 53 ??? Segment 2 ??????????????? (Map)
    ??????????????????????????????????????????????????
    ???????? 4300 53 4353

Suan Dusit Rajabhat University (Computer Science)
70
??????????? (Segmentation)
  • Ex 2.???????? Segment 3 ????????? 1000
    ?????????????????????? (Base of Segment) ??? 3200
    ?????????????????????????????????? 852 ???
    Segment 3 ??????????????? (Map)
    ??????????????????????????????????????????????????
    ???????? 3200 852 4052 3.????????
    Segment 0 ????????? 1000 ??????????????????????
    (Base of Segment) ??? 1400 ???????????????????????
    ??????????? 1222 ???? Segment 0 ??????????????
    1000 ???? ???????????????????????????????????????
    (Tab) ????? Segment ????? ????????????????????
    (Bytes Long) ?????????????????????????????????????
    ??????

Suan Dusit Rajabhat University (Computer Science)
71
?????? 2.19 ?????????????????????????????
(Segmentation Table)
Suan Dusit Rajabhat University (Computer Science)
72
???? (Conclusion)
  • ???????????????????? (Memory Management)
    ?????????????????????????????????
    ??????????????????????????????????????????????????
    ????????????? (Multiprogramming) ???????????????
    ??????????????? (Hardware provided)
    ??????????????????????????????????????????????????
    ??????????????????????????????? (Logical memory)
    ??????????????????????? (Physical memory)
    ??????????????????????? (CPU) ???????????????
    (Generated) ?????

Suan Dusit Rajabhat University (Computer Science)
73
???? (Conclusion)
  • Memory Management Algorithms ?? 4 ??? ???
    1. ????????????????????? (Contiguous
    allocations) 2. ??????????? (Paging)
    3. ??????????? (Segmentation)
    4. ????????????????????????????????????????
    (Combination of Paging and Segmentation

Suan Dusit Rajabhat University (Computer Science)
74
???? (Conclusion)
  • Memory Management Strategy 1.
    ????????????????????? (Hardware Support)
    ??????????????????????????????????????????????????
    ??????? (Paging) ?????????????? (Segmentation)
    ??????????????????????????????????????????????????
    ????????????????? 2.
    ??????????? (Performance) ????????????????????????
    ???????????????????????????????
    ??????????????????????????????????????????????????
    ? (Logical memory) ???????????????????????
    (Physical memory) ??????? ????????????????????????
    ?????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
75
???? (Conclusion)
  • Memory Management Strategy 3.
    ???????????????????? (Fragmentation)
    ???????????????????????????????
    (Multiprogramming) ????????????????????????????
    ????????????????????????????????????????????????
    Process ????????????????????????????
  • 4. ?????????????? (Relocation) ???????????????????
    ?????????????? ???????????????? (Process)
    ??????????????????????????????????????????????????
    ??????????????? (Fragmentation) ?????????????????
  • 5. ??????? (Swapping) ??????????? Process
    ????-??? ?????????????????? ??????????????????????
    ???????????????????????????????

Suan Dusit Rajabhat University (Computer Science)
76
???? (Conclusion)
  • Memory Management Strategy 6.
    ???????????????? (Sharing) ???????????????????????
    ?????????????????????????????????
    ???????????????????????? ?????????????? (Process)
    ?????????????????????????????
  • 7. ?????????? (Protection) ???????????????????????
    ???????? ?????????????????????????????????????????
    ???????? ?????????????????????????????????????????
    ??? ???????????????? ?????????????????????????

Suan Dusit Rajabhat University (Computer Science)
77
The EndLesson 2
Suan Dusit Rajabhat University (Computer Science)
Write a Comment
User Comments (0)
About PowerShow.com