yaoki@sic.shibaura-it.ac.jp - PowerPoint PPT Presentation

About This Presentation
Title:

yaoki@sic.shibaura-it.ac.jp

Description:

Title: 2 Author: Yoshimitsu Aoki Isao Sasano Last modified by: sasano Created Date: 4/6/2004 12:52:47 AM Document presentation format – PowerPoint PPT presentation

Number of Views:62
Avg rating:3.0/5.0
Slides: 24
Provided by: Yoshi51
Category:
Tags: shibaura | sic | sigint | yaoki

less

Transcript and Presenter's Notes

Title: yaoki@sic.shibaura-it.ac.jp


1
???????????
????? 3???? ????
?8???9? ??????
  • ????????? ?
  • yaoki_at_sic.shibaura-it.ac.jp
  • sasano_at_sic.shibaura-it.ac.jp

2
???web page?
???web page http//www.sic.shibaura-it.ac.jp/
sasano/lecture/lecture.html
??????? sasano_at_sic.shibaura-it.ac.jp
3
???????
  • ????,????,????(????????)???????????????????
  • ????????????(??????????)
  • ???????????????????????????????
  • ?30??????

4
(No Transcript)
5
???????
????????????? Ctrl_C ?? Ctrl_Z ???? fg
?? ?????????? ???ps ef??????????????????????
kill -STOP ?????? kill -CONT ?????? kill INT
?????? ????
int main () int i0 for (1i)
sleep (1) printf ("hello d\n",i)
return (0)
6
?????????????signal()???????
?????????????
???????????????????????????
7
Signal??????????1
  • Ctrl-C????????????????
  • 2????????????

8
include ltsignal.hgt / signal???
SIGINT, SIG_DFL??????
/ include ltstdio.hgt / printf???
/ include ltunistd.hgt / sleep??? / void f
(int sig) printf("I got signal d\n",
sig) signal(SIGINT, SIG_DFL) int
main() signal(SIGINT, f) while(1)
printf("Hello World!\n")
sleep(1)
9
Signal??????????2
  • ?????????????????????????,15?????????????
  • ??????setsigint.c

10
??????????3
  • ???parent.c
  • ???????????????wait()??????????????????,??????????
  • ??
  • ????????????,??????????????????????,wait()????????
    ????, SIGCHLD???
  • ???????????????!

?????? parent_sig.c
11
???????
???parent_sig.c????????3??? ?????execl??????childA
, childB, childC???????execl????????? ????????????
??????????????(execl???????????? ?????????????????
??????????????????????????????????????????????????
)
fork????????3?????????????? ???????(main?????????
?????)?????????
12
??????????
signal???????????????????????????SIGKILL(9)?SIGSTO
P(19)????????????????
SIGKILL --- ??????? SIGSTOP --- ?????????
??????(root)??????????????????????????????????????
???
13
????????????
??????? ??????????(?????????????????? UNIX?OS?????
????)??????????? ????????????? ???(???????????)???
????? ?????????????????????? ????????????????????
????? 1???????????????????????? ??????(SIGKILL????
?)???????????
14
?????????????
????(??????????) CPU???????????
??????(CPU???????) --- CPU????????????????
???????? ??????(CPU?????) ??????
--- CPU????1??
??????????????? ??????????????????
???????????CPU??????????? ??????????????(?????
)??? ????(??????????) ????????????????????????????
????(kill??????????????) (??) ????????(?????)?UNI
X??????????????(signal????????????)
15
??????
  • ???????????????
  • ??????????????????
  • ?)?????????????????????
  • ????SIGALRM
  • ???????alarm(), pause() ???

16
alarm()?pause()
17
??????(alarm) ?1
  • setalarm.c
  • ??????????????
  • alarm()???,???????
  • ????(??????sec)
  • ./setalarm 10

18
????????????
kill ????????????
19
????????????
kill ???????????
kill??????????????????ID? ??????????ID????????????
? ??????????????ID???????????? ????????? ????ID
1?(init????)????????????????? (init???????????????
????????? ??????????????????????)
20
??? 2
  • sendsigint.c (???progexef.c???)
  • ????????????????
  • ???????????????,???????????
  • ????
  • ./sendsigint setsigint

?????
21
????1
?????????Ctrl-C?3???????????????????
22
????2
Ctrl-C???????????????? ??????????? (???????sleep?
???????????????Global???Ctrl-C?????????????)
23
????3
???????????????(??????ID?)????????????????????????
? kill(pid, 0)????? pid?1??32767????????
(??) ??????ID????????????????????? kill(pid,
0)?????????(????0???)?pid???? ???ID?????ID????
Write a Comment
User Comments (0)
About PowerShow.com