随笔分类 -  计算机系统

Storage Systems
摘要:1. MountMount - Combine the FSes into one namespace. All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the filesystem found on some device to the big file tree.Th 阅读全文

posted @ 2013-05-19 06:12 NULL00 阅读(309) 评论(0) 推荐(0)

各种小结
摘要:Implement wget in JavaURL gotoUrl = new URL(url);InputStreamReader isr = new InputStreamReader(gotoUrl.openStream());BufferedReader in = new BufferedR... 阅读全文

posted @ 2013-02-27 06:52 NULL00 阅读(977) 评论(0) 推荐(0)

虚拟内存(Virtual Memory)
摘要:Each process has its own virtual address space, so the virtual address 0xdead0000 in one process's address space will represent a different physical page than the page represented by 0xdead0000 in another process. Each process has it's own mapping from virtual addresses to physical addresses 阅读全文

posted @ 2012-11-22 06:05 NULL00 阅读(3875) 评论(1) 推荐(0)

僵尸进程 & 孤儿进程 & UNIX异常控制流相关函数
摘要:僵尸进程(Zombie Process):子进程结束,父进程没有等待(即没有调用wait/waitpid函数)它,那么它成为僵尸进程孤儿进程(Orphan Process):一个父进程退出,而它一些子进程还在运行中,那么这些子进程将成为孤儿进程;孤儿进程将被init进程收养,即init进程为其父进程父进程退出时,若它的某些子进程为僵尸进程,那么这些僵尸进程也退出。因而在系统中,若想杀死僵尸进程,其中的一个办法就是杀死其父进程。下面这个例子演示的就是僵尸进程,在运行的时候,可以用"ps -ef | grep defunct"进行查看。#include <sys/type 阅读全文

posted @ 2012-10-29 14:12 NULL00 阅读(1440) 评论(0) 推荐(0)

SSD6中Exercise4 (substitute.cpp) 答案解析
摘要:今天终于把Exercise4搞定了,昨天大约优化了0.38秒,今天优化了0.52秒,跨越了一大步。在我们未加任何修饰执行此代码时,其执行后所用时间如图(摘抄主要):FunctionCallee Exclusive Timemain1.495306IndexOf( String, int32 )0.771013insertChar( String, int32, String, int32 )0.444054我们发现insertChar()函数里面就一条return语句,这完全没必要,何必还调用一个函数呢,申请栈释放栈很浪费时间,然后我们去掉这个函数,直接在别的函数里面用它里面的语句。我们再来看 阅读全文

posted @ 2008-12-01 22:55 NULL00 阅读(2763) 评论(1) 推荐(0)

struct对象在内存中所占的空间大小(内存对齐)
摘要:对于一个struct对象,其在内存中所占空间的大小往往不是所有成员的字节大小相加之和。运行下面代码看一下:#include<iostream> usingnamespacestd;//union structdemo{charc;shorts;inti;longl;floatf;doubled;longdoublelb;};intmain(){cout<<sizeof(demo)<<endl;return0;} 我在WindowsXp,vs2008下输出为32,为什么不是1+2+4+4+4+8+8呢?因为struct对象在存储时采用对齐原则,Windows默 阅读全文

posted @ 2008-11-27 22:11 NULL00 阅读(1159) 评论(0) 推荐(0)

缓冲区溢出攻击试验(bufbomb.c)
摘要:本文的实验来源于CSAPP 《Computer Systems A Programmer's Perspective》 (深入理解计算机系统)一书中第三章的一个实验,即习题3.38。 作者给出了一个含有缓冲区溢出的程序bufbomb.c,你需要做的,就是注入给缓冲区些特殊的数据,到底利用缓冲区的目的。在做这个题目之前,你当然要知道什么是帧栈结构(请参阅《深入理解计算机系统》第三章)或者之前的博文栈帧&溢出,了解%ebp和%esp的含义//bufbomb.c /* Bomb program that is solved using a buffer overflow attack 阅读全文

posted @ 2008-10-26 13:27 NULL00 阅读(7320) 评论(0) 推荐(0)

SSD6中Exercise1答案解析
摘要:#include <stdio.h> #include <stdlib.h> int prologue [] = { 0x5920453A, 0x54756F0A, 0x6F6F470A, 0x21643A6F, 0x6E617920, 0x680A6474, 0x6F697661, 0x20646E69, 0x63636363, 0x63636363, 0x72464663, 0x6F6D6F72, 0x63636363, 0x63636363, 0x72464663, 0x6F6D6F72, 0x2C336573, 0x7420346E, 0x20216F74... 阅读全文

posted @ 2008-10-19 15:27 NULL00 阅读(2958) 评论(0) 推荐(0)

栈帧&溢出
摘要:栈帧也叫过程活动记录,是编译器用来实现过程/函数调用的一种数据结构 从逻辑上讲,栈帧就是一个函数执行的环境:函数参数、函数的局部变量、函数执行完后返回到哪里 … 。 实现上有硬件方式和软件方式(有些体系不支持硬件栈)缓冲区溢出攻击主要是利用栈帧的构成机制,利用疏忽的程序破坏栈帧从而使程序转移到攻击者期望或设定的代码上。 /*******************************************************************************************/详细分析过程调用的相关操作和汇编指令的作用。还是以代码来分析,非常简单的c程序,不过对于我们 阅读全文

posted @ 2008-10-17 13:56 NULL00 阅读(3473) 评论(3) 推荐(3)

导航