Linux???? - PowerPoint PPT Presentation

About This Presentation
Title:

Linux????

Description:

... Real time clock RTC Time stamp counter TSC Programmable interval timer, ... 8254 CMOS ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 34
Provided by: salm73
Category:

less

Transcript and Presenter's Notes

Title: Linux????


1
Linux????
  • xlanchen_at_2007.6.19

2
????
  • Linux?????????????
  • ??????????
  • ????time(), ftime()??gettimeofday()
  • ?????
  • settimer(), alarm()
  • ?????????????????????????????

3
????
  • ???????
  • Linux???????????
  • ???????????

4
???
  • 80x86?????,???????????????
  • ????Real time clock,RTC
  • ??????Time stamp counter,TSC
  • ????????Programmable interval timer, PIT
  • SMP??????APIC???

???? ????
?????????
5
????RTC
  • ??????PC???????
  • ???CPU???????
  • ????????????
  • ????PC??,??????
  • ?CMOS RAM??????????
  • ??Motorala 146818
  • ??IRQ8?????????,???2HZ8192??
  • ????????????

6
  • Linux???RTC???????
  • ????????/dev/rtc
  • ????????????
  • ????0x70?0x71??????RTC
  • ???????????????????

7
??????TSC
  • ??80x86??????
  • ?pentium???
  • 64?????
  • rdtsc?????????
  • ???????,???????????1
  • ??,????400MHz?????,TSC?2.5ns1

8
  • ????????????????,TSC??????????
  • ??,Linux??????????????????
  • calibrate_tsc
  • ???????????????(?50ms)????TSC?????????
  • ???????????????
  • ????????????????,?????????????,???????

9
????????PIT
  • ???????,??????????
  • ???8254 CMOS??
  • ??I/O??0x400x43
  • Linux?PIT???
  • 100Hz
  • ??IRQ0??????
  • ?10ms????????,???tick

10
  • Linux???????,????????????CPU???
  • ??calibrate_tsc()

11
Tick???
  • ?
  • ??????
  • ???????CPU????,???????????
  • ??????????,???????????????
  • Tick????????,??
  • ???????Alpha?Intel?IA-64??1ms????tick(??1024?????)
  • Rawhide Alpha???????(1200tick/?)

12
  • ?Linux?,???????????

??????????,???tick???
8254??????????
?8254??,??HZ?????
13
  • ?init_IRQ()??????????

??,??10ms??????tick
14
Linux???????
  • ????????,????????IRQ0????????,??
  • ???????????,?
  • ?????????????

15
????????
  • Linux?????time_init()??IRQ0?????????

?irq0??irq_desc???? ???????
16
???TSC,?????????????, ????????????
??????do_timer?????
17
do_timer
????,??????? ???????? 32? ?497????(???0)
????????????? ??
??????
??tq_timer??,?????????????
18
update_process_times
??????? CPU????? ??
????? ???????
19
TIMER_BH????
  • ?????????????????,?????????

?????????,?????????
????????
20
???????
  • ?????????????????????

???1970?1?1???0? ?????????
???????????? ????0999999
21
  • ??????,time_init()????????
  • ??get_cmos_time()

??coms?? ????,Linux????RTC,????????xtime
22
??xtime
23
????
  • ??????????,?????????????????
  • ??????????????????????
  • ?????????????????????????
  • ????????????????????

24
  • Linux????????
  • ?????
  • ????
  • ?????
  • ?????????
  • ???????????????,??????????????????????,?????,????
    ????

25
?????
  • ??????????????,????????????????
  • ????
  • ????512????????????

????
???????
????????????
26
????????????
  • ??????timer_list??
  • ??init_timer???,???????????????
  • ??????
  • ??add_timer?????????
  • ???????????,?????????,??????????

27
????????
  • ?????????????,????????,??????????
  • Linux??expires??,?????????

28
64, 64?????,???????????? ????? index?????????????
??????
(256),256?????,?????? ????????????? Index????????
?????
????????????? ???????????
??220-1???????? ?214?????????1??? ?64?
??226-1???????? ?220?????????1??? ?64?
??232-1???????? ?226?????????1??? ?64?
??214-1???????? ?256?????????1??? ?64?
29
run_timer_list
  • ????timer_bh()??run_timer_list()??????????,??
  • ???????
  • ????
  • ??run_timer_list()

30
????????
  • ??schedule_timeout()????????(??????)
  • ??schedule_timeout()??????????

31
????????????
  • time()
  • ???1970?1?1???0??????
  • ftime()
  • ???1970?1?1???0????????????????
  • ?????timeb
  • gettimeofday()
  • ???1970?1?1???0??????
  • ???sys_gettimeofday()

32
  • settimer()
  • ?????
  • ???????????(??0,?????)
  • alarm()
  • ??SIGALARM??

33
????????(??)
  • date??????????
  • ??time????
  • ??ctime??????
Write a Comment
User Comments (0)
About PowerShow.com