- 博客(11)
- 资源 (8)
- 收藏
- 关注
原创 linux 系统调用epoll_create epoll_ctl epoll_wait
epoll是Linux内核为处理大批量句柄而作了改进的poll,是Linux下多路复用IO接口select/poll的增强版本,它能显著减少程序在大量并发连接中只有少量活跃的情况下的系统CPU利用率。epoll主要涉及epoll_create epoll_ctl epoll_wait三个基本系统调用,及增加功能的epoll_create1,epoll_pwait epoll相对poll
2013-07-23 19:35:55 4353
原创 linux 当前处理信号自动屏蔽
当某个信号被处理时(即正在执行信号处理handler),内核会自动阻塞该信号的再次传递(再次传递会导致信号处理handler的嵌套);当信号处理返回后,内核会自动恢复该信号到调用信号处理handler之前的阻塞状态;如信号SIGUSR1在调用handler之前未被阻塞,在调用handler时被阻塞,handler执行完后恢复未被阻塞状态;信号SIGUSR2在调用handler之前被阻塞
2013-07-08 20:13:31 1352
原创 c++ 单例模式多线程竞态条件
单例模式在类只允许一个实例时用到以下是摘自“Design Patterns Elements of Reusable Object-Oriented Software”一书中单例模式实现:class Singleton {public: static Singleton* Instance();protected: Singleton(){};private: st
2013-07-06 15:29:54 2939
原创 linux signal传递(处理)
内核版本:2.6.32.60linux信号传递阶段发生在异常/中断返回到用户态时;当内核由内核态返回到用户态时,如果有信号pending到当前进程,内核就将信号传递给进程并做信号处理I.异常/中断返回i.信号传递由以下注释可以看出异常/中断或系统调用(特殊的中断)退出时,都会去检测pending的信号并做处理/* arch/x86/kernel/entry_32.S */
2013-07-05 23:03:58 2507
原创 linux signal产生(发送)
不论是内核发送信号(硬件异常-SIGSEGV等、软件通知-SIGPIPE等、终端键-SIGINT等),还是用户进程发送信号(kill系统调用),都要由内核将信号记录到相应(轻量级)进程描述符中的信号相关结构中、唤醒被阻塞的目标进程等。在信号发送阶段,内核将信号添加到信号pending队列中;在信号传递阶段,内核将信号从pending队列中取出,并处理(包括调用用户自定义处理、SIG_DFL默认
2013-07-04 23:07:19 5109
原创 linux 信号signal实现
信号是发送给进程或进程组的非常小的消息,通常只包含信号编号;现在的系统可以附带siginfo信息,见sigaction的SA_SIGINFO标识。信号主要有以下两个目的:1.让进程知道出现某异步事件2.出现异步事件,让进程能做出相应的处理(通过提供信号处理函数,由内核自动调用) I.信号生命周期i.信号生命周期1.信号产生:内核更新目标进程数据结构,表示出现某异步事件
2013-07-03 19:16:25 2840
原创 vim配置(~/.vimrc)
vim配置文件.vimrc set number" 缩进set smartindentset shiftwidth=4set softtabstop=4set expandtab" 代码跳转set tags=~/icssvn/tags" 自动补齐filetype plugin on
2013-07-02 23:34:49 935
原创 emacs配置(.emacs.d/init.el)
emacs配置文件.emacs;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;;Basic;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2013-07-02 23:30:27 7862
原创 linux 系统调用pipe
linux的管道是在pipefs上实现的,pipefs实现见linux pipe文件系统(pipefs)注: pipe会在挂载到内核上的pipefs上创建虚拟管道文件(文件对象superblock,dentry,inode,file都是内核内存中);FIFO是在物理文件系统(ext4/ext3/nfs等)中创建管道文件,物理存储中有对应的文件(如文件inode) I.原型
2013-07-02 18:50:21 4830
原创 linux 有名管道FIFO
linux文件主要有4种:普通文件、目录文件、设备文件(字符设备文件/块设备文件)、管道文件 管道文件(p表示管道文件)[redhat@localhost tmp]$ mkfifo fifo[redhat@localhost tmp]$ ll fifoprw-rw-r--. 1 redhat redhat 0 7月 1 22:06 fifo文件系统(ext4/ext3/
2013-07-01 23:01:40 1675
原创 linux pipe文件系统(pipefs)
linux的pipe,FIFO(named pipe)都是基于pipe文件系统(pipefs)的。linux的pipe和FIFO都是半双工的,即数据流向只能是一个方向;pipe只能在pipe的创建进程及其后代进程(后代进程fork/exec时,通过继承父进程的打开文件描述符表)之间使用,来实现通信;FIFO是有名称的pipe,即可以通过名称查找到pipe,所以没有“只能在pipe的创建
2013-07-01 21:31:29 8463
存储技术原理分析:基于Linux_2.6内核源代码(部分)
2014-03-14
The Second Extended File System
2013-12-08
Beamer v3.0 with PSTricks
2013-12-08
python cookbook
2013-12-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人