Linux定时器 详解[转]
[转]Linux定时器
核主要需要两种类型的时间:
1.
在内核运行期间持续记录当前的时间与日期,以便内核对某些对象和事件作时间标记(
timestamp
,也称为
“
时间戳
”
),或供用
户通过时间
syscall
进行检索。
2.
维持一个固定周期的定时器,以提醒内核或用户一段时间已经过去了。
PC
机中的时间是有三种时钟硬件提供的,而这些时钟硬件又都基于固定频率的晶体振荡器来提供时钟方波信号输入。这三种时钟硬件
是:(
1
)实时时钟(
Real Time Clock
,
RTC
);(
2
)可编程间隔定时器(
Programmable Interval Timer
,
PIT
);(
3
)
时间戳计数器(
Time Stamp Counter
,
TSC
)。
7
.
1
时钟硬件
7
.
1
.
1
实时时钟
RTC
自从
IBM PC AT
起,所有的
PC
机就都包含了一个叫做实时时钟(
RTC
)的时钟芯片,以便在
PC
机断电后仍然能够继续保持时间。显
然,
RTC
是通过主板上的电池来供电的,而不是通过
PC
机电源来供电的,因此当
PC
机关掉电源后,
RTC
仍然会继续工作。通
常,
CMOS RAM
和
RTC
被集成到一块芯片上,因此
RTC
也称作
“CMOS Timer”
。最常见的
RTC
芯片是
MC146818
(
Motorola
)和
DS12887
(
maxim
),
DS12887
完全兼容于
MC146818
,并有一定的扩展。本节内容主要基于
MC146818
这一标准的
RTC
芯片。具体内
容可以参考
MC146818
的
Datasheet
。
相关文档:
在linux内核中用于申请中断的函数是request_irq(),函数原型在Kernel/irq/manage.c中定义:
int request_irq(unsigned int irq, irq_handler_t handler,
unsigned ......
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include<linux/config.h>
#include<linux/module.h>
#include<linux/version.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/errno.h>
#include<linux/sche ......
Linux Execution and Virtual Memory Utilization
Linux执行以及虚拟内存之用
When Linux boots, it starts with the MMU disabled, so initially it deals only with physical
memory. The kernel image is copied to physical address 0x8000 in DRAM and executed. First a master page table is created ......
-------------------------------------------------------------------------------------------------------
//By:yuyongbao
//QQ:673360056
LINUX 内核结构体
struct attribute
{
const char * name;
struct module &nb ......
·find path -option [ -print ] [ -exec -ok command ] {} \;
#-print 将查找到的文件输出到标准输出
#-exec command {} \; -----将查到的文件执行command操作,{} 和 \;之间有空格
#-ok 和-exec相同,只不过在操作前要询 ......