会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
行者行者行者
博客园
首页
新随笔
联系
订阅
管理
2023年2月1日
Pro Git -- push remote commit error or code error (bug fixed)
摘要: $ git reset --hard d52aebf(commit code) $ git log $ git push origin HEAD:master --force NOTE: 这样会撤掉 reset commit code 之前的,提交的commit 和 code,提交的显示界面会有强制
阅读全文
posted @ 2023-02-01 16:48 行者行者行者
阅读(34)
评论(0)
推荐(0)
2022年2月26日
从字节对齐方式的角度看内存管理
摘要: 背景:字节对齐是编译器来处理的,但是我们依然需要适当关注;字节对齐是为了提高内存系统性能(字节对齐可以减少内存访问的次数) 主流的字节对齐方法 一、结构体中调整成员变量的顺序 struct test{ int a; char b; int d; short d; } 占用空间:4+4+4+4 =16
阅读全文
posted @ 2022-02-26 14:33 行者行者行者
阅读(41)
评论(0)
推荐(0)
可执行文件的角度看变量存储空间
摘要: 一、可执行文件及objdump输出 build/kernel.img: file format elf64-little Sections: Idx Name Size VMA LMA File off Algn 0 init 0000b5b0 0000000000080000 0000000000
阅读全文
posted @ 2022-02-26 14:11 行者行者行者
阅读(132)
评论(0)
推荐(0)
2022年2月15日
mmap接口实现原理
摘要: 一、内存映射是一个很有趣的思想,我们都知道操作系统分为用户态和内核态,用户态是不能直接和物理设备打交道,如果我们用户空间想访问硬盘的一块区域数据,则需要两次拷贝(硬盘->内核->用户),但是内存映射的设计只需要发生一次拷贝,大大提高了读取数据的效率。 二、内存映射如下图: 三、mmap()必须以PA
阅读全文
posted @ 2022-02-15 21:32 行者行者行者
阅读(478)
评论(0)
推荐(0)
2022年2月12日
mmap应用--调用mmap的常见接口和命令
摘要: 一、 ls malloc和pthread_create ls命令: % time seconds usecs/call calls errors syscall 0.00 0.000000 0 7 read 0.00 0.000000 0 1 write 0.00 0.000000 0 12 clo
阅读全文
posted @ 2022-02-12 10:22 行者行者行者
阅读(110)
评论(0)
推荐(0)
2022年2月11日
mmap应用--进程间通信&设备操作&共享内存
摘要: 一、两个程序映射同一个文件到自己的地址空间, 进程A先运行, 每隔两秒读取映射区域, 看是否发生变化. 进程B后运行, 它修改映射区域, 然后推出, 此时进程A能够观察到存储映射区的变化。 #include <sys/mman.h> #include <sys/stat.h> #include <f
阅读全文
posted @ 2022-02-11 20:26 行者行者行者
阅读(130)
评论(0)
推荐(0)
2022年2月9日
mmap接口--应用
摘要: 一 mmap用于映射文件的读写 #include <stdio.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include
阅读全文
posted @ 2022-02-09 20:50 行者行者行者
阅读(68)
评论(0)
推荐(0)
公告