自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

weixiaoyiri的博客

起步晚十年,只好加倍努力。

  • 博客(17)
  • 收藏
  • 关注

原创 第4章 文件的内部表示

unix系统中每个文件都有唯一的索引节点。索引节点包含着为进程存取文件所必需的信息,如文件所有者、存取权限、文件长度、文件数据在文件系统中的位置。进程通过路径名来指明文件,内核把路径名转换成文件的索引节点(namei函数)。算法函数:iget、iput、bmap、namei、alloc、free、ialloc、ifree。文件系统分配函数比缓冲区分配函数更底层?4.1 索引节点4.1.1 定

2015-12-13 00:16:43 522

原创 棍子英雄

代码/* * play : press space to start and again to stop * note : please play it in full screen */#include <stdlib.h>#include <signal.h>#include <sys/time.h>#include <curses.h>#include <setjmp.h>#de

2015-12-12 11:33:51 871

原创 围住神经猫

代码/* * how to play: w->up, s->down, a->left, d->right, space->enter */#include <stdio.h>#include <stdlib.h>#include <curses.h>#include <string.h>#include <setjmp.h>#define CWAY 'O'#define CSTON

2015-12-12 11:30:51 509

原创 五子棋

代码/* * 玩法:wsad方向,空格落子 */#include <stdlib.h>#include <string.h>#include <curses.h>#include <signal.h>#include <sys/time.h>#define COMPUTER_FIRST 1#define HUMAN_FIRST 2#defi

2015-12-12 11:23:48 285

原创 五子连珠

代码/* * 玩法:wsad方向,空格选择,q退出 */#include <stdlib.h>#include <signal.h>#include <sys/time.h>#include <curses.h>struct path_node { int row, col; int path; struct path_node *next;};struct m

2015-12-12 11:17:42 748

原创 俄罗斯方块

代码/* * 玩法:w变形,asd方向,空格暂停,q退出 */#include <stdlib.h>#include <string.h>#include <signal.h>#include <sys/time.h>#include <curses.h>#define ROW_NUM 11#define COLUMN_NUM 10#def

2015-12-12 11:13:10 334

原创 flappy bird

代码#include <curses.h>#include <stdlib.h>#include <signal.h>#include <sys/time.h>#define CHAR_BIRD 'O'#define CHAR_STONE '*'#define CHAR_BLANK ' 'typedef struct node { int x, y; struct node

2015-12-12 11:08:13 371

原创 扫雷

代码#include <stdlib.h>#include <string.h>#include <curses.h>#include <signal.h>#include <sys/time.h>#define ROW_SMALL 10#define COL_SMALL 10#define ROW_LARGE 20#defi

2015-12-12 11:04:39 258

原创 2048

代码/************************************** wsad控制上下左右,q退出* 编译命令 gcc 2048.c -lcurses* 需要下载ncurses库,具体方法请百度**************************************/#include <stdio.h>#include <curses.h>#include <sy

2015-12-12 10:55:51 364

原创 贪吃蛇

代码/************************************** wsad控制上下左右,q退出,空格暂停* 编译命令 gcc snake.c -lcurses* 需要下载ncurses库,具体方法请百度**************************************/#include <unistd.h>#include <signal.h>#incl

2015-12-12 10:37:58 288

原创 2.1.5 Median of Two Sorted Arrays

问题答案#include <stdio.h>//使用线性搜索,算法时间复杂度为O(m+n)int get_median(int *a, int la, int *b, int lb){ int i, j; int median = 0; //中值数 int mid = (la + lb) / 2; //两个数组长度和的中间下表 int

2015-12-12 00:41:00 260

原创 第3章 数据缓冲区高速缓冲

高速缓冲模块的位置是在文件子系统与(块)设备驱动程序之间。3.1 缓冲头部一个缓冲区由两部分组成:一个含有磁盘上的数据的存储器数组及一个用来标示该缓冲区的缓冲头部。缓冲区是磁盘块在主存中的拷贝,是临时的唯一映射关系。缓冲头部包含了一个设备号字段和一个块号字段。缓冲头部还包含一个指向该缓冲区的数据数组的指针,该数组大小至少有磁盘块那么大(512字节?)。缓冲头部还包含状态字节,状态字节是如下条

2015-12-11 00:39:52 771

原创 2.1.3 Search in Rotated Sorted Array

问题答案#include <stdio.h>#include <stdlib.h>//打印数组void print_array(int *pArry, int len){ int i; for (i = 0; i < len; i++) { printf("%02x, ", *(pArry+i)); if (!((i+1)%8))

2015-12-10 13:12:41 264

原创 2.1.2 Remove Duplicates from Sorted Array 2

问题答案#include <stdio.h>#include <stdlib.h>void print_array(int *pArry, int len){ int i; for (i = 0; i < len; i++) { printf("%08x, ", *(pArry+i)); if (!((i+1)%4)) pr

2015-12-10 09:27:56 229

原创 第2章 内核导言

文件子系统索引节点表文件表用户文件描述符表内核在逻辑级上只涉及文件系统,而不涉及磁盘。由磁盘驱动程序实现逻辑设备(文件系统)地址和物理设备(磁盘)地址之间的转换。文件系统由一个逻辑块序列组成,每个块都为512字节的任意倍数。在一个文件系统中逻辑块大小是完全相同的。一个文件系统具有如下结构: 引导块 超级块 索引节点表 数据块 占据文件系统的开头,是一个扇区。虽然为了引导系统

2015-12-10 00:49:19 244

原创 第1章 系统概貌

wc -l < input.txt > output.txt。相当于(wc -l < input.txt) > output.txt。操作系统在内部根据文件的类型进行文件数据的格式化处理,但是提供原始的数据流给用户进程。内核不是孤立存在的,经常作为用户进程的某一特殊阶段。为了提供这种能力,内核常驻内存。硬件按核心态和用户态来观察世界:内核在横轴方向上区分进程,硬件在纵轴上区分执行的状态。

2015-12-10 00:15:55 355

原创 2.1.1 Remove Duplicates from Sorted Array

问题 答案#include <stdio.h>#include <stdlib.h>void print_array(int *pArry, int len){ int i; for (i = 0; i < len; i++) { printf("%08x, ", *(pArry+i)); if (!((i+1)%4))

2015-12-09 18:11:55 215

空空如也

空空如也

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

TA关注的人

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