嵌入式Linux物理内存映射
The physical memory map for Linux is completely independent from the virtual map and is designed to maximize contiguous space. Given that the kernel image will always be at the start of DRAM, the Linux kernel maximizes contiguous space by allocating runtime memory from the end of physical DRAM moving downward.
The kernel starts by breaking available memory out into large, contiguous blocks (typically 4MB or more).It then maintains memory using the buddy system, where physical memory is always allocated in combinations of blocks of 2^n pages (where n is the order, that is, 4K is a 0 order block, 8K is a 1st order block, 16K is a 2nd order block, etc).
Linux物理内存的映射完全独立于虚拟内存的映射,而且尽可能映射到连续的空间。假定内核映像总是位于DRAM的开始处,Linux内核尽可能让空间连续,这是通过从物理DRAM的末端向下移动来分配运行时内存而达到的。
内核一开始把可用内存分割为大而连续的块(通常为4MB 或更多)。此后,内核利用伙伴算法来管理内存,这里,物理内存的分配总是2^n个页所形成块的组合(这里,n是幂,4k就是幂为0的块,8K是幂为1块,16K为幂为2的块,如此等等)。
When physical memory is allocated, that is, on process start, or when malloc’ed memory is written to (copy-on-write), the kernel scans for the smallest order block that will fill fit starting from the top of DRAM. As the number of running processes increases, or new allocations are spawned from drivers or processes, the physical memory used grows downward.
当物理内存分配时,也就是在进程刚开始时,或者说当分配的内存被写入时(写时复制),内核扫描最小幂次的块(从DRAM顶部开始寻找最合适的)。随着进程数的增加,或者来自驱动程序或进程新分配的蔓延,所使用的物理内存向下延伸。
When a process exits or a large enough memory block is freed, its DRAM space is unmapped and becomes a gap in memory. This process is called memory fragmentation and becomes more and more prevalent the longer a device is used and the more frequently
相关文档:
http://blog.chinaunix.net/u1/53053/showart_425197.html
#include <sys/types.h> /* 提供类型pid_t的定义 */
#include <sys/wait.h>
pid_t wait(int *status)
进程一旦调用了wait,就立即阻塞自己,由wait自动分析是否当前进程的某个子进程已经退出,如果让它找到了这样一个已经变成僵尸的子进程,wai ......
1。下载postgresql8.4.1源码包
下载地址:http://www.postgresql.org/ftp/source/
2。解压源码包
3。编译安装
命令如下:
./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/ ......
首先是下载python3,现在的最高版本是3.1.1
for linux。
我的放置路径是/home/python下放置Python-3.1.1.tgz,执行以下系列操作:
1.解压:tar zxvf Python-3.1.1.tgz----生成解压包Python-3.1.1
2.转换到Python-3.1.1路径下,执行./configure
3.make
4.make install
在rehl5中已经默认安装了python2.4,所以要做如下 ......
进程I/O函数,与pclose函数一起使用。
表头文件
#include <stdio.h>
函数定义
FILE * popen
( const char * command
, const char * type
);
int pclose
( FILE * stream
);
函数说明
popen() 函数通过创建一个管道,调用 fork 产生一个子进程,执行一个 shell 以运行命令来开启一 ......