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

linux 2.6源代码情景分析笔记之进程4


散列(hash)函数并不总能确保pid与表索引一一对应。两个不同的pid散列到相同的表索引称为冲突(colliding),linux利用链表来处理冲突的pid,每一个表项是由冲突的进程描述符组成的双向链表。
pid散列表的数据结构解决了所有这些难题,他们可以为包含在一个散列表中的任何pid号定义进程链表。最主要的数据结构是四个pid结构的数组,它在进程描述符的pid字段中。
struct pid
{
        /* Try to keep pid_chain in the same cacheline as nr for find_pid */
        int nr;pid的数值
        struct hlist_node pid_chain;/* list of pids with the same nr, only one of them is in the hash */链接散列链表的下一个和前一个元素
        struct list_head pid_list;每个pid的进程链表头
};
基本运作:pid_hash中的四个基本类型表头找到tgid哈希表,然后找到对应表项再进一步找到进程描述符中的pid_chain字段,然后进一步找到process descriptor中的pid_chain表项,然后找到哈希表。
处理pid散列表的函数和宏:
#define do_each_task_pid(who, type, task)                               \
        if ((task = find_task_by_pid_type(type, who))) {                \
                prefetch((task)->pids[type].pid_list.next);             \
                do {
#define while_each_task_pid(who, type, task)                            \
           &n


相关文档:

查看linux 错误码的程序

为了方便查看Linux系统下的错误码以及它的含义,写了一个程序来打印这些信息。
listerrno.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#define MAX_ERRNO 256
int main(int argc, char* argv[])
{
int n = 0;
printf("----------------------- Errno ------------ ......

linux svn命令大全


1、将文件checkout到本地目录
svn checkout path(path是服务器上的目录)
例如:svn checkout svn://192.168.1.1/pro/domain
简写:svn co
2、往版本库中添加新的文件
svn add file
例如:svn add test.php(添加test.php)
svn add *.php(添加当前目录下所有的php文 ......

Linux中用rdate实现时间自动同步

 
                          Linux
中用
rdate
实现时间自动同步
原文地址:http://liuxh6.itpub.net/post/528/451628
在各种
linux
中都有
rdate
命令,只是一般很少有人 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号