???? - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

????

Description:

Title: Author: tau Last modified by: tau Created Date: 10/21/2003 2:15:24 AM Document presentation format: (4:3) – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 38
Provided by: tau63
Category:
Tags: sosp

less

Transcript and Presenter's Notes

Title: ????


1
?????(1)
2
?????????
  • ????????????,???????????????????????????????
  • ???????,??
  • ??????(????)
  • ???????????(malloc, new)
  • ?????????

3
??????????
  • ????,???????????,???,?????????????,
  • ?????????????????????????????

?? ??????? ???? ???
???,??,12300????17300?????????????????
5000????????
4
???????????????
  • ????(allocation)???(deallocation)

1000????????
30000??????
????
30000??????
????
??
500????????
??30000??????
????
5
OS??????API
  • Unix brk, sbrk, mmap, etc.
  • Win32 VirtualAlloc, VirtualFree, MapViewOfFile,
    etc.
  • ????????

6
??????????????????????API???
  • C
  • ???????, ????, malloc/free, strdup, etc.
  • C
  • ???????, ????, new/delete, STL????,
  • Java, C
  • new, String?????????
  • Garbage Collection
  • Python
  • ???, ??, ????????, ???????????
  • Garbage collection
  • Perl, ????????,Visual Basic,

7
? OS?API???????????API???
  • malloc/free???OS??????????????????(??????)

OS?API (sbrk, brk, etc.)
malloc/ free
OS
????? ????? (malloc/free??)
????????
8
???????????????
  • ????????????????,???????????????????

512M (??????)
????
0
gcc
enshu.exe
enshu.exe
emacs
IE
?????
9
OS???????????????????
  • ???????
  • ?????????????????,?????????????????
  • ?????????????????????????
  • ???????
  • ?????????????????????
  • ?????????
  • ????????????????????,???????????????

10
OS???????????????
????????????????
???
????
L
0
????A??????
??????
OS
L
0
????B??????
L
0
????C??????
11
????(Virtual Memory)
  • ???OS???????????
  • ????
  • ????????
  • ??????????????
  • ???????????????(?????)?
  • ????????????????????

12
????
  • ???????
  • ??????????????????
  • ??????????????????????
  • ???????
  • ????????????????????????(???????????)
  • ?????????
  • ??????????????????????????

13
????
  • ????????????????????????????
  • ??????(CPU)?OS??????
  • ??????
  • CPU???
  • OS??????????API (??)

14
??????????
  • ??????
  • ?????????????(??????)?,?????????????????(??????)??
    ?????
  • ?????
  • ???????????????,???????????????????????????
  • ???????????????????????????????????

15
??????????????????
  • ??????
  • ????????(???????????)??????
  • ??????
  • ??????????????????

16
??????
  • ??????????????????????????
  • main() p 10000 printf(d\n, p)
  • ????????????????
  • ?????????????

??????10000 ?????
17
????????
  • ??????????????????
  • ????A?10000???????B?10000?????????
  • ??????????????,???????????(?????bit??OS???????)

0
232 1
???????? A
???????? B
???????? C
18
??????
  • ?????????????????????????
  • ??????????0 ?????? 1
  • (??)???????????????????

19
?????????(1)
  • ???????, ??????????,????????????????????(??????
    Address Translation)???

???????ID, ???????
?????
?Paddr?
?ASID, Laddr?
????????
CPU
20
?????????(2)
  • ???????????????????????????????
  • ????????????????????(????? paging)???????

21
  • ?????????CPU??????

22
?????????(Memory Management Unit MMU)
  • ?? ????????????????????,?????
  • ????????
  • ????????????????????
  • ??????
  • ???

MMU
23
???????????CPU???(??)
  • ??????? ?????? ????
  • ? load r1, r2 (store?????)
  • ????r1????????a??????

a??????? ????p????
??????
??(????)?? page fault
NO
a?read??
???????
??(????)?? protection fault
NO
YES
??????p???
24
???
  • CPU (MMU)???????????
  • ????(read/write? etc.)
  • ??????
  • ????????????
  • ????,????????????????????????????
  • ??????(???????)???

25
???
  • ???????,????,??????,?????????
  • ?????4096???,8192?????????????????

0x1000
?ASID, ??????? ? ????????? ?ASID, ???????? ?
??????????
0x2000
0x3000
0x4000
26
????????
  • ? 32 bit??????.4096??????
  • ???????ID, ???????????????????????

20 bit
12 bit
?????????
???????
???????
????
??????
0
Mapping?? (???????????)
1
27
?????
  • ????
  • ?????(readable)
  • ?????(writable)
  • ????????????
  • ??????
  • ??(reference) bit (read??set)
  • ??(dirty) bit (write??set)

28
Mapping??
  • ????????????, ??????????
  • ????????
  • ??????????????
  • ?????????????, ??
  • ??????????.??,
  • OS??????????????????????
  • CPU?????????(OS?????)

29
???????
  • ???????
  • ??????????
  • ?????????, ??????????????????????,?????????
  • TLB (Translation Lookaside Buffer)
  • CPU????, ??100???????????(??fully associative)
  • ?? ?????????????

30
????????????????????????
  • ??
  • 32 bit??????. 20 bit?????
  • 1????32 bit (?????????)
  • 220 4 n 4n MB
  • n ?????????? ? ????????????
  • ???????(?????)

31
??????????
  • ????????????????????????
  • ??????????

32
??????????
10 bit
10 bit
12 bit
a1
a2
o
a1
a2
33
64bit?????
  • Madhusudhan Tallurl, Mark D. Hill, Yousef A.
    Khalidi. A New Page Table for 64-bit Address
    Spaces. SOSP 1995

34
?????????CPU??? ??? (read)
  • read(a) p,attr lookup_TLB(a) if (!found)
    p,attr lookup_page_table(a) if (!found)
    raise page fault if (!attr.readable) raise
    protection fault if (!attr.user CPU_mode
    user) raise protection fault read p /
    in cache or memory / set reference bit for a

35
Write???
  • write(a, v) p,attr lookup_TLB(a) if
    (!found) p,attr lookup_page_table(a) if
    (!found) raise page fault if (!attr.writable)
    raise protection fault if (!attr.user
    CPU_mode user) raise protection fault
    write v to p / in cache or memory / set
    reference/dirty bit for a

36
???????????????????????
  • ?????
  • (?????????)???????????
  • ??????????
  • ????????????????????,??(??)?????????
  • ?????????????????,???????

???? ?????
??? ?????
???? ?????
37
????????????????????????
  • ?????????????
  • ?????,protection fault, access violation
Write a Comment
User Comments (0)
About PowerShow.com