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

Linux kernel development Chapter2 进程管理

1 进程管理相关代码
  1.1 thread_info结构,在文件<asm/thread_info.h>中定义
      struct thread_info {
           struct task_struct *task;
           struct exec_domain *exec_domain;
           unsigned long flags;
           __u32 cpu;
           __s32 preempt_count;
           mm_segment_t addr_limit;
           u8 supervisor_stack[0];
        };
        每个任务的thread_info结构在其内核栈顶端分配,其task域指向该任务的事件task_struct结构。
   1.2 任务队列(task list)
      双向循环链表,链表每一项都是一个task_struct(定义在include/linux/sched.h中),该进程描述符包含了一个仅进程的所有信息。
   1.3 slab
       linux通过slab机制分配task_struct结构,以达到对象复用和缓存着色的目的。
   1.4 pid
       linux通过pid(pid_t类型,integer)来标示每一个任务进程。为了与老版本unix和linux兼容,pid最大值为32767.如果需要更多进程,可以通过
修改/proc/sys/kernel/pid_max来提高上限。
   1.5 current宏
        current宏用于查找当前正在运行进程的进程描述符。不同的硬件体系结构的实现不同。
        在x86架构中,寄存器不多,不能使用专门的寄存器指向当前进程的task_struct.它的方式是通过在内核栈顶端创建thread_info结构,间接的
查找task_struct结构:
         (1)通过屏蔽栈指针(esp)的后13个有效位获得thread_info结构,在current_thread_info()函数完成:
        &n


相关文档:

实战Linux Bluetooth编程(六) L2CAP编程实例

例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
 如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......

linux中ELF加载过程分析

sys_execve
   | - do_execve
|
| - search_binary_handler         
           |- linux_binfmt= elf_format
       |- elf_format-> load_elf_binary
| -&nbs ......

linux内核空间申请超过2MB连续空间的实现函数。

 /*
kmalloc can apply 128KB memory only. This func support any continous memory allocate more than 2MB.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
#define KMEM_PAGES       &nb ......

极小的Linux发行版

 




<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
A:link { so-language: zxx }
-->

       一个
Linux
发行版,体积很小,用处反而很大。此话当真?
 
       一般而言,老式计算机内存都不大, ......

Linux driver编写思考


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号