Linux的工作队列
1,先看看工作队列和tasklet的区别:
(1) 定时器和tasklet:
Tasklets resemble kernel timers in 3 ways.
1)They are always run at interrupt time,
2)they always run on the same CPU that schedules them,
3)and they receive an unsigned long argument. Unlike kernel timers, however, you can’t ask to execute the function at a specific time.
(2) tasklet和工作队列:
Workqueues are, superficially, similar to tasklets; they allow kernel code to request that a function be called at some future time. There are, however, some significant differences between the two, including:
1) Tasklets run in software interrupt context with the result that all tasklet code must be atomic. Instead, workqueue functions run in the context of a special kernel process; as a result, they have more flexibility. In particular, workqueue functions can sleep.
2)Tasklets always run on the processor from which they were originally submitted. Workqueues work in the same way, by default.
3)Kernel code can request that the execution of workqueue functions be delayed for an explicit interval.
2,工作队列(work queue)是Linux kernel中将工作推后执行的一种机制。这种机制和BH或Tasklets不同之处在于工作队列是把推后的工作交由一个内核线程去执行,因此工作队列的优势就在于它允许重新调度甚至睡眠。工作队列是2.6内核开始引入的机制,在2.6.20之后,工作队列的数据结构发生了一些变化,因此本文分成两个部分对2.6.20之前和之后的版本分别做介绍。
(1)2.6.0~2.6.19
数据结构:
struct work_struct {
unsigned long pending;
struct list_head entry;
void (*func)(void *);
void *data
相关文档:
在linux下,估计你经常使用pwd这个命令,这个命令就是打印当前的工作路径,即print working directroy, 今天我们也来c语言实现这个命令。
要实现这个功能,需要用到下面的一个系统调用:
#include <unistd.h>
char *getcwd(char *buf, size_t size);
该系统调用返回当前的工作目录的绝对路径,绝对路径 ......
Linux应用范围的日益扩展,使得其使用性越来越受到关注。性是一个复杂和广泛的问题,此处我们主要关注Linux用户的账户安全,特别是Linux系统管理员如何保障用户的安全。
口令安全
Linux系统中的/etc/passwd文件含有全部系统需要知道的每个用户的信息(加密口令的密文也可能存于/etc/ ......
2。 技术网点:
csdn.net
chinaunix.net
ibm.com/developerworks/cn/linux
Linux内存使用详解:
http://blog.chinaunix.net/u2/67750/showart_2154542.html
3。 Linux技术点
系统管理命令(expect.)
shell编程
正则表达式
busybox
文件系统
4。 其它技术点
pclint(静态代码检查工具)
source monitor ......
最近在研究 Linux 内核的时间子系统,为下一篇长文《服务器程序中的日期与时间》做准备,无意中注意到了 Linux 新增的几个系统调用的对编写服务器代码的影响,先大致记录在这里。这篇博客也可算作前一篇《多线程服务器的常用编程模型》的一个注脚。 1. 服务器程序的风格可能在变 新的创建文件描述符的 syscall 一般都支持 ......
Ubuntu Linux系统环境变量配置文件介绍
发布时间:2007.12.19 06:30 来源:赛迪网 作者:sixth
在Ubuntu中有如下几个文件可以设置环境变量
/etc/profile:在登录时,操作系统定制用户环境时使用的第一个文件,此文件为系统的每个用户设置环境信息,当用 ......