现在的位置: 首页 > 综合 > 正文

编程就是理解,阅读即是理解。

2014年02月16日 ⁄ 综合 ⁄ 共 5084字 ⁄ 字号 评论关闭

Programming is understanding. ---Kristen

Reading is understanding. ----Chen Zhiming

我觉得c++比以前更加好用了,C++这些年对程序设计的支持真是发生了显著性的变化,很多新的技巧都被开发出来了。然而c++不是一个用来好玩的编程游戏,大多数的程序都会被用来建设各个领域的项目,为此我们必须保证语言很灵活功能很强大,还有多产和质量。C++基本上完成了我当初的设想,而且它还出色的完成了我没有想到的任务。

这本书是用来介绍标准C++的,由C++支持的编程关键和设计技术。这次的标准c++比第一版的C++要强悍很多,语言也经过了进一步润色。像命名空间,特例,样本,运行时间类型一致等新的语言特征会比以前更加的容易被编译器直接编译,相比原来的纯C语言编程标准程序库让编程人员站在一个更高的编程平台上。

第二版的书大概三分之一的内容都是沿袭第一个版本的,而这个第三版本是很大程度上的改写。它里面的一些东西就算是对有经验的高级程序员来说都是新的,但是与此同时,这本书却又是为新手提供了一个比他们的先辈更好的入门。C++普遍性的使用导致了很多有用的编程经验出现,使得这本书得以问世。

C++中广泛的标准程序库的定义改变了人们对C++局限性的认识。如同往常,这本书会独立介绍C++中的任何比较特别的应用,在开头的一些篇章中,语言结构和概念是颠倒着介绍的,所以一个结构只有被定义以后才能使用。然而运用已经设计好的程序库要比去弄懂它是怎么运行的要容易得多。因此标准程序库能够在初学者学会他们之前向他们展示一些使用而有趣的东西。标准程序库自身就是一个程序设计样本和设计技巧的丰富来源。

这本书介绍了C++的每一个主要语言特征,还有标准库。基本上是围绕着语言和库设备展开的。但是,他们的特征是在运用的时候体现出来的。也就是说这本书集中介绍的是怎么用这些语言来编程而不是介绍语言本身。这本书介绍了让C++好用的关键技术,教了学习主要技巧必须的观念。除了配了技术插图的地方,例子大都是从系统软件领域提取的。同样,注释的C++语言标准库为整套语言配了很完整的定义,这些注释让语言变得更加好理解。

 

2010/12/25

《ProgrammingEmbedded Systems In C and  C++》

Chapter 8 Operating Systems

第八章  操作系统

1.History and Purpose 历史和它的目的

In the early days of computing there was nosuch thing as an operating system.

在进入计算时代的早些时候是没有操错系统这个玩意的。

Application programmers were completelyresposible for controlling and monitoring the state of the processor and otherhardware.

In fact, the purpose of the first operating systems was to provide avirtual hardware platform that made application programs easier to write.

(在这些历史上的特殊时刻里)应用程序编程人员需要完全负责控制和监视处理器和一些其他硬件的。

而实际上,在那个时候操作系统只是为了能够为写应用程序提供一个虚拟的硬件平台,让写应用程序变得更加简单。

To accomplish this goal, operating systemdevelopers needed only provide a loose collection of routines-much like a modemsoftware library-for resetting the hardware to a known state, reading the stateof the inputs, and changing the state of the outputs.

为了实现这个目的,操作系统开发员只需要提供一个更加宽松的线程收集器---这个收集器更加像是一个猫(Modem调制调解器)、一个调制调解软件的库---是为了实现重置硬件的物理状态,使它的状态回到一个已知的状态;读取输入状态;改变输出状态。

Modem operating systems add to this theability to execute multiple software tasks simultaneously on a singleprocessor. Each such task is a piece of the software that can be seperated fromand run independently of the rest.

Modem的操作系统实现了在单个处理器上执行多个软件任务。每一个这样的任务都是可以独立运行的软件的一部分。

 Aset of embedded software requirements can usually be decomposed into a smallnumber of such independent pieces. For example, the printer-sharing devicedescribed in Chapter 5, contains three obvious software tasks:

