免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1871 | 回复: 0
打印 上一主题 下一主题

常用计算机英语句子或者单词 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-12-15 17:05 |只看该作者 |倒序浏览

ANSI C functions and macros for flexible logging to files and other destinations. It is
modeled after the Log for Java library (http://www.log4j.org), staying as close to their
API as is reasonable. Intended for use in time-space critical environments


The sequence number is a circular counter (skipping 0) describing how many
* times the referenced mft record has been (re)used. This has to match the
* sequence number of the mft record being referenced, otherwise the reference
* is considered stale and removed (FIXME: only ntfsck or the driver itself?).


The MFT is a set of FILE records. Each file of the volume iscompletely described by one or
more of these FILE Records. FileRecords are equivalent to inodes in Unix terminology. The
firstFILE Record that describes a given file is called the Base FILErecord and the others
are called Extension FILE Records.

A FILE Record is built up from a header, several variable lengthattributes and an end
marker (simply 0xFFFFFFFF).


短语:build up from

最大有多少。。。
As defined in $AttrDef, this attribute has aminimum size of 48 bytes and a maximum of 72
bytes.



循环操作的说法
            /*
             * Iterate similar to above big loop but applied to index buffer, thus
             * loop until we exceed valid memory (corruption case) or until we
             * reach the last entry.
             */


* If @type is AT_UNUSED, return the first found attribute, i.e. one can
* enumerate all attributes by setting @type to AT_UNUSED and then calling
* ntfs_attr_lookup() repeatedly until it returns -1 with errno set to ENOENT
* to indicate that there are no more entries. During the enumeration, each
* successful call of ntfs_attr_lookup() will return the next attribute, with
* the current attribute being described by the search context @ctx.

Premium Support
奖金支持



* To obtain a context call ntfs_index_ctx_get().
*
* When finished with the @entry and its @data, call ntfs_index_ctx_put() to
* free the context and other associated resources.
*
* If the index entry was modified, call ntfs_index_entry_mark_dirty() before
* the call to ntfs_index_ctx_put() to ensure that the changes are written
to disk.


packed

使用该属性对struct或者union类型进行定义,设定其类型的每一个变量的内存约束。当用在enum类型定义时,暗示了应该使用最小完整的类型(it indicates that the smallest integral type should be used)。

下面的例子中,my-packed-struct类型的变量数组中的值将会紧紧的靠在一起,但内部的成员变量s不会被“pack”,如果希望内部的成员变量也被packed的话,my-unpacked-struct也需要使用packed进行相应的约束。



struct my_unpacked_struct

{

      char c;

      int i;

};

         

struct my_packed_struct

{

     char c;

     int  i;

     struct my_unpacked_struct s;

}__attribute__ ((__packed__));



extern void exit(int)   __attribute__((noreturn));
extern void abort(void) __attribute__((noreturn));


一些平台对某些特定类型的数据只能从某些特定地址开始存取。比如有些架构的CPU在访问一个没有进行对齐的变量的时候会发生错误,那么在这种架构下编程必须保证字节对齐.其他平台可能没有这种情况



Chapter 1. Prologue
--
Chapter 10             epilogue  尾声,首尾
Most
embedded systems
need to be self-reliant. It's not usually possible to wait for someone to reboot them if the software hangs. Some embedded designs, such as space probes, are simply not accessible to human operators. If their software ever hangs, such systems are permanently disabled. In other cases, the speed with which a human operator might reset the system would be too slow to meet the uptime requirements of the product.
A watchdog timer is a piece of hardware that can be used to automatically detect software anomalies and reset the processor if any occur. Generally speaking, a watchdog timer is based on a
counter
that counts down from some initial value to zero. The embedded software selects the counter's initial value and periodically restarts it. If the counter ever reaches zero before the software restarts it, the software is presumed to be malfunctioning and the processor's reset signal is asserted. The processor (and the software it's running) will be restarted as if a human operator had cycled the power.
Figure 1 shows a typical arrangement. As shown, the watchdog timer is a chip external to the processor. However, it could also be included within the same chip as the
CPU
. This is done in many
microcontrollers
. In either case, the output from the watchdog timer is tied directly to the processor's reset signal.



Well, it's not supposed to work since nobody ever tried and tested it on ARM
embedded architectures. So, the misfunction is the expected behaviour. There
can be many reasons why it doesn't work. First try perhaps checking out the
code related to the ARM peculiarities. And please send your fixes, thanks


Sorry but I don't understand your request. Why is ntfs-3g more difficult to
use? You install FUSE and ntfs-3g then mount your NTFS partitions from the
command line or via /etc/fstab using the 'ntfs-3g' filesystem type instead
of 'ntfs'. What does you make believe this is more complicated? It's the
same.
You told, that you have zero problems. Well, everybody says the same. The
number of regular users is quite high based on the downloads and also
considering that the following distributions also include or have
easy-to-install ntfs-3g packages available already: Ubuntu, Gentoo, Kanotix,
Debian, openSUSE, PLD Linux, Arch Linux, Puppy LiveCD, Frugalware, Slax,
Musix, Slackware, Tilix, GParted LiveCD, Trinity Rescue Kit, Vector Linux,
ALT Linux, PUD Linux, Kurumin, Pardus Linux, Helix and Parsix.
I really can't see any reason why the driver should be fully in the kernel.
The parts which need to be there are already there, called FUSE. A fully
in-kernel driver would probably just crash and hang the OS regularly for a
long stabilization process (maybe even years to get to the point where
ntfs-3g is today) and slow down the overall development process enormously.






乘积怎么说,   2的幂怎么说 power of 2
5.1. Overview
In NTFS, the Cluster is the fundamental unit of disk usage. The number of sectors that make up a cluster
is always a power of 2, and the number is fixed when the volume is formatted. This number is called the
Cluster Factor and is usually quoted in bytes, e.g. 8KB, 2KB. NTFS addresses everything by its Logical
Cluster Number.
5.1.1. Logical Cluster Number (LCN)
Each cluster in a volume is given a sequential number. This is its Logical Cluster Number. LCN 0 (zero)
refers to the first cluster in the volume (the boot sector).
To convert from an LCN to a physical offset in the volume, multiply the LCN by the Cluster Size.
5.1.2. Virtual Cluster Number (VCN)
Each cluster of a non-resident stream is given a sequential number. This is its Virtual Cluster Number.
VCN 0 (zero) refers to the first cluster of the stream.
To locate the stream on disk, it's necessary to convert from a VCN to an LCN. This is done with the help
of data runs.


--
临近的,毗邻的
Each contiguous block of LCNs is given a Data Run, which contains a VCN, an LCN and a length.
When NTFS needs to to find an object on disk, it looks up the VCN in the Data Runs to get the LCN.


由什么组成
It is composed of attributes including its name and its data.

――
10.2. Attributes
Table 4.17. A file record attributes
Type Description Name

0x10 $STANDARD_INFORMATION
0x30 $FILE_NAME filename
0x50 $SECURITY_DESCRIPTOR
0x80 $DATA [Unnamed]

10.2.1. Standard Information
―――


unnamed data stream compulsory (chkdsk will put it back if
named data streams optional (any limit to the number?)



――
11.1. Overview
The MFT is a set of FILE records. Each file of the volume is completely described by one or more of
these FILE Records. File Records are equivalent to inodes in Unix terminology. The first FILE Record
that describes a given file is called the Base FILE record and the others are called Extension FILE Records.
A FILE Record is built up from a header, several variable length attributes and an end marker (simply
0xFFFFFFFF).
link table to notes
See also: Attributes, Standard Attribute Header, $MFT, $Boot, File, Fixup, Attribute Id, Directory,
--



关于占用多少空间的描述
Real / Allocated Size
The Allocated Size is how much space the Record takes up on disk. This should be a multiple of the
cluster size and should probably be equal to the size of an MFT File Record. The Real Size is a count of
how many bytes of the Record are actually used.


注意can的用法,表示可能, 有这个可能的用法
――
The smallest unit of disk space that NTFS uses is a Cluster. This can vary from one sector to 128 sectors,
the usual number is 8 (4KB). Naturally this is dependent on the sector and Cluster. sizes declared in
$Boot.
Because a single sector could fail, it's important for NTFS to be able to detect errors in a cluster. For this
NTFS Concepts
93
purpose the sectors have Fixups, which are kept in an Update Sequence Array.
Many important Metadata Records use fixups to protect data integrity
――

apply 应用, 作用
Here's an example before the fixup is applied, with a cluster size of 2KB (4 Sectors).


注意disk 坏掉了说法。
――
14.4.2. Reading
When reading a fixup-protected record:
1. Read the record from disk
2. Check the magic number is correct
3. Read the Update Sequence Number
4. Compare it against the last two bytes of every sector
5. Copy the contents of the Update Sequence Array to the correct places
6. If any of the checks fail when reading, it could mean there is: a bad sector, disk corruption or a fault
in the driver.


――
* NOTE: We consider the absence / invalidity of an update sequence array to
* mean error. This means that you have to create a valid update sequence
* array header in the ntfs record before calling this function, otherwise it
* will fail (the header needs to contain the position of the update sequence
* array together with the number of elements in the array). You also need to
* initialise the update sequence number before calling this function
* otherwise a random word will be used (whatever was in the record at that
* position at that time).
*/
注意无效的用法, 还有其他的从句



――no more的用法
This is a leaf node, i.e. there are no more
                                                nodes branching off it. */




--
make room for的用法


* ntfs_make_room_for_attr - make room for an attribute inside an mft record
* @m:             mft record
* @pos:            position at which to make space
* @size:            byte size to make available at this position
*
* @pos points to the attribute in front of which we want to make space.
*
* Return 0 on success or -1 on error. On error the error code is stored in
* errno. Possible error codes are:
*            ENOSPC       - There is not enough space available to complete operation. The
*                       caller has to make space before calling this.
*            EINVAL          - Input parameters were faulty.










顺序查找(Sequential Search)



注意every time的用法
The main function that triggers page frame reclaiming is try_to_free_pages( ). It is
invoked every time the kernel fails in allocating memory. For instance:

l When the grow_buffers( ) function fails to allocate a new buffer page, or the
create_buffers( ) function fails to allocate the buffer heads for a buffer page (see
Section 14.2.2 and Section 14.2.3). In these cases, the kernel executes
free_more_memory( ), which in turn invokes try_to_free_pages( ).
l When the pages_alloc( ) function fails in allocating a group of page frames in a
given list of memory zones (see Section 7.1.7). Recall that every memory zone
descriptor includes the pages_min watermark, which specifies the number of page
frames that should remain free to cope with the "low on memory" emergencies. If no
zone in the list has enough free memory to satisfy the request while preserving the
minimal pool of free page frames, the kernel invokes the balance_classzone( )
function, which in turn invokes try_to_free_pages( ).
l When the kswapd kernel thread discovers that the number of free page frames in some
memory zone falls below the pages_low watermark (see the later section Section
16.7.7).



注意at the expense of 的用法:以。。。为代价, 以牺牲什么换取什么
Disk caches enhance system performance at the expense of free RAM, while swapping
extends the amount of addressable memory at the expense of access speed. Thus, disk
caches are "good" and desirable, while swapping should be regarded as some sort of last
resort to be used whenever the amount of free RAM becomes too scarce.



注意短句子描述问题的做法
l Which kind of page to swap out
l How to distribute pages in the swap areas
l How to select the page to be swapped out
l When to perform page swap out


学习issues的用法,用来指问题, 要解决的事项。
Let's give a short preview of how Linux handles these four issues before describing the main
data structures and functions related to swapping.



§§ 注意英语也是用: 来表示要陈述 具体的事项了。
Swapping applies only to the following kinds of pages:
l Pages that belong to an anonymous memory region of a process (for instance, a
User Mode stack)
l Modified pages that belong to a private memory mapping of a process
l Pages that belong to an IPC shared memory region (see Section 19.3.5)


剩下的,其余的怎么说?
The remaining kinds of pages are either used by the kernel or used to map files on disk. In
the first case, they are ignored by swapping because this simplifies the kernel design; in the
second case, the best swap areas for the pages are the files themselves.


§§Entry这个词最常用了, 比如文件系统里面得目录项(dir dentry),索引项(index entry) ,  这里有一个页表项(Page Table Entry)
Some computer platforms provide sophisticated(世故的,诡辩的,相当好的,经得起考验得) support for LRU algorithms; for instance,
the CPUs of some mainframes automatically update the value of a counter included in each Page Table entry to specify the age of the corresponding page. But 80 x 86 processors do not offer such a hardware feature, so Linux cannot use a true LRU algorithm. However, when selecting a candidate(候选者) for swap out, Linux takes advantage of the Accessed flag included in each Page Table entry(翻译成页表项), which is automatically set by the hardware when the page is accessed. As we'll see later, this flag is set and cleared in a rather simplistic (怎么用这个词,金山词霸译为“过分单纯话的”)way to keep pages from being swapped in and out too much.


§§keep pages from being swapped in and out too much.

§§allocate 分配  VS  reclaim(回收,释放)   
  malloc VS free

§§获得信号量   hold the semaphore
§§复杂的长句 ,   作者的意思是 当kernel routine 无法获得足够的内存来执行的话, 那么kernel就会crash , 那么显然 这个kernel routine 应该是非常重要的某个function 。中心意思就是 kernel必须保留足够的memory来保证紧急的重要的routine 可以运行, 一旦系统的memory低于predefined threshold,就会执行swap out操作 。 kernel的做法就是有两种:主动防御(定期的检查,少于predefined threshold的时候, kswapd就被激活)和 被动的(当伙伴系统无法分配内存的时候)


注意操作系统里面的伙伴系统的说法(buddy system)
预定义的  predefined threshold.  (比如60分及格,那么60分就是个predefined threshold

Swapping out is useful when the kernel is dangerously low on memory. As the kernel's first
defense against critically low memory, it keeps a small reserve of free page frames that can
be used only by the most critical functions. This turns out to be essential to avoid system   
crashes, which might occur when a kernel routine invoked to free resources is unable to obtain the memory area it needs to complete its task. To protect this reserve of free page frames, Linux may perform a swap out on the following occasions: 在什么情况下 ,linux可能会执行换出的动作呢?
By a kernel thread denoted as kswapd that is activated periodically whenever the number of free page frames falls below a predefined threshold.
When a memory request to the buddy system cannot be satisfied because the number of free page frames would fall below a predefined threshold. 伙伴系统无法满足memory request(可能是某个用户进程malooc了),因为一旦满足了,就低于predefined threshold,这个时候,就执行swap out操作了。


§§注意performance-critical 的翻译(对性能至关重要的)
The virtual memory subsystem of Linux is, without any doubt, the most complex and performance-critical component of the whole kernel.


§§学习,先后的表达顺序,
虚拟内存子系统
In previous chapters, we explained how the kernel handles dynamic memory by keeping track of free and busy page frames. We have also discussed how every process in User Mode has its own linear address space so that page frames can be assigned to the process at the very last  possible moment. Finally, we have also described how dynamic memory is used to cache the data of the slow block devices.


§§很有价值的一段论述:
注意while连词的用法,contiguous用法,
dynamic memory

We saw in Chapter 2 how Linux takes advantage of 80 x 86's segmentation and paging circuits to translate logical addresses into physical ones. We also mentioned that some
portion of RAM is permanently assigned to the kernel and used to store both the kernel code and the static kernel data structures. The remaining part of the RAM is called dynamic memory. It is a valuable resource, needed not only by the processes but also by the kernel itself. In fact, the performance of the entire
system depends on how efficiently dynamic memory is managed. Therefore, all current multitasking operating systems try to optimize the use of dynamic memory, assigning it only when it is needed and freeing it as soon as possible.

This chapter, which consists of three main sections, describes how the kernel allocates dynamic memory for its own use. Section 7.1 and Section 7.2 illustrate two different techniques for handling physically contiguous memory areas, while Section 7.3 illustrates a third technique that handles noncontiguous memory areas.


§§双向循环链表
Contains pointers to next and previous items in a doubly linked
list of page descriptors


Contains pointer to next item in a doubly linked circular list of
the page cache hash table

§§right now , 现在目前
You don't have to fully understand the role of all fields in the page descriptor right now.


注意unless的用法
The flag is set after completing a read operation, unless a disk I/O error happened.


The Least Recently Used (LRU) Lists
注意LRU的全称


§§注意上下,区间的表达方式
In an ideal computer architecture, a page frame is a memory storage unit that can be used for anything:
storing kernel and user data, buffering disk data, and so on. Any kind of page of data can be stored in any page frame, without limitations.
However, real computer architectures have hardware constraints that may limit the way page frames can be used. In particular, the Linux kernel must deal with two hardware constraints of the 80 x 86 architecture:
·          The Direct Memory Access (DMA) processors for ISA buses have a strong limitation: they are able to address only the first 16 MB of RAM.

·          In modern 32-bit computers with lots of RAM, the CPU cannot directly access all physical memory because the linear address space is too small.


To cope with these two limitations, Linux partitions the physical memory in three zones:
ZONE_DMA
Contains pages of memory below 16 MB
ZONE_NORMAL
Contains pages of memory at and above 16 MB and below 896 MB
ZONE_HIGHMEM
Contains pages of memory at and above 896 MB



Memory Addressing
Address加分词的时候, 表示寻址


注意 健壮的表达方法,robust
寻址技术的表达:addressing techniques  

This chapter deals with addressing techniques.
Luckily, an operating system is not forced to keep track of physical memory all by itself; today's microprocessors include several hardware circuits to make memory management both more efficient and more robust in case of programming errors.



implementation details
实现细节
most popular platform


§§外国的语言也丰富的嘞
内存管理系统,
分配内存 allocate memory
指派 assigned  , addresses are assgined to processes

This is the first of three chapters related to memory management;
Chapter 7 discusses how the kernel allocates main memory to itself, while Chapter 8 considers how linear addresses are assigned to processes.


§§关于地址的描述
Logical address
Included in the machine language instructions to specify the address of an operand or of an instruction. This type of address embodies the well-known 80 x x86 segmented architecture that forces MS-DOS and Windows programmers to divide  their programs into segments. Each logical address consists of a segment and an offset (or displacement) that denotes the distance from the start of the segment to the actual address.


Linear address (also known as virtual address)
A single 32-bit unsigned integer that can be used to address up to 4 GB — that is(也就是), up  to 4,294,967,296 memory cells. Linear addresses are usually represented in hexadecimal notation; their values range from 0x00000000 to 0xffffffff.
形容数字的范围:range from a to b
up to 高达

Physical address
Used to address memory cells in memory chips. They correspond to the electrical signals sent along the address pins of the microprocessor to the memory bus. Physical addresses are represented as 32-bit unsigned integers.
Be represented as 用。。。表达



by means of
通过什么, 或者是通过什么办法

transforms 计算机英语出现频率比较高的词语了。
The CPU control unit transforms a logical address into a linear address by means of a hardware circuit called a segmentation unit; subsequently, a second hardware circuit called a paging unit transforms the linear address into a physical address (see Figure 2-1).
Subsequently  在这里承前启后               

§§并发的


In multiprocessor systems, all CPUs share the same memory; this means that RAM chips may be accessed concurrently by independent CPUs. Since read or write operations on a RAM chip must be performed serially, a hardware circuit called a memory arbiter is inserted between the bus and every RAM chip.
注意下面的这句话,怎么表述两种相反的情况。
Its role is to grant access to a CPU if the chip is free and to delay it if the chip is busy servicing a request by another processor.


单处理器系统  uniprocessor systems
Even  uniprocessor systems use memory arbiters, since they include a specialized processor called DMA that operates concurrently with the CPU (see Section 13.1.4).

operates concurrently with sb.  与 。。。并发操作,一起操作



完全不同: 怎么说?
>> entirely different
for example , A is entirely different from B .

§§在这种情况下的说法
A running process may decide to load an entirely different program. In this case, the process ID remains unchanged but the memory regions used before loading the program are released and a new set of memory regions is assigned to the process

A running process 一个正在运行的进程
Before , 很常用的一个词语 ,
Used before
A set of 一组…



A process may create an IPC-shared memory region to share data with other
cooperating processes. In this case, the kernel assigns a new memory region to the process to implement this construct (see Section 19.3.5).


expand 扩充 ,经常用的词


see Section 8.6 later in this chapter
写mail的时候, 会用到的。




上面提到的 previously metioned
Table 8-1 illustrates some of the system calls related to the previously mentioned tasks. With the exception of brk( ), which is discussed at the end of this chapter, the system calls are described in other chapters.

注意thus 的用法, 表示第进的关系
Creates a new process, and thus a new address space



对于共享内存来说,  一定要记住这个词 attach ,和Detach


关于page的一段精彩描述
It is possible to have just one wait queue in the zone, but that would mean
that all processes waiting on any page in a zone would be woken up when one
was unlocked. This would cause a serious thundering herd problem. Instead, a
hash table of wait queues is stored in zone twait table. In the event of a hash
collision, processes may still be woken unnecessarily, but collisions are not expected to occur frequently.




The table is allocated during free area init core(). The size of the table is
calculated by wait table size() and is stored in zone twait table size. The
maximum size it will be is 4,096 wait queues. For smaller tables, the size of the table
is the minimum power of 2 required to store NoPages / PAGES PER WAITQUEUE
number of queues, where NoPages is the number of pages in the zone and
PAGE PER WAITQUEUE is defined to be 256. In other words, the size of the table
is calculated as the integer component of the following equation:

wait table size = log2( NoPages × 2 /PAGE PER WAITQUEUE 1)

执行某个任务: performs this task
还有要列举的时候, 或者举例子的时候, 可以用follows ,或者 is following
Predictably,each architecture performs this task differently, but the objective is always the same: to determine what parameters to send to either free area init() for UMA architectures or free area init node() for NUMA. The only parameter required for UMA is zones size. The full list of parameters follows:


内核定义的变量还是比较好认的, 比如 number ,常定义为nr
比如 page_nr  , 而且还是比较单复数的。
MAX_NR_ZONES

在文件系统和内存部分, 描述符这个词经常出现:descriptor
常简写为desc 或者 DESC  

indices index的复数形式


§§学习分词的用法:
/*
*Right now a zonelist takes up less than a cacheline. We never
* modify it apart from boot-up, and only a few indices are used,
* so despite the zonelist table being relatively big, the cache
* footprint of this construct is very small.

*/



§§如何介绍一个结构体里面的field

结构体里面的成员变量怎么表达?  Field
下面对每个字段作一个简要的介绍:
Here is a brief description of each of the fields:
list Pages may belong to many lists, and this field is used as the list head. For example, pages in a mapping will be in one of three circular linked links kept by the address space. These are clean pages, dirty pages and locked pages.
In the slab allocator, this field is used to store pointers to the slab and cache
structures managing the page when it has been allocated by the slab allocator.
It is also used to link blocks of free pages together.


§§引用计数的标准写法
这里drop to zero ,也可以用reaching zero
count This is the reference count to the page. If it drops to zero, it may be freed. If it is any greater, it is in use by one or more processes or is in use by the kernel like when waiting for I/O.

§§平台相关怎么说?architecture-specific
flags These are flags that describe the status of the page. All of them are declared in linux/mm.h> and are listed in Table 2.1. A number of macros defined for
testing, clearing and setting the bits are all listed in Table 2.2. The only really
interesting flag is SetPageUptodate(), which calls an architecture-specific
function, arch set page uptodate(), if it is defined before setting the bit.

#define SetPageUptodate(page) \
            do {                                                                                         \
                        arch_set_page_uptodate(page);                                                \
                        set_bit(PG_uptodate, &(page)->flags);                         \
            } while (0)

§§内存里面 LRU 的全称:Least Recently Used (LRU)



§§实用句子
/*
* The zone_table array is used to look up the address of the
* struct zone corresponding to a given zone number (ZONE_DMA,
* ZONE_NORMAL, or ZONE_HIGHMEM).
*/


在某个函数执行期间,或者代码范围内, during xxx()
MAX NR ZONES is the maximum number of zones that can be in a node, i.e.,
three. MAX NR NODES is the maximum number of nodes that may exist. The function
EXPORT SYMBOL() makes zone table accessible to loadable modules. This table is
treated like a multidimensional array. During free area init core(), all the pages
in a node are initialized. First, it sets the value for the table


§§内存管理 ,  地址要4K边界对齐
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT            12
#define PAGE_SIZE            (1UL
#define PAGE_MASK            (~(PAGE_SIZE-1))




§§kernel的代码看起来,就给人舒服的感觉

重点学习, 怎么样阐述自己的函数的功能, 怎么实现的, 相反的操作怎么说 ,
As we saw in Section 3.6, Linux sets up a direct mapping from the physical address
0 to the virtual address PAGE OFFSET at 3GiB on the x86. This means that any
virtual address can be translated to the physical address by simply subtracting
PAGE OFFSET, which is essentially what the function virt to phys() with the macro
pa() does:
/* from  */
132 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
/* from  */
76 static inline unsigned long virt_to_phys(volatile void * address)
77 {
78 return __pa(address);
79 }
reverse 可逆的, 逆向的操作
Obviously, the reverse operation involves simply adding PAGE OFFSET, which is
carried out by the function phys to virt() with the macro va(). Next we see
how this helps the mapping of struct pages to physical addresses.

Page结构体到物理地址的映射


§§又一段精彩的关于mem_map的位置的精彩描述:


As we saw in Section 3.6.1,
the kernel image is located at the physical address 1MiB, which of course translates to the virtual address PAGE OFFSET + 0x00100000, and a virtual region totaling about 8MiB is reserved for the image, which is the region that can be addressed by two PGDs. This would imply(暗示) that the first available memory to use is located at 0xC0800000, but that is not the case(事实上并非如此).
Linux tries to reserve the first 16MiB of memory for ZONE DMA, so the first virtual area used for kernel allocations is actually 0xC1000000. This is where the global mem map is usually located.

这个句子表达的相当精彩。中国人不大能写出这样的地道的英语
ZONE_DMA will still get used, but only when absolutely necessary.
ZONE_DMA区仍然要使用,只是非到万不得已的时候不用


§§看看物理地址是如何转换到struct pages的呢?
学习 右移n位怎么说?   Shift n bits to right
Physical addresses are translated to struct pages by treating them as an index into the mem map array(当成数组的下标). Shifting physical address PAGE_SHIFT bits to the right will treat them as a Page Frame Number (PFN) from physical address 0, which is also an index within the mem map array. This is exactly what the macro virt to page() does, which is declared as follows in asm-i386/page.h>:
//学习这样比较标准的说法,很简单,但你自己说真未必能这么地道:
#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))

//作者又把上面的转化的过程,又用另一种方式,表达了出来。
//由此可见英语的内容真的很丰富,但是看看我们写的呢?都是千篇一律。

The macro virt to page() takes the virtual address kaddr, converts it to the physical address with pa(), converts it into an array index by bit shifting PAGE SHIFT bits right and indexing into the mem map by simply adding them together. //注意表达方式
No macro is available for converting struct pages to physical addresses, but, at this stage, you should see how it could be calculated.

indexing into the mem map 的用法以后可以用的上


Linux layers the machine independent/dependent layer in an unusual manner in
comparison to other operating systems [CP99]. Other operating systems have objects
that manage the underlying physical pages, such as the pmap object in BSD.
Linux instead maintains the concept of a three-level page table in the architectureindependent
code even if the underlying architecture does not support it. Although
this is conceptually easy to understand, it also means that the distinction between
different types of pages is very blurry, and page types are identified by their flags
or what lists they exist on rather than the objects they belong to.




This chapter will begin by describing how the page table is arranged (如何被安排)



This chapter will begin by describing how the page table is arranged and what
types are used to describe the three separate levels of the page table. Next is how a virtual address is broken up into its component parts for navigating the table. After this is covered, I discuss the lowest level entry, the PTE, and what bits are used by the hardware. After that, the macros used for navigating a page table and setting and checking attributes will be discussed before talking about how the page table is populated and how pages are allocated and freed for the use with page tables. The initialization stage is then discussed, which shows how the page tables are initialized during boot strapping. Finally, I cover how the TLB and CPU caches are utilized.

§§boundary   边界范围   最常用的词语了

这段是描述 CPU  ,一级,二级缓存方面的。
CPU caches are organized into lines. Each line is typically quite small, usually
32 bytes, and each line is aligned to its boundary size. In other words, a cache line of 32 bytes will be aligned on a 32-byte address. With Linux, the size of the line is L1 CACHE BYTES, which is defined by each architecture.


§§描述进程地址空间的相关
One of the principal advantages of virtual memory is that each process has its own
virtual address space, which is mapped to physical memory by the operating system.
In this chapter I discuss the process address space and how Linux manages it

§§what process is on the CPU  (注意CPU在运行哪个进程的说法)
The kernel treats the userspace portion of the address space very differently from
the kernel portion. For example, allocations for the kernel are satisfied immediately and are visible globally no matter what process is on the CPU.



§§ 看看对于一个进程而言,是怎样分配内存的。

With a process, space is simply reserved in the linear address space
by pointing a page table entry to a read-only globally visible page filled with zeros.
On writing, a page fault is triggered, which results in a new page being allocated,
filled with zeros, placed in the page table entry and marked writable.
注意上面, 都是分词表达的。
The new page is filled with zeros so that it will appear exactly the same as the global zero-filled page.

zero-filled  用0填充的  ,


§§raise的用法
address errors raised from the userspace.


§§看看如何描述一个章节的简要介绍 ,
还有 ,创建,初始化, 回收(destory) ,  例外(exception)
This chapter begins with how the linear address space is broken up and what
the purpose of each section is. I then cover the structures maintained to describe
each process, how they are allocated, initialized and then destroyed.
Next, I cover how individual regions within the process space are created and all the various functions associated with them. That will bring us to exception handling related to the process address space, page faulting and the various cases that occur to satisfy a page fault.
Finally, I cover how the kernel safely copies information to and from userspace.


§§角度 , 分割 , 分为几部分
change with 随着 , 比如随着进程上下文的切换
From a user perspective, the address space is a flat linear address space, but, predictably,the kernel’s perspective is very different. The address space is split into two parts: the userspace part, which potentially changes with each full context switch(上下文切换), and the kernel address space, which remains constant.



§§页对齐的说法 page-aligned

§§临界区(critical region)
NOTE! We MUST NOT take any locks for this case. (类似的说法应该页可以用hold any locks)We may  be in an interrupt or a critical region, and should only copy the information from the master page table, nothing more.



//注意这里的注释,说明函数返回的address,究竟可以用在哪里?
/**
*            phys_to_virt     -            map physical address to virtual
*            @address: address to remap
*         The returned virtual address is a current CPU mapping for
*         the memory address given. It is only valid to use this function on
*            addresses that have a kernel mapping
*
*         This function does not handle bus mappings for DMA transfers. In
*         almost all conceivable cases a device driver should not be using
*         this function
*/





§§函数的注释
注意routine , hold的用法


/*
* This routine is used to map in a page into an address space: needed by
* execve() for the initial stack and environment pages.
*
* tsk->mmap_sem is held for writing.
*/
void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address)
{
            pgd_t * pgd;
            pmd_t * pmd;
            pte_t * pte;
            struct vm_area_struct *vma;
            pgprot_t prot = PAGE_COPY;

            if (page_count(page) != 1)
                        printk(KERN_ERR "mem_map disagrees with %p at %08lx\n", page, address);
            pgd = pgd_offset(tsk->mm, address);

            spin_lock(&tsk->mm->page_table_lock);
            pmd = pmd_alloc(tsk->mm, pgd, address);
           if (!pmd)
                        goto out;
            pte = pte_alloc(tsk->mm, pmd, address);
            if (!pte)
                        goto out;
            if (!pte_none(*pte))
                        goto out;
            lru_cache_add(page);
            flush_dcache_page(page);
            flush_page_to_ram(page);
            /* lookup is cheap because there is only a single entry in the list */
            vma = find_vma(tsk->mm, address);
            if (vma)
                        prot = vma->vm_page_prot;
            set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(page, prot))));
            tsk->mm->rss++;
            spin_unlock(&tsk->mm->page_table_lock);

            /* no need for flush_tlb */
            return;
out:
            spin_unlock(&tsk->mm->page_table_lock);
            __free_page(page);
            force_sig(SIGKILL, tsk);
            return;
}




§§函数注释
/**
* kmem_cache_alloc - Allocate an object
* @cachep: The cache to allocate from.
* @flags: See kmalloc().
*
* Allocate an object from this cache.  The flags are only relevant
* if the cache has no available objects.
*/
void * kmem_cache_alloc (kmem_cache_t *cachep, int flags)
{
            return __kmem_cache_alloc(cachep, flags);
}


§§术语 (term)
we use the term "page" to refer both to a set of linear addresses and to
the data contained in this group of addresses.


§§怎么作定义,比如 0~4091定义为page 0
denote … as …
interval ranging between … and …  

In particular, we denote the linear address interval ranging between 0 and 4,095 as page 0, the linear address interval ranging between 4,096 and 8,191 as page 1, and so forth. Each memory region therefore consists of a set of pages that have consecutive page numbers.


§§无题

The first kind of flag is used by the 80 x 86 hardware to check whether the requested kind of addressing can be performed; the second kind is used by Linux for many different purposes (see Table 7-2).

§§代表  on behalf of
GFP_USER - Allocate memory on behalf of user.  May sleep.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/8800/showart_216417.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP