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

linux根文件系统挂载

由bootload进入linux后由head.s进入了start_kernel了.
asmlinkage void __init start_kernel(void)
{
       char * command_line;
       extern struct kernel_param __start___param[], __stop___param[];
       ………………..
       setup_arch(&command_line);
       ………….
       ………..
       vfs_caches_init(num_physpages); ………….     
 
…………...
       rest_init();
}
 
重要函数解释
 
1.Setup_arch是解释bootloader传过来的参数,并附相关参数。
 
void __init setup_arch(char **cmdline_p)
{
       struct tag *tags = (struct tag *)&init_tags;
       struct machine_desc *mdesc;
       char *from = default_command_line;
 
       setup_processor();
       mdesc = setup_machine(machine_arch_type);
       machine_name = mdesc->name;
 
       if (mdesc->soft_reboot)
              reboot_setup("s");
 
       if (mdesc->boot_params)
              tags = phys_to_virt(mdesc->boot_params);
 
       /*
        * If we have the old style parameters, convert them to
        * a tag list.
        */
 &nb


相关文档:

linux内核 lock free


//
同步问题:
对共享数据的访问,需要同步,互斥。
在中断,抢占,多CPU,多线程 环境下尤其重要。
同步分为: 阻塞同步,非阻塞同步
阻塞同步有许多实现方式了:mutex, semaphore. 阻塞同步使用不当就可能造成死锁,活锁,优先级反转。
非阻塞同步:(现在流行三种)
wait free 很难实现,思想是本线程有限步就 ......

linux 0.11 内核学习 char_dev.c


/*
 *  linux/fs/char_dev.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <errno.h>
#include <sys/types.h> // 定义了基本的系统数据类型
#include <linux/sched.h>
#include <linux/kernel.h> // 含有一些内核常用函数的原形定义
#include < ......

linux 0.11 内核学习 buffer.c


/*
 * buffer.c 程序用于对高速缓冲区(池)进行操作和管理。高速缓冲
 * 区位于内核代码和主内存区之间。
 *
 *  |---|---|------------------|---------------------|-------------------|
 *  |   |   |    *   *    *    | &nbs ......

linux 0.11 内核学习 file_dev.c


/*
 *  linux/fs/file_dev.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <errno.h>
#include <fcntl.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#define MIN(a,b) (((a)<(b))?(a):(b))
#defi ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号