易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux 内核WorkQueue阅读笔记


1.            Workqueue
Workqueue的名字就和他的功能一样:需要处理的工作列表和工作的添加删除(貌似没有看到如何删除的)、以及工作的调度执行。
需要处理的工作列表通常都维护在内核对象workqueue_struct里面。系统里面可以有多个workqueue_struct。内核部分的工作添加到了工作队列keventd_wq。而fs/aio.c里面实现了自己的工作队列aio_wq。
workqueue_struct是双向循环链表。里面的单元是work_struct。
 
驱动接口:
create_workqueue:创建工作队列结构和内核处理线程。
schedule_work/schedule_delayed_work:调度执行一个具体的任务,执行的任务将会被挂入Linux系统提供的workqueue keventd_wq。请注意,调度执行并不等于立刻执行。而是指示worker_thread在下次处理工作队列的时候执行该工作;
queue_work/queue_delayed_work:调度执行一个指定workqueue中的任务。内核本身提供了一个工作队列keventd_wq。但是,系统里面也可以有其他的工作队列。所以就有了schedule_work和queue_work的区分。
1.1           schedule_work
从schedule_work的实现看,其和queue_work的实现区别并不大:
int schedule_work(struct work_struct *work)
{
              return queue_work(keventd_wq, work);
}
 
int queue_work(struct workqueue_struct *wq, struct work_struct *work)
{
              int ret;
              ret = queue_work_on(get_cpu(), wq, work);
              put_cpu();
              return ret;
}
int
queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work)
{
              int ret = 0;
          


相关文档:

Linux GCC make文件的写法4 清晰版

包含3个文件夹,和一个文件Makefile
目录组织结构如下:
Makefile
inc/hello.h
main/main.c
src/hello.c
Makefile文件在外面,这样生成的.o和可执行文件都在外面,clean之后会很干净,结构清晰
文件内容如下:
Makefile(之所以用大写,因为make可以识别Makefile和makefile,用大写可以鲜明一些)::
# String declar ......

redhat linux 9.0下LAMP的安装与配置

首先,服务器GCC要有,不然什么都不能做.能够用gcc -v来查看是否安装了GCC,
#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checki ......

linux桌面壁纸自动换(类似于windows7壁纸自动换)

复制以下内容,保存为  py 后缀的文件,拷贝到wallpaper文件夹,进入文件夹,以python运行,选取xml为壁纸
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
# Ubuntu 9.10 dynamic wallpaper maker_Can be used in all the distributions of linux
#
# Auto generate a configuration file which you can use ......

Linux的大阅兵






<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
A:link { so-language: zxx }
-->
        所谓“阅兵”就是检阅部队的意思。
Linux
大军(发行版)可谓“散兵游勇”,谈何大阅兵?此言差矣。
 
   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号