flushthink

just for essential skill
随笔 - 14, 文章 - 0, 评论 - 30, 引用 - 0
数据加载中……

mm1

cpu发出线性地址,linux内存管理单元做如下四步:
1.用线性地址中最高的那一位段作为下标在PGD中找到相应的表项,该表项指向相应的中间目录PMD。
2.用线性地址中的第二个位段作为下标在第一步中找到的表项中找相应的表项,该表项指向相应的页面表。
3.用线性地址中的第三个位段作为下标在页面表中找到相应的表项PTE,该表项中存放的就是指向物理页面的指针。
4.线性地址中最后位段为物理页面的相对位移量,将此位移量与目标物理页面的起始地址相加便得到相应的物理地址。

linux为了兼容所有的cpu体系结构,特意对内存管理进行了一层抽象。
常规映射是: 进程虚拟地址(线性地址)->页目录->中间目录->物理地址
而对i386的cpu直接略过中间目录的映射。
其中PGD == page dir,PMD == page middle dir, PTE == page table entry。
这个过程可以有mmu来处理。

posted @ 2009-10-21 16:32 tiny 阅读(1137) | 评论 (0)编辑 收藏

enable_shared_from_this、weak_ptr、shared_ptr

     摘要: 网上说weak_ptr是shared_ptr的观察员,weak_ptr不会干扰shared_ptr机制,当weak_ptr所观察的shared_ptr要释放对象时,weak_ptr的指针将被置空,避免空悬指针。weak_ptr只能通过shared_ptr或weak_ptr构造。对于一个shared_ptr,它分别对强引用和弱引用都做了计数。 上图是下面代码的调试信息。 #include&nbs...  阅读全文

posted @ 2009-09-17 15:14 tiny 阅读(2097) | 评论 (0)编辑 收藏

log4cxx的编译

首先下载apr-1.2.11-win32-src.zip、apr-util-1.2.10-win32-src.zip、apache-log4cxx-0.10.0.zip,还有sed for windows
解压,然后重命名前2个文件夹为apr,apr-util(去掉版本信息),把apr,apr-util,apache-log4cxx-0.10.0这3放在同一个目录,然后执行apache-log4cxx-0.10.0里的configure.bat和configure_aprutil.bat(用到sed)这2个,最后进入projects,打开log4cxx项目,编译吧。

posted @ 2009-06-02 17:08 tiny 阅读(366) | 评论 (0)编辑 收藏

游戏资源归档

最近玩了玩泰坦之旅,主要是因为它提供了mod工具。
就打包工具ArchiveTool.exe来说说。
在控制台直接无参数运行ArchiveTool.exe得到以下帮助信息:
Usage: archiveTool <file> <command> [command arguuments]
commands:
    -add <directory> <base> [compression (0: min, 9: max)]: add a file or directory
        relative to the base directory. If a file is already in the archive it will not be added.
    -replace <directory> <base> [compression (0: min, 9: max)]: replace a file or directory
        relative to the base directory. If a file is already in the archive it will be overwritten.
    -update <directory> <base> [compression (0: min, 9: max)]: update a file ordirectory
        relative to the base directory. Files will only be added if they are newer than
        those already in the archive.
    -remove <file> : remove a file from the archive.
    -extract <location> [file] : extract the files or specified file to thespecified location.
    -removeMissing <file> <base> : remove the files that are not in the specified directory.
    -compact : compact the archive removing unused files.
    -list : list the files in the archive.
    -stats : display the archive statistics.

posted @ 2009-06-01 18:13 tiny 阅读(1266) | 评论 (0)编辑 收藏

仅列出标题
共2页: 1 2