摘要: 当当热卖商品推荐先打下广告,上面是一本好书了O(∩_∩)O~前言因为遇到一个pci总线的问题,所以去学习了解linux的pci驱动,中间总结了一些pci总线原理和linux驱动的知识,在此总结出来备查。PCI总线原理简介组成结构PCI总线是一种局部总线,与系统总线有所区别,主要是为了连接外设。它在一个处理器系统中的位置如下图与PCI总线相关的模块包括,HOST主桥、PCI总线、PCI桥和PCI设备,所有的PCI设备组成一棵树,后面会看到linux内核在内存中也维护了一棵类似的树。当然这个图只是一种特例,有的系统中存储器控制器的位置是集成在cpu中的,有些简单的系统可能没有PCI桥,只有PCI设 阅读全文
posted @ 2013-11-30 09:06 jialejiahi 阅读(2665) 评论(0) 推荐(0) 编辑
摘要: 高手亦无他,不过多知道一些罢了。成为高手的秘诀也很简单,就是耐心细致的看书,总结,多联系,勤思考。成为高手的路大家都知道,但是认真走下去的人不多。计算机编程的经典书籍不超过二十本,而且很多都是相通的,有多少人肯花几年的时间认真研究成为专家?路是人走的,只有对一个领域不灭的热情,才能使一个人达到他人到不了的高度。 阅读全文
posted @ 2011-12-16 23:03 jialejiahi 阅读(310) 评论(0) 推荐(0) 编辑
摘要: " 不要使用vi的键盘模式,而是vim自己的set nocompatible" 语法高亮set syntax=on" 去掉输入错误的提示声音set noeb" 在处理未保存或只读文件的时候,弹出确认set confirm" 自动缩进set autoindentset cindent" Tab键的宽度set tabstop=4" 统一缩进为4set softtabstop=4set shiftwidth=4" 不要用空格代替制表符set noexpandtab" 在行和段开始处使用制表符set smartt 阅读全文
posted @ 2011-12-16 07:41 jialejiahi 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 进程间通信1. 管道管道是UNIX IPC的最老形式,并且所有U N I X系统都提供此种通信机制,管道有两种限制;(1) 它们是半双工的。数据只能在一个方向上流动。(2) 它们只能在具有公共祖先的进程之间使用。通常,一个管道由一个进程创建,然后该进程调用f o r k,此后父、子进程之间就可应用该管道。管道是由调用p i p e函数而创建的。#include <unistd.h>int pipe(int filedes[2]);Returns: 0 if OK, 1 on error经由参数f i l e d e s返回两个文件描述符: f i l e d e s [ 0 ]为读 阅读全文
posted @ 2011-12-14 12:44 jialejiahi 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 高级IO1. 多路复用Poll函数#include <poll.h>int poll(struct pollfd fdarray[], nfds_t nfds, int timeout);Returns: count of ready descriptors, 0 on timeout, 1 on error返回:准备就绪的描述符数,若超时则为0,若出错则为- 1与s e l e c t不同,p o l l不是为每个条件构造一个描述符集,而是构造一个p o l l f d结构数组,每个数组元素指定一个描述符编号以及对其所关心的条件。 struct pollfd { int fd; 阅读全文
posted @ 2011-12-14 12:39 jialejiahi 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 1. 编写规则 Some basic rules to coding a daemon prevent unwanted interactions from happening. We state these rules and then show a function, daemonize, that implements them. The first thing to d... 阅读全文
posted @ 2011-12-05 23:29 jialejiahi 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 1. 线程属性 什么东西都涉及到属性,程序里一涉及到属性的话,一般就是比较高级的要求了。比如socket的setsockopt函数比较重要。文件描述符的fcntl比较重要。同理,线程的: #include <pthread.h> int pthread_attr_init(pthread_attr_t *attr); int pthread_attr_destroy(pthr... 阅读全文
posted @ 2011-12-05 11:54 jialejiahi 阅读(448) 评论(0) 推荐(0) 编辑
摘要: 线程基础 tips :对前面习题的一点回顾 1) fgets 最多读取MAX - 1个字符,结尾自动加\0; 2)Standard input and standard output are both line buffered when a program is run interactively. When fgets is called, standard output is flus... 阅读全文
posted @ 2011-12-02 23:04 jialejiahi 阅读(431) 评论(0) 推荐(0) 编辑
摘要: 1. 定义首先,每个信号都有一个名字。这些名字都以三个字符 S I G开头。例如,S I G A B RT是夭折信号,当进程调用a b o r t函数时产生这种信号。S I G A L R M是闹钟信号,当由a l a r m函数设置的时间已经超过后产生此信号。V 7有1 5种不同的信号,S V R 4和4 . 3 + B S D均有3 1种不同的信号。在头文件< s i g n a l . h >中,这些信号都被定义为正整数(信号编号)。没有一个信号其编号为0。在1 0 . 9节中将会看到k i l l函数,对信号编号0有特殊的应用。P O S I X . 1将此种信号编号值称为 阅读全文
posted @ 2011-11-26 17:03 jialejiahi 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 1. 关于0号和1号进程There are some special processes, but the details differ from implementation to implementation. Process ID 0 is usually the scheduler process and is often known as the swapper. No program on disk corresponds to this process, which is part of the kernel and is known as a system process. P 阅读全文
posted @ 2011-11-25 18:12 jialejiahi 阅读(266) 评论(0) 推荐(0) 编辑