OpenSource For You

This article explores how kernel functions and task scheduling are closely linked to time.

-

qime is vital for kernel programmin­g since many kernel functions are timeJdrive­nK pome are periodicI such as push and pull migration for loadJbalan­cingI the scheduler that runs queuesI or refreshing the screenK qheir IrHTuHnFiH­s arH fixHd (suFK as 100 WimHs SHr sHFond). TKH kernel schedules other functionsI such as delayed disk fLlI aW a rHOaWivH WimH in WKH IuWurH. For HxamSOH, WKH kHrnHO migKW sFKHduOH a floSSy dHviFH drivHr Wo sKuW oII aIWHr WKH floSSy drivHr moWor EHFomHs inaFWivH; WKis Fan EH 50 miOOisHFon­ds (say) Irom now or aIWHr FomSOHWion oI a FHrWain Wask. So WKH kernel horology is relativeK qhe kernel must also manage the system uptimeI and the current date and timeK

EvHnWs WKaW oFFur SHriodiFaO­Oy HvHry 10 miOOisHFon­ds arH driven by the system timerK qhis is a programmab­le piece of KardwarH WKaW issuHs an inWHrruSW aW a fixHd IrHTuHnFy. TKH interrupt handler for this timer is called the timer interrupt. TKH KardwarH SrovidHs a sysWHm WimHr WKaW WKH kHrnHO usHs Wo gaugH WKH Sassing oI WimH, wKiFK works oII an HOHFWroniF time sourceI such as a digital clock or the frequency of the SroFHssor. TKH sysWHm WimHr goHs oII (oIWHn FaOOHd hitting or popping) at a preJprogra­mmed frequencyI called the tick rate. then the system timer goes offI it issues an interrupt that the kernel handles via a special interrupt handlerK Because the kHrnHO knows WKH SrH-SrogrammHd WiFk raWH, iW knows WKH WimH EHWwHHn any Wwo suFFHssivH WimHr inWHrruSWs. TKis SHriod is called a tick. TKis is Kow WKH kHrnHO kHHSs WraFk oI EoWK ‘waOO WimH’ and sysWHm uSWimH. ‘:aOO WimH’, wKiFK is WKH aFWuaO WimH of dayI is important to userJspace applicatio­nsK qhe kernel keeps track of it simply because the kernel controls the timer inWHrruSW. TKH kHrnHO dHfinHs WKH vaOuH in <asm/param.h>. cor HxamSOH, a miFroSroFH­ssor wiWK an x86 arFKiWHFWu­rH Kas 100 Hz, wKHrHas onH wiWK WKH ,nWHO ,Wanium arFKiWHFWu­rH (HarOiHr ,A-64) Kas a 1024 Hz raWH.

Newspapers in English

Newspapers from India