????Session Init
????UpStart ??????????????????????????????д??????μ?????? Linux ???а滹?????? UpStart ???????????? Ubuntu Raring ?汾?У???? UpStart ???????????????????? ???????????????? Session ????Session ????????????????????????????????????????????????????????????????????????? ?????????????????÷?????????????????????????????????????????????????????????????????????????ó???????????????Щ?????????????????????????????????????? Session Init?? ?????? Linux ???????????????????????ν??檔????????£??????????????????????????????? Shell????? shell ??????????????? shell ????????????????е?????????????~/.bashrc?????????Щ????м?????????е??????????????????????????????е??????????á? ????ν????£???????????Щ?????????????????????? shell ?????????????????檔????????????滷???????????ɡ? ??????滷?????? window manager??panel ????????Щ??????/usr/share/gnome-session/sessions/????????????????????Щ????????ó??????????????????????????????棬???? system monitors??panel applets??NetworkManager??Bluetooth??printers ????????????????Щ????????????????????????????????????????????????????????????????? gnome-session ??ɡ????????£? ?? Ubuntu ????????????? Ubuntu ??ν?????????????(Display Manager)lightDM ??? Xsession??Xsession ??????? gnome-session??gnome-session ????????????????????????????? desktop session??
????? 2.??? desktop session ???????
????init
????|- lightdm
????|   |- Xorg
????|   |- lightdm ---session-child
????|        |- gnome-session --session=ubuntu
????|             |- compiz
????|             |- gwibber
????|             |- nautilus
????|             |- nm-applet
????|             :
????|             :
????|
????|- dbus-daemon --session
????|
????:
????:
??????????????Щ????? sysVInit ????????Щ??ú?????????????????????????????????????????????????????????????????? update-notifier ?????÷???????????????·?????????Щ·????????????μ???????????????????Щ?????·???????2???? DVD ????Update-notifier ?? gnome-session ???????????????????????£??????????????μ? DVD????? update-notifier ?????????????в????????????????????????????? DVD ??????????? update-notifier????????????????????С?????й????е?????????????????????????????????豸??????ζ????硣???? Update-notifier ????????????????Щ???????????? Network Manager?????????????л??????豸???????????? Network Manager ?????????????????????????? backup manager ???????????棬?????????????????????????????? ?? UpStart ???????????????????????????????Щ??????????????????????????? Network Manager????????????????????????????磬?????????????????? ???????????? UpStart ???????????????
????? 3.???? Upstart ?? Desktop session init ????
????init
????|- lightdm
????|   |- Xorg
????|   |- lightdm ---session-child
????|        |- session-init
????# <-- upstart running as normal user
????|             |- dbus-daemon --session
????|             |- gnome-session --session=ubuntu
????|             |- compiz
????|             |- gwibber
????|             |- nautilus
????|             |- nm-applet
????|             :
????|             :
????:
????:
????UpStart ???
??????????????????? Upstart ????á??????????????????????? MySQL ??????????????????????α?д?????????????????? UpStart ???????????????????? MySQL ???? ???????????????????????????????? Upstart ???????????????ú????????????????????????
???????????????????? UpStart ??
????????????????????????????????????д?????????????Щ???????????????????????г????????????????????????????????????????????д????????????? Upstart ????????????????????????????? Upstart ????????????м??????????????????ù???????????? Upstart ???е????м??? Upstart ??????????????????????????????????仯?????л????????????????????????????????? ??????? Linux ???????????????м??????? SysVInit?????????????Linux ???????????????????? SysVInit ????????????????? UpStart ?????μ????????????????? Debian ?? Ubuntu ?????????????????? SysVInit ?????м?????????????????????????? ??? Upstart ???????????м?????????????????? UpStart ??????????????????????????????? UpStart ?????μ??????????? ????????? ????????? UpStart ??????????
????? 4.UpStart ???????

