- 博客(32)
- 资源 (11)
- 收藏
- 关注
原创 signal 函数只能接受一次信号? The naughty signal function
The naughty signal functionsignal 函数的prototype: #include typedef void (*sighandler_t)(int); sighandler_t signal(int signum, sighandler_t handler);在练习是时候发现一个问
2014-03-31 12:14:25 4703 4
原创 《APUE》Chapter 9 Process relationships (学习笔记加上自己的代码)
Process RelationshipsTerminal LoginsUnix 是1971年开始的吧,但是这个terminal login的机制最起码30年没变过,嘿嘿。。。All the processes shown in Figure9.1 have a real user ID of 0 and an effective user ID of
2014-03-30 00:03:11 2266
原创 进程和程序的区别 The relationship between process and program
遇到一个概念性的问题:程序和进程有什么区别?一个程序是代码和数据的集合。一个进程是程序执行时候的一个特殊实例。程序总是运行于一个进程之中。对于进程和程序概念性的区分对于理解fork函数和execl函数都是有很大帮助的。fork在相同的程序之中创建一个新的子进程,子进程具有父进程的很多性质,除了fork返回值不同PID不同两者的父进程不同父进程如果有文件锁,子进程不继
2014-03-29 10:50:40 2187
原创 《APUE》Chapter 8 Process control(学习笔记加上自己的代码)
Process ControlThis includes the creation of new processes, program execution, and process termination.Process Identifiers ---- PID(嘿嘿,和自控里面的不同哇。。。)Every process has a uni
2014-03-28 23:49:10 2752
转载 vim的分屏功能 酷帅的技能啊!
http://www.cnblogs.com/floatedclouds/archive/2011/11/10/2245008.htmlvim的分屏功能总结起来,基本都是ctrl+w然后加上某一个按键字母,触发一个功能。(1)在shell里打开几个文件并且分屏: vim -On file1 file2 ... vim -on file1 file2 ...
2014-03-27 22:59:06 1075
原创 高速缓存污染 cache pollution
高速缓冲污染是指正在执行的程序将不必要的数据从主存移到高速缓冲,降低了数据处理效率的现象。CSAPP中提到的一种现象。 cache 的模型:假设有一下代码假设数组T[i] 和C[i]所有的初始数据都是0,并且cache为空,假设只有一级cacheT[0] = T[0] +1;//这个时候T[0]会被从主存移动到cach
2014-03-27 10:51:14 6453
原创 《APUE》chapter 7 Process Environment 学习笔记(加上自己的代码)
Process EnvironmentEverything start here -- main Functionint main(int argc ,char *argv []);We are familiar with this guy... but I would like to repeat and write down my understanding about
2014-03-27 10:08:12 1663
翻译 Static, Shared Dynamic and Loadable Linux Libraries
这篇文章我觉得对于静态库和动态库写得非常详细,所以mark一下http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.htmlWhy libraries are used:This methodology, also known as "shared components
2014-03-26 13:02:19 1824
原创 《APUE》chapter 6 System Data files and information 学习笔记(加上自己的代码)
System Data files and information
2014-03-25 18:01:24 2048
原创 《APUE》chapter 5 Standard I/O libary 学习笔记(加上自己的代码)
Standard I/O libary学习笔记+code
2014-03-25 11:26:28 1831
原创 something with buffer 有意思的缓冲区:关于setbuf()一段很有意思的代码
今天为了搞明白buffer的机制弄了很久。。。以至于本来该做的事情都耽误了在CSDN别人blog上面看到这么一段代码,很有意思#include#includeint main(){ int c = 0; int i = 0; setbuf(stdout,malloc(5)); while((c = getchar()
2014-03-24 14:40:53 1608
转载 组合键ctrl+c ctrl+z ctrl+d ctrl+/ ctrl+s ctrl+q 的作用
http://noworry.blog.51cto.com/6223479/1133921linux下:ctrl-c 发送 SIGINT 信号给前台进程组中的所有进程。常用于终止正在运行的程序。ctrl-z 发送 SIGTSTP 信号给前台进程组中的所有进程,常用于挂起一个进程。ctrl-d 不是发送信号,而是表示一个特殊的二进制值,表示 EOF。ctrl-
2014-03-24 11:21:41 5595
原创 byte oriented and wide oriented
byte oriented and wide orientedByte orientation refers to forms of data processing in which digital data are processed bytewise. For example, communication is called byte oriented or character
2014-03-24 09:08:18 2288 1
原创 《APUE》Chapter 4 Files and directories (学习笔记加上自己的代码)
Files and directories整个第四章都是围绕着三个stat函数展开的#include int stat(const char *restrict pathname, struct stat *restrict buf);int fstat(int filedes, struct stat *buf);int lstat(const char *restrict pat
2014-03-23 17:29:25 2334
原创 undefined reference to `minor' undefined reference to `major'的解决方案
坑爹啊!搞了半天。。。root@ubuntu:/Ad_Pro_in_Unix/chapter_4# gcc ./pro_4_25.c -o ./c.out/tmp/ccfhE6Bd.o: In function `main':pro_4_25.c:(.text+0x605): undefined reference to `minor'pro_4_25.c:(.text+0x61b
2014-03-23 17:10:19 12570 6
原创 不用第三个变量,交换两个变量的值三种方案详解
Change two varible's value without the third varible通常,交换两个变量的值的技巧就是多用一个中间变量。source code:#include#includeint main(){ int varible_1 = 10; int varible_2 = 20; int
2014-03-22 23:43:40 1890
转载 C语言的那些秘密之---函数返回局部变量
写的非常好,忍不住要mark啊!一般的来说,函数是可以返回局部变量的。 局部变量的作用域只在函数内部,在函数返回后,局部变量的内存已经释放了。因此,如果函数返回的是局部变量的值,不涉及地址,程序不会出错。但是如果返回的是局部变量的地址(指针)的话,程序运行后会出错。因为函数只是把指针复制后返回了,但是指针指向的内容已经被释放了,这样指针指向的内容就是不可预料的内容,调用就会出错。准确的
2014-03-21 22:42:17 970
原创 second order system analysis in adaptive control 自控 带零点的二阶系统matlab仿真分析
带零点的二阶系统matlab仿真分析上图是使用Matlab的simulink对带零点的二阶系统模型和不带零点的二阶系统进行仿真分析的模拟图仿真示波器输出结果:上面的波形是带零点的二阶系统输出下面的波形是不带零点的二阶系统的波形输出我们可以看出,零点(位于实轴负半轴)对二阶系统的影响是,使得系统的上升时间tr减少,响应速度大
2014-03-19 09:25:58 2539 2
原创 second order system analysis 自动控制原理 二阶系统的matlab仿真分析
二阶系统的matlab仿真分析二阶系统的matlab仿真分析如上图。根据二阶函数对阶跃函数的响应函数,我们对参数epsilon进行分析讨论可以看出,当epsilon比较小的时候,响应时间短,且伴随有明显的超调。随着epsilon的增大,超调明显降低,epsilon在0.7之后几乎就没有超调了。随着epsilon的增大响应时间变
2014-03-18 17:23:41 5996
原创 first order system analysis 自控原理 一阶系统的matlab分析
一阶系统的matlab分析上图是用simulink仿真的一阶系统对阶跃型号的响应传递函数可以简化为theta(s) = K/(Ts+1)为方便研究,K为常数,令K等于1。探究不同的T情况下,一阶系统对阶跃激励的响应。代码很简单的,matlab各种封装好的数学处理函数,用起来很方便,和C比起来难度不知道低多少,我们要做的就是不知道就goog
2014-03-18 10:56:46 5567
原创 Bitter of scanf
之初学习C,是在VC下面的(其实第一个hello world都是在turbo C下面敲出来的,蓝色屏幕,hello world,别提当时多激动了)。学到后面,见识过各路高手批评我的代码风格很乱,后面才慢慢改,原谅我的无知,看的第一本教材是用的老谭的PDF版本的(高中毕业,在家没事干,窝在家里对着老掉牙的turbo C 敲代码,只是觉得很好玩,觉得这东西很神奇,我居然可以让电脑按照我的想法做事情
2014-03-18 01:33:39 2704 14
转载 简明 Vim 练级攻略
vim的学习曲线相当的大(参看各种文本编辑器的学习曲线),所以,如果你一开始看到的是一大堆VIM的命令分类,你一定会对这个编辑器失去兴趣的。下面的文章翻译自《Learn Vim Progressively》,我觉得这是给新手最好的VIM的升级教程了,没有列举所有的命令,只是列举了那些最有用的命令。非常不错。——————————正文开始——————————你想以最快的速度学习人类
2014-03-14 02:03:38 862
原创 The first experiment about digital filter 软件滤波初体验
软件滤波初体验选择最好玩的方波预设波形如下:频谱,你懂的:如果只对低频部分进行inverse-DFT,那么:当 for frequency = -(circle/20):(circle/20)-1取circle/20以下的部分,低频断:nice!如果此时放宽滤波频段至circle/8一个高频信号就会叠加到之前的低频信号
2014-03-13 18:27:14 1491
原创 阶跃函数的导数为什么是冲击函数 The derivative of heaviside step function is delta function
如果我今天没搞懂这个,我估计我会抑郁到不能睡觉。heaviside step function 就是所谓的阶跃函数:定义图像:dirac delta function 狄利克雷函数,通常所说的冲击函数:定义:函数图像:提出问题:为什么heaviside step 函数的导数就是 dirac delta 函数呢?感觉上是
2014-03-13 01:12:47 32001 8
原创 fourier transfrom 傅立叶变换代码实现(matlab语言)
a implementation of discret fourier transform
2014-03-12 00:22:19 4319
原创 【操蛋的“a+”】file access permission 文件写入权限
昨天七八节课写了两个小时的样子,零警告,零错误。算是把hash table给堆出来了悲剧的事情在后面,回寝室debug绝对不止5个小时。。。。老是文件的写入fwrite有问题。问题简直就是诡异。。。。不能理解。今天晚上把学长扯上,在港饮之都坐了一个半小时的样子。最后电脑没电报警,距离自动关机只有10分钟了。first blood!kill the fucking bug。下面是男人
2014-03-07 22:36:25 2243
原创 expected identifier or '(' before 'struct' GCC 报错问题
2014年03月04号,gcc报错小记录调BVL树的时候,写了个函数函数声明就像下面这个:(struct node*) functionname((struct node*) p_node, int number);这个时候不管是编译还是链接,都会报错:expected identifier or '(' before 'struct' 怎么调都消除不了报错。这个时候其
2014-03-04 19:03:22 5635
原创 gcc报错重定向到文本文件【整理】
command > filename 把把标准输出重定向到一个新文件中command >> filename 把把标准输出重定向到一个文件中(追加)command 1 > fielname 把把标准输出重定向到一个文件中command > filename 2>&1 把把标准输出和标准错误一起重定向到一个文件中command 2 > filename 把把标准错误重定向到一个文件中
2014-03-04 01:02:50 2370
原创 Stack ---- Implementation in C and Python
A classical implementation of stack by linked list
2014-03-03 23:06:32 1736
CSAPP lab 5 实验指导书
2014-09-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人