嵌入式软件要求通常都被分解成许多个独立的可执行块。

比如说第五章描述的打印机共享设备,就需要处理下面三个很明显的任务:

Task 1: Receive data from the computerattached to serial port A.

Task 2: Receive data from the computerattached to serial port B.

Task 3: Format and send the waiting data(if any) to the printer attached to the parallel port.

任务1:从电脑端口A接收数据

任务2:从电脑端口B接收数据

任务3:如果有任何来自平行端口的数据被送到打印机上等待处理,格式化数据并且传送数据

Tasks provide a key software abstractionthat makes the design and implementation of embedded software easier and theresulting source code simpler to understand and maintain. By breaking thelarger program up into smaller pieces, the programmer can more easilyconcentrate
her energy and talents on the unique features of the system underdevelopment.

这样一种任务分布式开发抽象出了一种软件开发模式,让嵌入式软件的设计和开发变得更加简单,输出的源代码也更加易于理解和维护。

把一个大的应用程序开发分解成很多个细小的块,程序员们就可以把精力和才华更多的放在系统开发的关键位置上。

Strictly speaking, an operating system isnot a required component of any computer system-embedded or otherwise. It isalways possible to perform the same functions from within the applicationprogram itself. Indeed, all of the examples so far in this book
have done justthat. There is simply one path of execution-starting at main -that isdownloaded into the system and run. This is the equivalent of having only onetask. But as the complexity of the application expands beyond just blinking anLED, the benefits
of an operating system far outweigh the associated costs.

严格的来说,一个操作系统不是任何一个嵌入式操作系统计算机或者是别的操作系统的计算机的必要组成部分。事实上一个应用程序往往总是执行它内部的同一个函数,我们这本书集中所有的例子似乎都是如此。每一个程序都有一个简单而唯一的程序执行入口---main函数---这是一个被下载至系统里执行的函数。这几乎就是和只有唯一一个任务是等价的。但是随着应用程序的扩展,程序不再只是在LED显示屏上闪一下,操作系统的价值就真正体现出来了。

If you have never worked on operatingsystem internals before, you might have the impression that they are complex.I'm sure the operating system vendors would like you to continue to believethat they are and that only a handful of computer scientists are
capable ofwriting one. But I'm here to let the cat out of the bag: it's not all thathard! In fact, embedded operating systems are even easier to write than theirdesktop cousins-the required functionality is smaller and better defined. Onceyou learn what that
functionality is and a few implementation techniques, youwill see that an operating system is no harder to develop than any other pieceof embedded software.

如果你从来都没有学习过操作系统的内部构造,你也许会觉得这真够复杂的。我敢打赌卖操作系统的人非常希望你会相信这个操作系统只会有科学家才能够写得出来的。但是我在这里打算说个实在话:这个其实并不像你想象中的那么困难!

实际上,写一个嵌入式操作系统比起写一个桌面应用程序更加简单。它所要求的泛函性更小而且定义都非常的棒。一旦你学习了什么是函数性,再加一些使用技巧,你就会明白写一个操作系统是多么简单了,比起任何一种嵌入式软件开发都要简单。

Embedded operating systems are smallbecause they lack many of the things you would expect to find on your desktopcomputer. For example, embedded systems rarely have disk drives or graphicaldisplays, and hence they need no filesystem or graphical user interface
intheir operating systems. In addition, there is only one "user" (i.e.,all of the tasks that comprise the embedded software cooperate), so thesecurity features of multiuser operating systems do not apply. All of these arefeatures that could be part of an embedded
operating system but are unnecessaryin the majority of cases.

嵌入式操作系统都很小,因为它们他们缺乏许多你想在你电脑上可以找到的东西。

比如说嵌入式系统很少会有磁盘驱动和图形显示,所以它们不需要文件系统或者图形用户操作界面。除此之外,对于嵌入式系统来说只有一个唯一的“用户”(比如说,组成嵌入式软件的所有任务都是协调工作的),所以多用户操作系统的安全性问题在这里不存在。所有这些嵌入式系统的特征的要义在于:它们只会是嵌入式系统的一部分,但是大多数时候绝对不会是必需的。

抱歉!评论已关闭.