[计算机英语每日翻译] The Linux Kernel (LInux内核原理解析)3

在此基础上,每一个数字(一位的)代表16的某一个次方。一位十进制数只能用来表示0-9,然而对于十六进制数而言,十进制的数字10到15可以由单个字母A,B,C,D,E,F表示。例如,16进制的E是十进制的14,16进制的2A是十进制的42(两个16加上10)。当使用C编程语言时,我们在十六进制数前加上“0x”前缀以表示其为16进制数,于是,十六进制的2A应该写成 0x2A 。


微处理器可以进行加、乘、除等算术运算和逻辑运算(如“X是否比Y大”)


处理器的执行动作由一个外部的时钟控制着。这个时钟规律地产生心跳,每一次心跳,处理器就运行一小段时间。例如,一个处理器可以在每个时钟中断中执行一条指令。时钟滴答的速率代表了CPU的速度。一个100Mhz(兆赫兹)的处理器每秒钟接受1亿次时钟滴答。但是这并不是说CPU的效率由时钟滴答的速度决定,因为不同CPU在一个时钟滴答中可以执行多条指令,当然相同情况下,更快的时钟跳动速率代表了更强大的CPU。CPU执行的指令非常简单。例如:从X位置的内存读取数据到寄存器Y。寄存器是CPU的内置存储部件。有的指令可能会中断CPU正在执行的操作使其转而执行内存中的其他指令。这些微小的组件给予了CPU无限的能量使得其能在一秒钟内执行一百万甚至十亿条指令。


指令需要像被执行的时候一样从内存中读取。指令本身可能引用内存中的数据,而这些数据必须在合适的时间从内存中读取或保存进内存。


CPU中寄存器的大小,数量和类型完全由CPU的类型决定。一个Intel 4086处理器和Alpha AXP处理器的寄存器是不一样的。一开始,Intel系列是32位的而Alpha AXP则是64位的。大体上来说,虽然任意给定的处理器有许多相同目的的寄存器和较少数量的

专用寄存器。大多数寄存器有如下一些用于特殊目的的寄存器:


程序计数器(PC)

这个寄存器保存下一条执行指令的地址。每次读取一条指令,程序计数器中的内容就会自动改变。


堆栈指针(SP)

处理器必须能访问大量外置的读写随机存储器(RAM,用来帮助存储短期数据)。堆栈采用后进先出的策略(LIFO)在外部内存中方便地存取值。通常,处理器处理器有特定的指令来让你对堆栈上的值push和pop。换言之,如果你push了两个值x和y,然后pop一下,会得到y。一些堆栈从内存的顶端往下扩展而另一些则从内存的底部向上扩展。有一些处理器则都支持上述两种方式,比如ARM。


处理机状态(PS)

指令可能产生结果。例如“寄存器X的内容是否比寄存器Y的内容大?”会产生结果true或false。PS寄存器持有这个结果信息或者处理器当前状态的其他信息。例如,大多数处理器有至少两种操作模式,核心态和用户态,而PS寄存器则会记录




附:


In this base, each digital represents a power of 16. As decimal numbers only go from 0 to 9 the numbers 10 to 15 are represented as a single digit by the letters A, B, C, D, E and F. For example, hexadecimal E is decimal 14 and hexadecimal 2A is decimal 42 (two 16s) + 10). Using the C programming language notation (as I do throughout this book) hexadecimal numbers are prefaced by ``0x''; hexadecimal 2A is written as 0x2A .


Microprocessors can perform arithmetic operations such as add, multiply and divide and logical operations such as ``is X greater than Y?''.


The processor's execution is governed by an external clock. This clock, the system clock, generates regular clock pulses to the processor and, at each clock pulse, the processor does some work. For example, a processor could execute an instruction every clock pulse. A processor's speed is described in terms of the rate of the system clock ticks. A 100Mhz processor will receive 100,000,000 clock ticks every second. It is misleading to describe the power of a CPU by its clock rate as different processors perform different amounts of work per clock tick. However, all things being equal, a faster clock speed means a more powerful processor. The instructions executed by the processor are very simple; for example ``read the contents of memory at location X into register Y''. Registers are the microprocessor's internal storage, used for storing data and performing operations on it. The operations performed may cause the processor to stop what it is doing and jump to another instruction somewhere else in memory. These tiny building blocks give the modern microprocessor almost limitless power as it can execute millions or even billions of instructions a second.


The instructions have to be fetched from memory as they are executed. Instructions may themselves reference data within memory and that data must be fetched from memory and saved there when appropriate.

The size, number and type of register within a microprocessor is entirely dependent on its type. An Intel 4086 processor has a different register set to an Alpha AXP processor; for a start, the Intel's are 32 bits wide and the Alpha AXP's are 64 bits wide. In general, though, any given processor will have a number of general purpose registers and a smaller number of dedicated registers. Most processors have the following special purpose, dedicated, registers:

Program Counter (PC)
This register contains the address of the next instruction to be executed. The contents of the PC are automatically incremented each time an instruction is fetched,

Stack Pointer (SP)
Processors have to have access to large amounts of external read/write random access memory (RAM) which facilitates temporary storage of data. The stack is a way of easily saving and restoring temporary values in external memory. Usually, processors have special instructions which allow you to push values onto the stack and to pop them off again later. The stack works on a last in first out (LIFO) basis. In other words, if you push two values, x and y, onto a stack and then pop a value off of the stack then you will get back the value of y.

Some processor's stacks grow upwards towards the top of memory whilst others grow downwards towards the bottom, or base, of memory. Some processor's support both types, for example ARM.

Processor Status (PS)
Instructions may yield results; for example ``is the content of register X greater than the content of register Y?'' will yield true or false as a result. The PS register holds this and other information about the current state of the processor. For example, most processors have at least two modes of operation, kernel (or supervisor) and user. The PS register would hold information identifying the current mode.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值