????image004 ?????????? GRUB ???????????????????????????????????????????????????????? pid ? 1 ?? init ??????? UpStart ????? Upstart ????????????Щ???????????????????????”startup”???????????ú???????????????????????????????????”startup”????? ??????????”startup”??????????????????????????? mountall??mountall ???????????????????????????????????????mountall ????????????????local-filesystem??virtual-filesystem??all-swaps?? ???? virtual-filesystem ??????? udev ??????????????? udev ???? upstart-udev-bridge ???????Upstart-udev-bridge ???? net-device-up IFACE=lo ?????????????? IP ?????????????????????? mountall ??????У?????? filesystem ????? ????????? rc-sysinit ??????????? rc-sysinit ?? start on ???????£?
????start on filesystem and net-device-up IFACE=lo
???????? rc-sysinit ???? telinit??Telinit ??????? runlevel ????????????/etc/init/rc.conf?? rc.conf ???/etc/rc$.d/???μ????н?????? SysVInit ???????????????ο?????????????????? ?????????????????? ?????????????????д??????????????? UpStart ???Щ?????????з?????Щ????????????? UpStart ????? ??????????????????????? ??? Linux ?????????????????ε???????????????????????????д??????????????????????????????????????????????????? UpStart ????????????????????? UpStart ?? expect stanza????????????????????????? stanza ????塣 ????????????????á? ????????????????????????????????????????á???? UpStart ???????????????????????????????? ???????????? SIGHUP ????? UpStart ????????????? SIGHUP ?????????UpStart ????t??????????????Щ????????? ???????б???????3???????????????????????????????????? UpStart ??????”initctl reload”???????????÷??????????????????????á? ????????????????????е? PID??????? SIGHUP ???????? fork????????????????????? fork???????????????Σ??ο?????????????????????????? UpStart ?????????? PID ????????? ?????????? SIGTEM ?? shutdown?? ?????? SIGTERM ????UpStart ?????????????????????????????????????????????????????? SIGTERM ?????????Upstart ???????? SIGKILL ????
?????????????????? Upstart ????
????????????????????????????????????????????????????????????????á?UpStart ???????е????????????Щ?????????е??????initctl?????????????????????????й???? ????????? initctl list ???????й?????????
????$initctl list
????alsa-mixer-save stop/waiting
????avahi-daemon start/running?? process 690
????mountall-net stop/waiting
????rc stop/waiting
????rsyslog start/running?? process 482
????screen-cleanup stop/waiting
????tty4 start/running?? process 859
????udev start/running?? process 334
????upstart-udev-bridge start/running?? process 304
????ureadahead-other stop/waiting
?????????? Ubuntu10.10 ???????????????? Linux ???а???????????????????????????????????? rsyslog?????????????????????????????????? ?????????? initctl stop ????????????е???????? initctl start ???????????????????? initctl status ?????????????????initctl restart ?????????????initctl reload ????????????????е???????????????????????Щ????????? service ????????????
?????? 2.service ????? initctl ????????

???????????1???????????????????????????????????????UpStart ???????Щ??????????? initctl?????????Щ????????????????????? initctl ??????? reload??restart??start??stop ???????????????????????
????start <job>
?????????? initctl start <job>???????Ч???? ?Щ??????????????????(????? sysvinit)????????? runlevel ??/sbin/runlevel ????
????$runlevel
????N 2
???????????????????????м???? 2??????????????????м???????????????????????????м??????????????????м??? ????????????????????????м?????? ?? Upstart ???У???????/etc/init/rc-sysinti.conf ?е? DEFAULT_RUNLEVEL ????????????????????????м????????? sysvinit ???????????????????????????? ?????Щ?? UpStart ??????С????????????????? UpStart ??????? UpStart ?????????? init-checkconf ?? upstart-monitor ????????? initctl ?? emit ??????????з???????????
????#initctl emit <event>
??????????????? UpStart ?????????
????Upstart С??
?????????????UpStart ?????? SysVInit ????????????? Linux ???а????????????? SysVInit?????????а?????? UpStart?????? Ubuntu?????????Щ???? Fedora??????????????? systemd ?? init ????Systemd ?????? UpStart ????????????????? UpStart ????????????????????????????? systemd ?????????????????????????????? systemd??