自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 系统I/O

共享文件 内核使用三个相关的数据结构来表示打开的文件 1.描述符表:每个进程都有独立的描述符表。他的表项是由进程打开的文件描述符索引的,每个打开的文件描述符指向文件表当中的一项。 2.文件表:打开的文件集合是由一张文件表来表示的所有的进程共享这张表。每个文件表的表项的组成:当前文件的位置,引用计数,一个指向v-node表中对应表项的指针。关闭一个描述符会减少相应文件表表项当中的引用计数,直到这个引...

2019-12-03 21:20:36 153

原创 可重定位目标文件解析

从源代码到可执行目标文件要经过以下几个步骤: 源代码-->预处理-->编译-->优化-->汇编-->链接–>可执行文件 Source–(编译)–> Assembly–(汇编)–>Obj–(链接)–>PE/ELF 1.编译预处理 读取c源程序,对其中的伪指令(以#开头的指令)和特殊符号进行处理 [析] 伪指令主要包括以下四个方面 (1)宏定义指令...

2019-12-03 12:03:49 790

原创 深入理解计算机系统———fork()函数的运用

fork()函数定义如下: pid_t fork( void); (pid_t 是一个宏定义,其实质是int 被定义在#include<sys/types.h>中) 返回值: 若成功调用一次则返回两个值,子进程返回0,父进程返回子进程ID;否则,出错返回-1 函数说明 一个现有进程可以调用fork函数创建一个新进程。由fork创建的新进程被称为子进程(child process)。fo...

2019-12-02 17:23:22 633

原创 定义数组的思考与实验

#include <stdlib.h> #include <stdio.h> #include <unistd.h> static void show_pointer(void *p, char *descr) { // printf("Pointer for %s at %p\n", descr, p); printf("%s\t%p\...

2019-05-28 10:20:55 211

原创 缓冲区溢出演示

运行如下代码: /* Demonstration of buffer overflow */ #include <stdio.h> #include <stdlib.h> /* Implementation of library function gets() */ char *gets(char *dest) { int c = getchar(); char ...

2019-05-27 20:41:02 331

原创 十六进制数字转换为以‘\n’结尾的字符串

/* Convert sequence of hex digits on command line into a string, terminated by \n */ /*将一串命令行的十六进制数字转换为以‘\n’结尾的字符串*/ #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[])...

2019-05-27 19:57:49 2031

原创 浮点数加减运算的思考

运行如下代码: #include <stdio.h> #include <stdlib.h> #include <string.h> #define BUFSIZE 256 int main(int argc, char *argv[]) { char prefix[BUFSIZE]; char next[BUFSIZE]; int i; ...

2019-05-27 19:31:00 324

原创 递归的思考与实验

/* Example of deep recursion */ #include <stdio.h> #include <stdlib.h> int recurse(int x) { int a[1<<15]; /* 4 * 2^15 = 64 KiB */ printf("x = %d. a at %p\n", x, a); ...

2019-05-27 19:16:09 165

原创 深入了解计算机系统中:unsigned char、char和int的思考和实验

/* show-bytes - prints byte representation of data */ /* $begin show-bytes */ #include <stdio.h> /* $end show-bytes */ #include <stdlib.h> #include <string.h> /* $begin show-bytes */...

2019-05-27 17:49:53 410

原创 关于栈溢出的思考与实验

运行如下代码: #include <stdio.h> #include <stdlib.h> typedef struct { int a[2]; double d; } struct_t; double fun(int i) { volatile struct_t s; s.d = 3.14; s.a[i] = 10737418...

2019-05-27 17:35:39 335

原创 数据类型的溢出

先运行如下代码,看看结果: #include <stdio.h> #include <stdlib.h> int sq(int x) { return x*x; } int main(int argc, char *argv[]) { int i; for (i = 1; i < argc; i++) { int x = atoi(arg...

2019-05-27 17:15:22 842

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除