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

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1982 | 回復(fù): 6
打印 上一主題 下一主題

赫茲可以設(shè)置嗎? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2009-10-09 16:52 |只看該作者 |倒序瀏覽
內(nèi)核中
#define Hz 10000

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

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

可以于晶振的實際值不一致嗎?

論壇徽章:
0
2 [報告]
發(fā)表于 2009-10-09 20:25 |只看該作者
按我的理解, HZ是內(nèi)核用來設(shè)置晶振器, 讓它以HZ為頻率來工作.

是內(nèi)核來決定晶振器的工作頻率, 而不是晶振器來決定內(nèi)核代碼中的HZ.

論壇徽章:
0
3 [報告]
發(fā)表于 2009-10-09 21:27 |只看該作者
內(nèi)核的HZ和硬件HZ不是一個東西。

論壇徽章:
0
4 [報告]
發(fā)表于 2009-10-09 21:43 |只看該作者
個人理解:
cpu有自己的工作頻率
hz是內(nèi)核心跳,配合進程調(diào)度等工作。
如hz=100,則需要每10ms進行一次計時(jiffies++),也就是一次時鐘中斷,可在次中斷中進行調(diào)度等工作。
假設(shè)cpu是100M Hz,會計算出,cpu每運算1M次就需要產(chǎn)生一次時鐘中斷。
你所說的晶振不知道說的是配合什么硬件工作的?
cpu?不知道現(xiàn)在的cpu還需要外接一個晶振嗎?如果需要,這個晶振的頻率也是固定的,不能改,也沒有必要考慮。
RTC?這只是另外一個單獨的計時硬件,提供一個標(biāo)準(zhǔn)始終而已。和hz沒關(guān)系的,甚至和內(nèi)核都沒有多大關(guān)系。

修改hz只會影響內(nèi)核調(diào)度粒度,具體的值隨便你改,但是,太大占用資源,太小對性能有影響,一般不改。

論壇徽章:
0
5 [報告]
發(fā)表于 2009-10-10 12:36 |只看該作者
make menuconfig的時候可以配置,不過可選項有限。

論壇徽章:
0
6 [報告]
發(fā)表于 2009-10-10 17:35 |只看該作者

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.

論壇徽章:
0
7 [報告]
發(fā)表于 2009-10-10 17:40 |只看該作者

編程的定時器

好象是說:用一種可編程的定時器來控制定時中斷,
PC機上沒有晶振嗎?有的話,起什么作用? 上面那個定時器指的是晶振嗎?

嵌入式設(shè)備上是不是就不同了呢?
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP