亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 赫茲可以設(shè)置嗎? [打印本頁]

作者: wwlhz    時(shí)間: 2009-10-09 16:52
標(biāo)題: 赫茲可以設(shè)置嗎?
內(nèi)核中
#define Hz 10000

赫茲意為每秒的週期性震動次數(shù)

不是應(yīng)該由硬件晶振決定的嗎,在代碼里修改了這個值,會起到什么效果?

可以于晶振的實(shí)際值不一致嗎?
作者: kouu    時(shí)間: 2009-10-09 20:25
按我的理解, HZ是內(nèi)核用來設(shè)置晶振器, 讓它以HZ為頻率來工作.

是內(nèi)核來決定晶振器的工作頻率, 而不是晶振器來決定內(nèi)核代碼中的HZ.
作者: C.J    時(shí)間: 2009-10-09 21:27
內(nèi)核的HZ和硬件HZ不是一個東西。
作者: moon146    時(shí)間: 2009-10-09 21:43
個人理解:
cpu有自己的工作頻率
hz是內(nèi)核心跳,配合進(jìn)程調(diào)度等工作。
如hz=100,則需要每10ms進(jìn)行一次計(jì)時(shí)(jiffies++),也就是一次時(shí)鐘中斷,可在次中斷中進(jìn)行調(diào)度等工作。
假設(shè)cpu是100M Hz,會計(jì)算出,cpu每運(yùn)算1M次就需要產(chǎn)生一次時(shí)鐘中斷。
你所說的晶振不知道說的是配合什么硬件工作的?
cpu?不知道現(xiàn)在的cpu還需要外接一個晶振嗎?如果需要,這個晶振的頻率也是固定的,不能改,也沒有必要考慮。
RTC?這只是另外一個單獨(dú)的計(jì)時(shí)硬件,提供一個標(biāo)準(zhǔn)始終而已。和hz沒關(guān)系的,甚至和內(nèi)核都沒有多大關(guān)系。

修改hz只會影響內(nèi)核調(diào)度粒度,具體的值隨便你改,但是,太大占用資源,太小對性能有影響,一般不改。
作者: zyr-linux    時(shí)間: 2009-10-10 12:36
make menuconfig的時(shí)候可以配置,不過可選項(xiàng)有限。
作者: wwlhz    時(shí)間: 2009-10-10 17:35
標(biāo)題: understand the linux kernel 3rd
Besides the Real Time Clock and the Time Stamp Counter, IBM-compatible PCs include another type of time-measuring device called Programmable Interval Timer(PIT).
The role of a PIT is similar to the alarm clock of a microwave oven: it makes the user aware that the cooking time interval has elapsed. Instead of ringing a bell,
this device issues a special interrupt called timer interrupt, which notifies the kernel that one more time interval has elapsed.[]
Another difference from the alarm clock is that the PIT goes on issuing interrupts forever at some fixed frequency established by the kernel. Each IBM-compatible PC includes at least one PIT, which is usually implemented by an 8254 CMOS chip using the 0x40-0x43 I/O ports.

As we'll see in detail in the next paragraphs, Linux programs the PIT of IBM-compatible PCs to issue timer interrupts on the IRQ 0 at a (roughly) 1000-Hz frequency that is, once every 1 millisecond. This time interval is called a tick, and its length in nanoseconds is stored in the tick_nsec variable.
On a PC, tick_nsec is initialized to 999,848 nanoseconds (yielding a clock signal frequency of about 1000.15 Hz), but its value may be automatically adjusted by the kernel if the computer is synchronized with an external clock (see the later section "The adjtimex( ) System Call"). The ticks beat time for all activities in the system; in some sense, they are like the ticks sounded by a metronome while a musician is rehearsing.



A few macros in the Linux code yield some constants that determine the frequency of timer interrupts. These are discussed in the following list.

HZ yields the approximate number of timer interrupts per second that is, their frequency. This value is set to 1000 for IBM PCs.

CLOCK_TICK_RATE yields the value 1,193,182, which is the 8254 chip's internal oscillator frequency.

LATCH yields the ratio between CLOCK_TICK_RATE and HZ, rounded to the nearest integer. It is used to program the PIT.
作者: wwlhz    時(shí)間: 2009-10-10 17:40
標(biāo)題: 編程的定時(shí)器
好象是說:用一種可編程的定時(shí)器來控制定時(shí)中斷,
PC機(jī)上沒有晶振嗎?有的話,起什么作用? 上面那個定時(shí)器指的是晶振嗎?

嵌入式設(shè)備上是不是就不同了呢?




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2