随笔分类 - 操作系统
摘要:# mmap > Memory Map # 1.`mmap`使用方法 ```go func Mmap(fd int, offset int64, length int, prot int, flags int) ([]byte, error) ``` 1. fd:文件描述符 2. offset:文件
阅读全文
摘要:一、内存对齐 1.字长 计算机字长指的是CPU一次(一个时钟周期)能处理的最大长度,一般来说有如下属性 计算机字长 = 寄存器大小 = 数据总线宽度 = 地址长度 = 机器位数 计算机按次从内存读出数据,字长就是计算机每次从内存读出的数据长度,以字节为单位。 2.内存对齐的好处 假设字长为4B,如果
阅读全文
摘要:```c #include "co.h" #include #include #include enum state{ CREATED = 0, RUNNING, HALT, WAIT, FINISHED }; #define STACK_SIZE 4 * 1024 * 1024 * sizeof(
阅读全文