linux kernel thread
http://hi.baidu.com/j_fo/blog/item/55f4014f1a226937aec3ab01.html
Linux Kernel Thread 的讨论
2007-05-14 11:45
kernel thread
Gearheads Written by Sreekrishnan Venkateswaran
Thursday, 15 September 2005
Threads are programming abstractions used in concurrent processing. A kernel thread is a way to implement background tasks
inside the kernel. A background task can be busy handling asynchronous
events or can be asleep, waiting for an event to occur. Kernel threads
are similar to user processes, except that they live in kernel space
and have access to kernel functions and data structures. Like user
processes, kernel threads appear to monopolize the processor because of
preemptive scheduling.
In
this month’s “Gearheads,” let’s discuss kernel threads and develop an
example that also demonstrates such as process states, wait queues, and
user-mode helpers.
Built-in Kernel Threads
To
see the kernel threads (also called kernel processes) running on your
system, run the command ps –ef. You should see something similar to
Figure One.
FIGURE ONE: A typical list of Linux kernel threads
$ ps
–ef
UID
PID
PPID
C STIME TTY
TIME CMD
root
1
0
0 22:36 ?
00:00:00 init [3]
root
2
1
0 22:36 ?
00:00:00 [ksoftirqd/0]
root
3
1
0 22:36 ?
00:00:00 [events/0]
root
38
3
0 22:36 ?
00:00:00 [pdflush]
r
相关文档:
打开 /etc/sysconfig/i18n
输入
LANG="zh_CN.GB2312"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"
好了 ......
linux启动流程:
系统预处理程序->GRUB (此阶段可以理解为bootloader阶段)
->kernel (此阶段为kernel)
->initrd->init启动->inittab->rc.sysinit->functions(PATH)->modules->rcX.d(读配置文件)
1.->字符模式->tty->bash
2.->图形模式->进入X Window-> ......
errno变量(需include errno.h)会被赋一个整数值,不同的值表示不同的含义,
可以通过查看该值推测出错的原因。但是errno是一个数字,代表的具体含义
还要到errno.h中去阅读宏定义。有下面几种方法可以方便的得到错误信息
(一)
#include <stdio.h>
void perror(const char *s)
perror()用来将上一个函数发生错误的 ......
几个简单的应用。
1、批量图像格式转换
如果想将某目录下的所有jpg文件转换为png文件,只要在命令行模式下输入:
for %f in (*.jpg) do convert “%f” “%~nf.png”
2、对所有图像进行同一操作
譬如,批量生成某目录下所有PNG图像文件的缩略图(大小为80×40):
fo ......