REDUCED INSTRUCTION SET COMPUTERS Studies of the execution behavior of high-level language programs have provided guidance in designing a new type of processor architecture:the reduced instruction set computer(RISC).Assignment statements predominate,suggesting that the simple movement of data should be optimized.There are also many IF and LOOP instructions,which suggest that the underlying sequence control mechanism needs to be optimized to permit efficient pipelining.Studies of operand reference patterns suggest that it should be possible to enhance performance by keeping a moderate number of operands in registers. These studies have motivated the key characteristics of RISC machines:(1)a limited instruction set with a fixed format.(2)a large number of registers or the use of a compiler that optimizes register usage,and(3)an emphasis on optimizing the instruction pipeline. The simple instruction set of a RISC lends itself to efficient pipelining because there are fewer and more predictable operations performed per instruction.[1] A RISC instruction set architecture also lends itself to the delayed branch technique,in which branch instructions are rearranged with other instructions to improve pipeline efficiency. Although RISC systems have been defined and designed in a variety of ways by different groups,the key elements shared by most designs are these: .A large number of general-purpose registers,or the use of compiler technology to optimize register usage .A limited and simple instruction set .An emphasis on optimizing the instruction pipeline Table 2-1 compares several RISC and non-RISC systems. 1.Instruction Execution Characteristics To understand the line of reasoning of the RISC advocates,we begin with a brief review of instruction execution characteristics.The aspects of computation of interest are as follows: • Operations performed:These determine the functions to be performed by the processor and its interaction with memory. • Operands used:The types of operands and the frequency of their use determine the memory organization for storing them and the addressing modes for accessing them. • Execution sequencing:This determines the control and pipeline organization. 2.The Use of A Large Register File [2] The reason that register storage is indicated is that it is the fastest available storage device,faster than both main memory and cache.The register file is physically small,generally on the same chip as the ALU and control unit,and employs much shorter addresses than addresses for cache and memory.Thus,a strategy is needed that will allow the most frequently accessed operands to be kept in registers and to minimize register-memory operations. Two basic approaches are possible,one based on software and the other on hardware.The software approach is to rely on the compiler to maximize register usage.The compiler will attempt to allocate registers to those variables that will be used the most in a given time period.This approach requires the use of sophisticated programanalysis algorithms.The hardware approach is simply to use more registers so that more variables can be held in registers for longer periods of time. 3.Characteristics of Reduced Instruction Set Architectures Although a variety of different approaches to reduced instruction set architecture have been taken,certain characteristics are common to all of them.These characteristics are listed in Table 2.1 and described here. The first characteristic listed in Table 2.1 is that there is one machine instruction per machine cycle.A machine cycle is defined to be the time it takes to fetch two operands from registers,perform an ALU operation,and store the result in a register.Thus,RISC machine instructions should be no more complicated than,and execute about as fast as,microinxtructions on CISC machines.[3] With simple,one –cycle instructions,there is little or no need for microcode;the machine instructions can be hardwired[4].Such instructions should execute faster than comparable machine instructions on other machines,since it is not necessary to access a microprogram control store during instruction execution. A second characteristic is that most operations should be register-to-register,with only simple LOAD and STORE operations accessing memory.This design feature simplifies the instruction set and therefore the control unit.For example,a RISC instruction set may include only one or two ADD instructions(e. g. ,integer add,add with carry);the VAX has 25 different ADD instructions.Another benefit is that such an architecture encourages the optimization of register use,so that frequently accessed operands remain in high-speed storage. Returning to Table 2-1,a third characteristic is the use of simple addressing modes.Almost all instructions use simple register addressing.Several additional modes,such as displacement and PC-relative,may be included.Other,more complex modes can be synthesized in software from the simple ones.Again,this design feature simplifies the instruction set and the control unit. A final common characteristic is the use of simple instruction formats.Generally,only one or a few formats are used.Instruction length is fixed and aligned on word boundaries.Field locations,especially the opcode,are fixed.This design feature has a number of benefits.With fixed fields,opcode decoding and register operand accessing can occur simultaneously.Simplified formats simplify the control unit.Instruction fetching is optimized since word-length units are fetched.This also means that a single instruction does not cross page boundaries. NOTES [1] lend itself to适合于… [2] register file寄存器组,作为数据或指令的临时存放处的一种多位寄存器组,有时称作栈。 [3] 此句为比较结构no more... than…,中间插入并列句将被比较对象隔开了。 [4] hardwired硬连线的,即机器指令是固化在硬件(芯片)上的。 KEYWORDS instruction set 指令系统,指令集 reduced instruction set computer(RISC) 精简指令系统计算机 pipeline 流水线 operand 操作数 register 寄存器 compiler 编译器,编译程序 branch instruction 转移指令,分支指令 Complex Instruction Set Computer(CISC) 复杂指令系统计算机 superscalar 超级标量 register file 寄存器组,栈 machine cycle 机器周期 microinstruction 微指令 microcode 微代码,微指令 nncroprogram 微程序 addressing 编址,寻址 精简指令系统计算机(RISC) 对高级语言程序执行性能的研究已经为设计新型处理器体系结构-一精简指令系统计算机提供了指南。赋值语句占据的优势表明应对单纯的数据传送进行优化。还有很多IF和LOOP指令存在,需要优化基本的顺序控制机构,以使流水线作业高效率。操作数引用模式的研究表明,在多个寄存器中保存适当数量的操作数,可以提高性能。 这些研究已经形成了RISC机的一些关键特性:(1)有限的固定格式的指令集;(2)使用大量的寄存器或使用编译器优化寄存器应用;(3)重点优化指令流水线。 因为每条指令完成少数的且多为可预测的操作,RISC的简单指令系统适合高效流水线作业。RISC指令系统体系结构也适合于延迟转移技术,在这种技术中,随同其他指令重新安排转移指令以提高流水线效率。 虽然RISC系统已经由不同的(企业)集团以各种方式进行了定义和设计,但大多数设计所提出的关键元素还是共同的。 用大量的通用寄存器(或使用编译器技术)来优化寄存器的使用; 有限的简单指令系统; 重点优化指令流水线作业。 表2-1比较了几种RISC和非RISC系统。 1.指令执行特性 为了解RISC倡导者们的推理思路,首先观察一下指令执行的一些特性。所要关心的计算特性如下所述。 所完成的操作:这些操作决定了处理器要完成的功能和处理器与存储器的交互 所用的操作数:操作数的类型和使用频度决定了存储操作数的存储机制和访问这些操作数的编址方式。 执行顺序:决定了控制和流水线的机制 2.大寄存器组的应用 使用寄存器存储的理由在于它是可用的最快的存储器件,比主存储器和高速缓存都快。寄存器组实际很小,通常与算术逻辑部件和控制器放在同一芯片上,而且使用比高速缓存和内存储器短很多的地址。因而需要一种允许最频繁访问的操作数保存在寄存器中并使寄存器-存储器操作降至最少的策略。 有两种可以采用的基本方法,一种基于软件,一种基于硬件。软件方法靠编译程序最大限度使用寄存器,编译程序力图将给定时间周期内最常用的那些变量分配到这些寄存器中。这一方法要求使用复杂的程序分析算法。硬件方法就是简单地使用更多的寄存器,使更多的变量保存在寄存器中供长时间使用。 3.精简指令系统体系结构的特性 尽管精简指令系统结构的可用方法有多种,但对它们而言有一些特性是共同的。这些特性列在表2-1中,下面进行解释。 表2-1中列出的第一个特性是每个机器周期有一条机器指令。一个机器周期定义为,机器从寄存器组中取出两个操作数,完成一种算术逻辑部件运算并将结果存入一个寄存器中所用的时间。RISC机器指令应该不比CISC机上的微指令复杂,并且执行起来也很快。因为简单,单周期指令仅需少量或不需要微代码;机器指令可以是硬连线的。这样指令执行起来比其他机器的类似机器指令要快,因为在指令执行期间它不必访问微程序控制存储器。 第二个特性是,大多数操作应该是寄存器对寄存器的,仅有简单的取(LOAD)和存(STORE)操作访问存储器。这种设计特点简化了指令系统,因而也简化了控制器。例如,一个RISC指令系统可以只包括一两种加法(ADD)指令〔例如整数加,进位加〕;VAX机则有25种不同的加法指令。另一好处是这种体系结构促进了对寄存器使用的优化,使得频繁访问的操作数保存在高速存储器中。 从表2-1还可看出第三个特性是采用简单的编址方式。几乎所有指令都采用简单的寄存器编址。几种附加的方式,如移位和与PC有关的方式可以包括进去。另外,更为复杂的方式可以用简单的方式在软件中合成。再次强调,这种设计特点简化了指令系统和控制器。 最后一个共同特性是采用简单的指令格式。一般来讲,只使用了一种或少数几种格式。指令长度是固定的并按字的边界调整。字段的位置,特别是操作码的位置是固定的。这种设计有很多优点,使用固定字段,操作码译码和寄存器操作数访问可同时进行。简化的格式简化了控制器;因为是按字长单位来读取的,所以,取指令也得到优化。这也表明一条指令不会跨页。
What is a Computer?A computer is a programmable machine. The two principal characteristics of a computer are: it responds to a specific set of instructions in a well-defined manner and it can execute a prerecorded list of instructions (a program).Modern Computers DefinedModern computers are electronic and digital. The actual machinery -- wires, transistors, and circuits -- is called hardware; the instructions and data are called general-purpose computers require the following hardware components:memory: enables a computer to store, at least temporarily, data and storage device: allows a computer to permanently retain large amounts of data. Common mass storage devices include disk drives and tape device: usually a keyboard and mouse, the input device is the conduit through which data and instructions enter a device: a display screen, printer, or other device that lets you see what the computer has processing unit (CPU): the heart of the computer, this is the component that actually executes addition to these components, many others make it possible for the basic components to work together efficiently. For example, every computer requires a bus that transmits data from one part of the computer to Classification, By Size and PowerComputers can be generally classified by size and power as follows, though there is considerable overlap:personal computer: a small, single-user computer based on a microprocessor. In addition to the microprocessor, a personal computer has a keyboard for entering data, a monitor for displaying information, and a storage device for saving : a powerful, single-user computer. A workstation is like a personal computer, but it has a more powerful microprocessor and a higher-quality : a multi-user computer capable of supporting from 10 to hundreds of users : a powerful multi-user computer capable of supporting many hundreds or thousands of users : an extremely fast computer that can perform hundreds of millions of instructions per Related Questions1. What is computer history?2. What is computer hardware?3. What is computer software?4. What is computer science?5. What is computer interface?1. What is computer history?The history of computer development is often referred to in reference to the different generations of computing devices. Each of the five generations of computers is characterized by a major technological development that fundamentally changed the way computers history of computer development is often referred to in reference to the different generations of computing devices. Each of the five generations of computers is characterized by a major technological development that fundamentally changed the way computers operate, resulting in increasingly smaller, cheaper, more powerful and more efficient and reliable computing this Webopedia reference article you'll learn about each of the five generations of computers and the technology developments that have led to the current devices that we use today. Our journey starts in 1940 with vacuum tube circuitry and goes to the present day -- and beyond -- with artificial Webopedia Definitions: computer, magnetic drums, binary, integrated circuit, semiconductor, nanotechnologyFirst Generation (1940-1956) Vacuum TubesThe first computers used vacuum tubes for circuitry and magnetic drums for memory, and were often enormous, taking up entire rooms. They were very expensive to operate and in addition to using a great deal of electricity, generated a lot of heat, which was often the cause of generation computers relied on machine language, the lowest-level programming language understood by computers, to perform operations, and they could only solve one problem at a time. Input was based on punched cards and paper tape, and output was displayed on UNIVAC and ENIAC computers are examples of first-generation computing devices. The UNIVAC was the first commercial computer delivered to a business client, the . Census Bureau in UNIVAC computer at the Census BureauA UNIVAC computer at the Census Source: United States Census BureauSecond Generation (1956-1963) TransistorsTransistors replaced vacuum tubes and ushered in the second generation of computers. The transistor was invented in 1947 but did not see widespread use in computers until the late 1950s. The transistor was far superior to the vacuum tube, allowing computers to become smaller, faster, cheaper, more energy-efficient and more reliable than their first-generation predecessors. Though the transistor still generated a great deal of heat that subjected the computer to damage, it was a vast improvement over the vacuum tube. Second-generation computers still relied on punched cards for input and printouts for computers moved from cryptic binary machine language to symbolic, or assembly, languages, which allowed programmers to specify instructions in words. High-level programming languages were also being developed at this time, such as early versions of COBOL and FORTRAN. These were also the first computers that stored their instructions in their memory, which moved from a magnetic drum to magnetic core first computers of this generation were developed for the atomic energy Generation (1964-1971) Integrated CircuitsThe development of the integrated circuit was the hallmark of the third generation of computers. Transistors were miniaturized and placed on silicon chips, called semiconductors, which drastically increased the speed and efficiency of of punched cards and printouts, users interacted with third generation computers through keyboards and monitors and interfaced with an operating system, which allowed the device to run many different applications at one time with a central program that monitored the memory. Computers for the first time became accessible to a mass audience because they were smaller and cheaper than their Generation (1971-Present) MicroprocessorsThe microprocessor brought the fourth generation of computers, as thousands of integrated circuits were built onto a single silicon chip. What in the first generation filled an entire room could now fit in the palm of the hand. The Intel 4004 chip, developed in 1971, located all the components of the computer—from the central processing unit and memory to input/output controls—on a single 1981 IBM introduced its first computer for the home user, and in 1984 Apple introduced the Macintosh. Microprocessors also moved out of the realm of desktop computers and into many areas of life as more and more everyday products began to use these small computers became more powerful, they could be linked together to form networks, which eventually led to the development of the Internet. Fourth generation computers also saw the development of GUIs, the mouse and handheld Generation (Present and Beyond) Artificial IntelligenceFifth generation computing devices, based on artificial intelligence, are still in development, though there are some applications, such as voice recognition, that are being used today. The use of parallel processing and superconductors is helping to make artificial intelligence a reality. Quantum computation and molecular and nanotechnology will radically change the face of computers in years to come. The goal of fifth-generation computing is to develop devices that respond to natural language input and are capable of learning and . What is computer hardware?Hardware refers to objects that you can actually touch, like disks, disk drives, display screens, keyboards, printers, boards, and chips. In contrast, software is untouchable. Software exists as ideas, concepts, and symbols, but it has no provide a useful analogy. The pages and the ink are the hardware, while the words, sentences, paragraphs, and the overall meaning are the software. A computer without software is like a book full of blank pages -- you need software to make the computer useful just as you need words to make a book . What is computer software?Software means computer instructions or data. Anything that can be stored electronically is software, in contrast to storage devices and display devices which are called terms software and hardware are used as both nouns and adjectives. For example, you can say: "The problem lies in the software," meaning that there is a problem with the program or data, not with the computer itself. You can also say: "It's a software problem."The distinction between software and hardware is sometimes confusing because they are so integrally linked. Clearly, when you purchase a program, you are buying software. But to buy the software, you need to buy the disk (hardware) on which the software is of SoftwareSoftware is often divided into two categories. Systems software includes the operating system and all the utilities that enable the computer to function. Applications software includes programs that do real work for users. For example, word processors, spreadsheets, and database management systems fall under the category of applications . What is computer science?Computer science is the study of computers, including both hardware and software design. Computer science is composed of many broad disciplines, including artificial intelligence and software engineering. Most universities now offer bachelor, master, and doctorate degrees in computer . What is computer interface?Interface is a boundary across which two independent systems meet and act on or communicate with each other. In computer technology, there are several types of interface - the keyboard, mouse, menus of a computer system. The user interface allows the user to communicate with the operating system. Also see interface - the languages and codes that the applications use to communicate with each other and with the interface - the wires, plugs and sockets that hardware devices use to communicate with each other.
毕业论文是教学科研过程的一个环节,也是学业成绩考核和评定的一种重要方式。毕业论文的目的在于总结学生在校期间的学习成果,培养学生具有综合地创造性地运用所学的全部专业知识和技能解决较为复杂问题的能力并使他们受到科学研究的基本训练。标题标题是文章的眉目。各类文章的标题,样式繁多,但无论是何种形式,总要以全部或不同的侧面体现作者的写作意图、文章的主旨。毕业论文的标题一般分为总标题、副标题、分标题几种。总标题总标题是文章总体内容的体现。常见的写法有:①揭示课题的实质。这种形式的标题,高度概括全文内容,往往就是文章的中心论点。它具有高度的明确性,便于读者把握全文内容的核心。诸如此类的标题很多,也很普遍。如《关于经济体制的模式问题》、《经济中心论》、《县级行政机构改革之我见》等。②提问式。这类标题用设问句的方式,隐去要回答的内容,实际上作者的观点是十分明确的,只不过语意婉转,需要读者加以思考罢了。这种形式的标题因其观点含蓄,轻易激起读者的注重。如《家庭联产承包制就是单干吗?》、《商品经济等同于资本主义经济吗?》等。③交代内容范围。这种形式的标题,从其本身的角度看,看不出作者所指的观点,只是对文章内容的范围做出限定。拟定这种标题,一方面是文章的主要论点难以用一句简短的话加以归纳;另一方面,交代文章内容的范围,可引起同仁读者的注重,以求引起共鸣。这种形式的标题也较普遍。如《试论我国农村的双层经营体制》、《正确处理中心和地方、条条与块块的关系》、《战后西方贸易自由化剖析》等。④用判定句式。这种形式的标题给予全文内容的限定,可伸可缩,具有很大的灵活性。文章研究对象是具体的,面较小,但引申的思想又须有很强的概括性,面较宽。这种从小处着眼,大处着手的标题,有利于科学思维和科学研究的拓展。如《从乡镇企业的兴起看中国农村的希望之光》、《科技进步与农业经济》、《从“劳动创造了美”看美的本质》等。
【英文篇名】 Switch Router Operating System Based on a General Operating System 【下载频次】 ☆ 【作者】 潘登; 徐佩霞; 【英文作者】 PAN Deng; XU Pei xia (Department of Electronic Engineering and Information Science; University of Science and Technology of China; Hefei; 230027; China); 【作者单位】 中国科学技术大学电子工程与信息科学系; 230027; 【文献出处】 数据采集与处理 , Journal of Data Acquisition & Processing, 编辑部邮箱 2003年 04期 期刊荣誉:中文核心期刊要目总览 ASPT来源刊 CJFD收录刊 【中文关键词】 交换式路由器; 通用操作系统; 路由器操作系统; 【英文关键词】 switch router; general operating system; router operating system; 【摘要】 提出了一种将通用操作系统及其上层路由软件移植到交换式路由器平台上的方案。此方案可以向上屏蔽交换式路由器与传统的路由器体系结构上的区别 ,从而把通用操作系统及其上层路由软件移植到交换式路由器的平台上 ;同时兼顾数据通信和管理维护方面的需求 ,为上层路由软件提供了与传统路由器相同的接口 ,从而使基于通用操作系统的路由软件可以在不损失可升级性的条件下快速移植到交换式路由器上。实际应用证实了该方案具有良好的灵活性和兼容性 【英文摘要】 A new solution to port general operating systems and their routing software to switch router is presented. The solution shields the architecture difference between traditional router and switch router to application level software, thus it may support general operating system and their routing software on switch router platform. The solution is also considered as requirements of both data communication and control functions. And same ways of the access and control of the router are provied as traditional ro... 【基金】 国家 8 63计划 ( 863 -3 1 7-0 1 -99)资助项目 【DOI】 CNKI:SUN: 【分类号】 【正文快照】 引 言路由器最重要的工作是根据 IP包头和路由、过滤规则转发 IP包。其他功能还包括路由表的维护与路由器系统的维护。实际上路由器可以看成是一种针对 IP网络路由需求而设计的专用计算机。随着因特网所承载的业务的演进 ,因特网对于路由器性能的要求也日渐提高。在交换式路 看看这一篇 文章编号: 100429037 (2003) 0420450205一种基于通用操作系统的交换式路由器操作系统实现潘 登, 徐佩霞(中国科学技术大学电子工程与信息科学系, 合肥, 230027)摘要: 提出了一种将通用操作系统及其上层路由软件移植到交换式路由器平台上的方案。此方案可以向上屏蔽交换式路由器与传统的路由器体系结构上的区别, 从而把通用操作系统及其上层路由软件移植到交换式路由器的平台上; 同时兼顾数据通信和管理维护方面的需求, 为上层路由软件提供了与传统路由器相同的接口, 从而使基于通用操作系统的路由软件可以在不损失可升级性的条件下快速移植到交换式路由器上。实际应用证实了该方案具有良好的灵活性和兼容性。关键词: 交换式路由器; 通用操作系统; 路由器操作系统中图分类号: TN 915105; TP393 文献标识码:A 基金项目: 国家863 计划(8632317201299) 资助项目 收稿日期: 2003203229; 修订日期: 2003206215Switch Router Operating System Based ona General Operating SystemPA N D eng , X U P ei2x ia(Department of Elect ronic Engineering and Info rmat ion Science,U niversity of Science and Techno logy of Ch ina, Hefei, 230027,Ch ina)Abstract: A new so lu t ion to po rt general operat ing system s and their rou t ing sof tw are tosw itch rou ter is p resen ted. The so lu t ion sh ields the arch itectu re difference betw een t radit ionalrou ter and sw itch rou ter to app licat ion level sof tw are, thu s it may suppo rt general operat ingsystem and their rou t ing sof tw are on sw itch rou ter p latfo rm. The so lu t ion is also con sidered asrequ iremen t s of bo th data commun icat ion and con t ro l funct ion s. A nd same w ays of the accessand con t ro l of the rou ter are p rovied as t radit ional rou ter, so rou t ing sof tw are of the generaloperat ing system may be po rted to sw itch rou ter p latfo rm rap idly w ith the upgradeab lef lex ib ility. P ract ical design app roves that the so lu t ion has a good compat ib ility and f lex ib words: sw itch rou ter; general operat ing system; rou ter operat ing system引 言路由器最重要的工作是根据IP 包头和路由、过滤规则转发IP 包。其他功能还包括路由表的维护与路由器系统的维护。实际上路由器可以看成是一种针对IP 网络路由需求而设计的专用计算机。随着因特网所承载的业务的演进, 因特网对于路由器性能的要求也日渐提高。在交换式路由器中, 包转发等绝大多数处理已经转移到以端口为中心的硬件中完成, 只有路由规则的生成与维护、网络管理和系统维护等比较复杂的工作仍由软件部分完成。实用中路由器所采用的操作系统可分为三大类: (1) 以Cisco 的IO S 为代表的专用操作系统, 常见于网络骨干节点; (2) 以V xWo rk s 为代表的嵌入式系统, 常见于小型办公ö家用接入设备上; (3)采用通用操作系统的则在骨干节点和用户接入设备上都有这类设备。例如Jun iper 的路由产品就采用L inux 作为操作系统。通用操作系统上的各种路由、网管软件的开发已经有相当长时间, 其功能、性能、稳定性和升级灵活性都很优秀, 但这些软件仍第18卷第4期2003 年12 月数据采集与处理Journal of Data A cquisit ion & P rocessingVo l. 18 No. 4Dec. 2003然是针对传统路由器体系结构开发的, 无法直接应用于新的路由器体系结构。本文提出在通用操作系统的驱动栈中插入一个中间层, 这样对系统内核及和运行在其上的路由、网管等上层软件屏蔽了下层硬件的特殊性, 从而把上层软件和高速硬件平台结合起来。该方案已经应用于高速边缘路由器中, 并表现出了良好的实用性和可扩展性。1 交换式路由器与传统路由器在体系结构上的差别路由器工作在网络的第三层, 其处理工作主要涵盖七层模型中的下三层, 包括: 物理接口处理、数据链路层处理、网络层的路由查找、转发以及队列管理等[1 ]。在传统的路由器体系结构中, 硬件部分只实现物理层的处理, 其余工作需要消耗系统计算资源完成: 包括CPU 周期、内存容量和总线带宽等, 因此性能也受限于这些资源。而在交换式路由器中, 路由处理机仅处理系统维护、路由表维护等少量工作, 数据流的处理都由相对独立的硬件完成, 不再受限于系统计算资源, 因此其性能远优于传统路由器[2 ]。如图1 所示。(a) 传统路由器体系结构(b) 交换式路由器体系结构图1 路由器的逻辑结构 传统路由器和交换式路由器在体系结构方面有明显的区别: 在传统路由器中, 所有的物理接口直接挂接在总线上, 内核可以通过总线直接访问这些接口; 而在交换式路由器中, 只有控制卡是直接挂接在总线上的, 内核必须通过控制卡间接访问各个接口。这导致操作系统内核中代表网络接口的驱动对象的区别: 在传统路由器中, 内核存在若干网络设备驱动对象实例, 每个实例通过总线直接维护一个端口, 为内核及其上面的上层软件提供基本操作支持。而在交换式路由器中, 普通的网络设备驱动对象无法直接维护端口, 也无法支持系统内核和上层软件操作。因此, 交换式路由器体系结构的特殊性使得通用操作系统和上层软件无法直接应用。针对这个问题有两种解决办法: (1) 大量修改内核和各种相关软件的源代码以适应新的体系结构。这种做法存在开发工作量大、周期长、局限性强的缺点, 丧失了使用通用操作系统的灵活性; (2) 在驱动栈中增加一个中间层, 支持普通网络驱动对象所能支持的一切操作, 这样系统内核和上层软件基本上不必修改就可以运行在交换式路由器上。这就是本文所提出的中间层方案。这种方案克服了第一种方法的复杂性, 在保持灵活性的基础上, 可以快速地把通用操作系统及上层软件移植到交换式路由器的硬件平台上。2 中间层设计中间层功能包括数据通信和控制两个方面。从数据通信方面考虑, 每个端口的功能都等效于传统路由器中的一个网络接口, 所以每个物理端口在内核中都应有对应的网络驱动实例。这样才能支持各种上层软件运行, 满足数据通信功能的需要。从控制功能方面考虑, 对上要把每一种可能的逻辑操作映射成硬件操作; 对下要能够和多个设备通信。上层应用包括系统维护、路由软件、网管软件; 下层设备包括处理引擎和端口。控制功能的具体实现和硬件平台有关。考虑到多种应用可能同时操作一个硬件设备, 一种应用也可能同时操作多个设备, 在实现时必须考虑到对于多并发操作的支持。基于上述考虑, 中间层由控制卡驱动模块和若干网络驱动实例组成。在图2 (a, b) 中分别给出了传统路由器的结构与驱动方式以及本文所提出的中间层所处的位置与驱动方式。第4 期潘 登, 等: 一种基于通用操作系统的交换式路由器操作系统实现451图2 中间层的位置与驱动方式 控制卡驱动模块作为中间层的核心, 维护控制卡上所有的端口、内存映射、中断和循环缓冲队列资源。它实现了数据通道和控制通道。对下直接驱动控制卡、与各个端口、处理引擎通信; 对上, 一方面通过内核调用陷阱方式提供控制通道接口; 另一方面向虚拟网络驱动实例提供数据通道接口。虚拟网络驱动实例在操作系统内核为各个物理端口实现网络驱动实例。它们工作在控制卡驱动模块的基础上, 并不直接控制硬件, 故称为虚拟网络驱动实例。虚拟网络驱动实例封装控制卡驱动模块提供的数据传输功能, 并为内核和上层软件提供与普通网络驱动实例相同的调用接口。下面分别给出数据通道和控制通道的实现方案。211 数据通道的功能与实现虚拟网络驱动实例和物理端口是一一对应的。内核数据收发的功能包括3 个方面:(1) 发往某虚拟网络驱动实例的数据包应该由其对应端口输出;(2) 这个端口所收到的包也通过该虚拟网络驱动实例向系统内核提交;(3) 中间层也可以对虚拟网络驱动实例进行流控操作, 以避免因拥塞导致数据丢失。注意到图2 (b) 中的交换结构以定长信元交换数据, 其格式如图3 所示, 其中信元头占4 字节, 包括处理引擎号和端口号域。对于收ö发信元, 处理引擎号和端口号分别为该信元的源端口的和目的端口的对应值。根据图2 (b) 所示的系统结构可知: 由处理引擎号和端口号可以确定端口的物理位置。控制卡驱动模块在其内部的驱动信息数组中维护虚拟网络驱动实例和端口之间的对应关系。图3 数据信元结构发送数据时, 虚拟网络驱动实例从内核网络部分获取待发送的数据, 偕同指向该实例自己的指针一起提交给控制卡驱动模块。一方面, 控制卡驱动模块通过这个指针可以对虚拟网络驱动实例进行流控设置; 另一方面, 控制卡驱动模块根据虚拟网络驱动实例指针查驱动信息表得到目标端口物理位置信息, 包括处理引擎号和端口号。端口物理位置信息将被填充到所有用来承载待发送数据包的信元头中。控制卡驱动模块通过控制卡把信元送到交换结构, 而交换结构和处理引擎分别根据处理引擎号和端口号将信元转发到到目标端口。最后端口从接收到的信元中恢复出原始数据发出。接收数据时, 端口也会将数据拆分到若干信元中逐级上传。考虑到交换结构的循环优先机制, 一个数据包上传的过程可能被来自其他端口的数据抢断。所以控制卡驱动模块对于接收到的信元按源端口位置信息(包括处理引擎号和端口号) 保存到不同的缓冲区中。当接收到该数据包相关的全部信元, 控制驱动模块即可重组该数据, 并根据源端口位置信息查驱动信息表以得到指向该端口对应虚拟网络驱动实例的指针, 进而激活该虚拟网络驱动实例接收数据。虚拟网络驱动实例从控制卡驱动模块中获取数据后, 按照网络驱动的常规方式调用net if- rx 接口向内核提交数据。数据收发实现结构如图4 所示。值得注意的是, 在交换式路由器中, 处理引擎通过交换结构交换的是IP 包; 而通用操作系统中452 数据采集与处理第18 卷图4 数据收发实现结构网络驱动通常处理链路层的帧。即控制卡驱动模块数据通道对上对下的数据格式是不同的。因此, 在发送数据时控制卡驱动模块需要从得到的链路帧中提取IP 包再转发到端口; 而接收数据时则对来自端口的IP 包进行链路帧封装再向上提交。以以太网为例, 需要恢复的包括源和目标站的物理地址、载荷类型和帧校验[3 ]。对于承载IP 包的以太帧, 显然其目标站物理地址和载荷类型[4 ]都是已知的。实现时采用的操作系统是L inux, 通过在虚拟网络驱动源代码中进行设置可以使内核不进行帧校验[5 ]。所以只有源站物理地址未知。如果要求硬件给出真实的源站物理地址, 则增加了硬件的复杂度; 而若在控制卡驱动模块中伪造源物理地址, 则可能导致内核的ARP 管理混乱。为简化硬件设计, 实现时采用了在控制卡驱动模块中伪造源物理地址的办法, 同时修改虚拟网络驱动源代码, 重载帧头处理函数[6 ]。这样内核ARP 表就不受伪造地址的影响, 其获取和刷新通过查询端口ARP 记录实现。212 控制通道的功能与实现控制功能的通信也是基于信元的, 其操作包括维护管理和表同步两类。维护管理主要是进行各种查询, 通常通过若干次双向通信完成。每次通信有效载荷都只有几个字节, 由一个信元即可承载。而表同步则是将上层软件维护的表复制到相关硬件中, 包括ARP 表、路由和分类表等。表同步操作涉及大量数据传输, 需要由多个信元承载。控制功能都是针对设备进行的, 所以在控制ö反馈信元中也必须包括目标设备的物理位置信息。在实际运行期间, 所有的上层应用和设备之间的控制通信复用控制通道, 其特点为:(1) 不同的应用可能同时访问同一设备;(2) 一个应用也可能同时访问多个设备;(3) 同一应用对于同一个设备的操作一般都是顺序的。为支持这种复用操作, 所有承载控制信息和反馈信息的头部除包括目标硬件的物理位置和操作指令外, 还包括命令类型、应用类型信息。控制ö反馈用信元结构如图5 所示。图5 控制ö反馈信元结构图5 中: 处理引擎号和端口号, 确定设备的物理位置; 收ö发信元分别为该信元的源端口的和目的端口的对应值; 命令码在设备和应用之间定义。每种可能的操作分配一个代码; 应用码在控制卡驱动模块和上层应用之间预定义。每种可能的应用分配一个代码。这些应用包含网管、路由维护、硬件维护和ARP 信息获取等。上层应用通过内核调用陷井( IOCTL ) 发起控制通道操作, 同时给出目标设备物理位置、命令类型代码和应用类型代码。控制卡驱动模块把这些信息填充到控制信元中再将其发往设备。设备把这些代码直接复制到反馈信元中, 再在后面追加上反馈信息。控制卡驱动模块为每一种应用分配一个循环缓冲区, 把收到的反馈根据应用类型排入相应队列中。上层应用从其所对应的循环缓冲区中读取反馈信元, 然后根据信元中的物理位置信息、命令码就可以确定该反馈对应的原始命令, 从而对反馈数据进行适当处理。这样就实现了各种控制功能对控制通道的复用。如图6 所示。第4 期潘 登, 等: 一种基于通用操作系统的交换式路由器操作系统实现453图6 控制通信实现结构3 结 论鉴于传统路由器体系结构和交换式路由器体系结构的区别, 通用操作系统及在其上开发的路由软件无法直接应用于交换式路由器。本文提出的中间层方案可以有效地解决这个问题。该方案全面考虑了数据通信和管理维护方面的需求, 为上层提供了与原有模型基本相同的接口, 并使得路由软件在不损失其灵活性和可升级性的条件下直接应用于交换式路由器中。虽然该方案只是在特定的平台和特定的操作系统上得到了实现, 但是不难看出, 这种思路对操作系统并没有特殊的依赖性, 完全可以移植到其他通用操作系统上。本文提出的方案已经在国家863 项目实用化综合接入系统的高速边缘路由器的研制中取得了良好的实际效果。本文为国产高性能路由器的软件开发提出了一种高效快捷的解决方案, 该方案具有良好的应用前景。参考文献:[1 ] Kuro se J F, Ro ss KW. Computer netwo rk ing: a top2dow n app roach featuring the internet [M ]. A ddisonW esley Longman′s P ress, 2001. 332~ 341.[ 2 ] 梁阿磊, 等. 路由器体系结构及其发展[J ]. 小型微型计算机系统, 2001, 8: 943~ 945.[3 ] M edia access cont ro l frame st ructure [S ]. IEEE Std80213, 1998. 36~ 40.[ 4 ] Charles Ho rnig. RFC 894: a standard fo r the t rans2m ission of IP datagram s over Ethernet netwo rk s[S ].198411~ 2.[5 ] Bovet D P. U nderstanding L inux kernel[M ]. O reil2ley P ress, 2002. 683~ 685[ 6 ] Rubini A. L inux device drivers. 2nd edit ion [M ].O r2eilley P ress, 2001. 455~ 458作者简介: 潘 登(19772) , 男, 博士研究生, 研究方向: 网络体系结构、网络安全, E2mail: pandeng@mail. ustc. edu. cn;徐佩霞(19412) , 女, 教授, 博士生导师, 研究方向: 音频视频编码、非线性处理、下一代网络。454 数据采集与处理第18 卷
这个太难搞了!
345 浏览 5 回答
152 浏览 5 回答
235 浏览 3 回答
152 浏览 4 回答
286 浏览 3 回答
303 浏览 2 回答
122 浏览 4 回答
179 浏览 3 回答
134 浏览 3 回答
223 浏览 3 回答
191 浏览 3 回答
146 浏览 3 回答
158 浏览 3 回答
289 浏览 3 回答
225 浏览 5 回答