Linux?????? - PowerPoint PPT Presentation

About This Presentation
Title:

Linux??????

Description:

Title: Linux Author: zm Last modified by: xlanchen Created Date: 3/27/2005 12:48:50 PM Document presentation format: – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 59
Provided by: zm3
Category:
Tags: linux | sigint

less

Transcript and Presenter's Notes

Title: Linux??????


1
Linux??????
  • ????????????
  • ???(0512-87161312)
  • xlanchen_at_ustc.edu.cn
  • Spring 2011

2
Linux????
3
??
  • ??????Unix??????????,????????????
  • ??????????????????

4
??
  • ????????
  • ????
  • ?????????????????????????
  • ???????????????
  • ??????????????????

5
???????
  • ?????????????????
  • ??????????(????????????????)
  • ????????????????????
  • ????????????????????????????????,????????????????
    ,????????,???????????,???????????????????????
  • ???????,????,??????,???????????????,??????????????

6
?????
  • ????????????
  • ?????????????????
  • ???????????????????
  • ?????????????????
  • ?????????????????

7
?????
  • ??
  • ?????????(????????????,?0,?????),?????????????????
    ??????
  • ????
  • ????????kill??sigsend?????????????????????????????
    ??????
  • ??
  • ???????ctrlc??????????????

8
  • ????
  • ??????????????????????shell??????????????
  • ????
  • ??????????????cpu???????????,?????????????
  • ??
  • ??????????????????????????????I/O??
  • ??
  • ????????,????????

9
Linux/i386??????
10
(No Transcript)
11
???? Ctrlc???
  • ?????console???ctrlc,????????
  • tty?????????????,?????????????SIGINT???
  • ???????????,???????????????????????
  • ??,?????????ctrlc???current????????????,?????????
    ?
  • ??????,???????????????

12
??????
  • ????,?????????????
  • ??????0??????????,?????????trap?
  • ??trap?????????????????????????
  • ?trap?????????????,????????,??????????

13
? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ?
14
???0?
traps_32.c
?do_trap? ????
????
15
?????????
?do_page_fault?
???
???
???
16
??????????
17
???????????
  • ????
  • ????????????????????????????????????
  • ????
  • ?????????????????????
  • ????????????,
  • ????????????????,
  • ??????

18
????
  • ????????????????????
  • ????,??????????????????,?????????????????,????????

19
  • ???????????????,????
  • ??????current????
  • ??????????????????,?????????????????
  • ????????????????,?????????,????????????????????,??
    ????????????????????

20
????????????
  • ????????????????
  • 1,?????????
  • ??????????????????
  • 2,???????????,???
  • Terminate?????
  • Dump?????,?????,????????????????core??

21
  • Ignore???????
  • Stop?????,????TASK_STOPPED
  • Continue???????,?????TASK_RUNNING????????
  • 3,????
  • ?????????????????,?????????????????

22
????????????
  • ??1?????
  • ????????????
  • ??????????,??????????
  • ??2????????????????????SIGKILL?SIGSTOP??????????
    ?????????????????

23
????????????
  • ??????????????
  • 1 ,?????/??????????,?ret_from_intr???????
  • ?????????????????(?10ms)
  • ???i386\kernel\entry_32.S?
  • 2,??????????????

24
????
  • thread_info??????

25
Flag????
26
????????????????????
27
  • ????Entry_32.S????????

?????????????????,??????
28
Entry_32.S????????
29
????????(???)???
30
(No Transcript)
31
(No Transcript)
32
???????????????
  • ????????????
  • ????????????,????????????
  • ???????????????????????
  • ??????????????
  • ???????
  • ?????????
  • ???????,?????????????????????????????????,????????
    ???????????

33
??????????
  • ??????????????????

????????,???????,??? Entry_32.S???????????????, ??
???????do_signal
Thread_info?flag
?????
???????
?????????????
????????
?????????????????
?????????????????? ?????
34
(No Transcript)
35
  • ?????

????
Byte Per Word
2?32???, ???sig0?32????? ????????
36
  • ?????signal_struct,?????????
  • ?????????????????????
  • ????????????

???
Wait4()????
???????????????
??????
37
  • ???????
  • Sigaction????

???
?????????
38
  • sa_handler,??????????,??????
  • 1,SIG_DFL,?0,????????
  • 2,SIG_IGN,?1,????????
  • 3,?????????????,?????????????

39
  • sa_flags?????,??????????
  • sa_mask????????,???????

???SIGCHLD,???????, ???????SIGCHLD??
???SIGCHLD,???????, ????????
?info
?????
?????????????????
??????????????
?????????,????????
40
(No Transcript)
41
  • ??????
  • ????????,???????shared_pending
  • ????????,pending

???????? ???????? ?????sigqueue
??????????
42
?????
  • ??????
  • ?????????????????????????????????????????????????
    ????????????

43
????
  • ????????????do_signal()???????????
  • ??
  • struct pt_regs regs //pt_regs??,?????
  • //?????????????

44
  • do_signal()??????????????????,????dequeue_signal()
    ??,????????action??????????
  • ???SIG_IGN(????)

45
  • ???SIG_DFL(????)

46
  • ??????????????,do_signal???handle_signal()????????
    ?

47
Handle_signal
  • ??????????????????,?????????????
  • Handle_signal??????,?????????????
  • ??
  • 1,???????????????
  • 2,??????????????????
  • 3,???????,????????,???????????

48
  • Linux???????
  • ????????????????????????????
  • ????????????????
  • ????????????,??sigreturn()????????????????????????
    ?
  • ??????

49
(No Transcript)
50
???????????
  • ????????,??????????
  • ??,??????????,TASK_INTERRUPTIBLE??TASK_UNINTERRUPT
    IBLE
  • ????,??????????,??????????
  • ?????
  • ??????
  • ??SA_RESTART????????,?????

51
  • ?????????????,?????????

52
????????????
  • kill(pid, sig)????
  • ????,???sys_kill()
  • ??pid??1,????0,??????????2,??0,?????????????3,
    ??-1,???????0??1???current?????????4,????-1,????
    ???????????????
  • ??sys_kill

53
  • sigaction(sig, act, oact)????
  • ?????????(??)????,???sys_sigaction()
  • ??sig,????????act,??????oact,??,????????
  • ??sys_sigaction

54
  • signal(sig, handler)????
  • ?????????handler,???sys_singal()

55
  • sigpending()?????????
  • Sigsuspend()??????TASK_INTERRUPTIBLE??

56
????????????
57
?copy_signal?
58
Thanks!
  • The end.
Write a Comment
User Comments (0)
About PowerShow.com