最近在阅读《Understanding the Linux Kernel》(有电子版)
VFS是可以让一个进程对文件的一部分拥有exclusive lock(512页的表),这个‘部分’的单位是以byte计。回到oracle数据库,它的锁不是特殊资源,而是属性,因此不需要维护一个锁队列。这部分内容太多了~不过大家可以试想一下,你的一个session的一个sql语句就可能会牵扯到许多数据,每一部分都用文件系统的锁来管理的话,那数据库的可扩缩性就大幅度降低了,性能就更别提了。所以设计目标是为了 makes different processes on different machines access and modify the same datafile at the same time possible。(提一句,在RAC中有一个节点是resource manager)
再摘抄与cache有关的部分。
第601页: Pratically all read() and write() file operations rely on the page cache. The only exception occurs when a process opens a file with the O_DIRECT flag set: in this case, the page cache is bypassed and the I/O data transfers make use of buffers in the User Mode address space of the process; several database applications make use of O_DIRECT flag so they can use use their own disk caching algorithm.
由此可见有这样的系统调用,它允许用户进程对数据直接进行IO的,当然了,具体的指令还是要device driver来翻译一下再传送给的devicecontroller的。书中DMA部分也讲到一点,传统的block device(这里指磁盘)通常利用DMA机制把数据先传送至内存中的kernel mode区域,然后复制到user mode区域,现在可以用DMA机制让这个数据直接进入user mode内存区域。
[ 本帖最后由 feelfall 于 2007-2-19 22:30 编辑 ]