Code:TheHiddenLanguageofComputerHardwareandSo。。。

Code:TheHiddenLanguageofComputerHardwareandSo。。。
Best Friends
在这个章节中,作者⾸先给出了这样⼀个现实场景:就是2个关系很好的⼩朋友,他们隔窗相望,想在晚上交流,但是由于⽗母的限制,他们没有电话,不能开灯,只有⼀个⼿电筒。在这种情况下,他们如何去交流想法呢?作者依次给出如下⽅法:
1. ⽤⼿电筒在空中写字母
2. 字母表中的每个字母都对应⼿电筒的闪烁,⽐如,A-1个闪烁; B-2个闪烁……
3. 代替闪烁,⽽是⽤ Morse code 去表⽰相应的字母
这本书的名字就叫做 Code,那么什么是 Code 呢? 作者给出了如下的定义:
In this book, the word code usually means a system for transferring information among people and machines. In other words, a code lets you communicate.
根据这个定义,我们可以出很多这样的系统。⽐如:英语单词表(当你和别⼈说 cat 的时候,对⽅就
知道你指的是⼀只猫,⽽不是别的什么东西),Java 编程语⾔(当你写⼀句代码的时候,机器知道如何去执⾏它),⼿语(聋哑⼈可以⽤其交流)。我们其实还可以到很多这样的系统。
表贴式永磁同步电机其实我感觉作者眼中的 Code 是⼀种映射系统,那么为什么要有这层系统存在呢?⼤家可能会感觉多了这⼀层系统多⿇烦啊!我想说的是,它们既然存在,就⼀定是在某种情况下,它们会更有优势。
⽐如,Morse code 为什么会被发明出来?⼤家可以想像⼀下,如果⼤家都是⾯对⾯的这种交流,英语单词表这种 Code 就完全⾜够了,如果有⼈⽤ Morse code 去交流,你可能会感觉这些⼈有脑⼦有问题。但是如果像上⾯那种远距离传递信息的情况呢?你传递 dot 和dash 容易,还是 传递 letter ⽐较容易呢?
在有些情况下,你必须要创造出另⼀种 Code 才能去解决问题。⽐如⼀个正常⼈和⼀个失去了听觉,视觉,和说话能⼒的⼈来交流,显然英语单词表这种 Code 就不⾏,因此你需要创造出另⼀种让这2类⼈都可以理解的 Code,只有这样,他们才可以⽤这种 Code 去传递信息。
Codes and Combinations
Morse code 是⼀种 binary code,因为它只有2个组成要素 - a dot and a dash. 上⼀章节中是字母到 Morse code 的映射,这对发送Morse code 的⼈很⽅便,但是对接收 Morse code 的⼈很不⽅便,这章中作者做了⼀个从 Morse code 到字母的映射,从只有1个元素开始,然后2个,3个,……
Braille and Binary Codes
如何让⼀个让盲⼈可以阅读呢? Valentin Haüy 发明了⼀套可以通过触摸来阅读的系统,这个系统纸上的字母都是凸起的。但是这个系统⾮常难⽤,只有⼏本书⽤这个系统。
大陆漂移说代理记帐管理办法Valentin Haüy 陷⼊了⼀个范式,他认为 A 在纸上就应该像 A 的样⼦,B 就是 B 的样⼦,这就像第1章节中⽤⼿电筒直接在空⽓中写字母⼀样。⼤家想⼀想,如果要是你应该去怎么解决这样⼀个问题。在回答这个问题之前,我们的系统应该是什么样的?⾸先,这个系统的⽬的就是要向盲⼈去传递信息,并且要容易在纸上表达出来。没错,聪明的 Louis Braille 发明出了⼀种 Code 做到了这点。下图中就是 Braille code:
具体细节请参考书籍,这⾥我就不过多要介绍了。mrpk
Anatomy of a Flashlight
在这章中,作者主要阐述电流是如何产⽣的,从⽽使灯泡亮起来。
The chemical reaction can’t proceed unless there’s some way that the extra electrons can be taken away from the negative terminal of the battery and delivered back to the positive terminal. So if the battery isn’t connected to anything, nothing much happens. (Actually the chemical reactions still take place, but very slowly.) The reactions take place only if an electrical circuit is present to take electrons away from the negative side and supply electrons to the positive side. The electrons travel around this circuit in a counterclockwise direction:
⼤家通常都会认为是电池提供电量到电路中。但是,从上⾯的介绍中,我们也可以认为是:电路提供⼀种⽅式,让电池发⽣化学反应。电路从电池的负极拿⾛电⼦,然后把它们运送到电池的正极。直到电池内的所有化学物质耗尽,电池内的反应会⼀直发⽣。
我们可以有这样⼀个类⽐:电流类似于管⼦中的⽔流,电压类似于⽔压,阻⼒类似于⽔管的宽度–管⼦越细,阻⼒越⼤。
Seeing Around Corners
你有个好朋友住在隔壁,在这种情况下,你就不能⽤⼿电筒去发送 Morse code 了,现在让我们⾃⼰⽤电池,灯泡,开关,和导线制作⼀个我们⾃⼰的⼿电筒吧!
上图中的 V 代表电压,它也可以表⽰真空。我们可以把 V 看作是电⼦真空,把⼟地看作是电⼦的海洋,电⼦真空从⼟地上拉来电⼦,通过电路,电⼦经过灯泡,从⽽点亮它。上图中那个⽐较奇怪的符号(4个短线)代表 ground,a ground is a physical connection with the earth.
通过导线,我们可以摆脱距离的限制。通过提⾼电压,增加导线长度,减⼩电阻,从⽽可以使我们与远距离的朋友们互相交流。但是,导线的不可能⽆限长,按照上⾯的模式,最多也就能⼏百⽶远。那么我们如何来实现更远距离的信息传递呢?
Telegraphs and Relays
电报背后的思想其实很简单:You do something at one end of a wire that causes something to happen at the other end of the wire. 下图就是⼀个电报系统, When the telegraph key was pressed, the electromagnet in the sounder pulled the movable bar down and it made a “click” noise. When the key was released, the bar sprang back to its normal position, making a “clack” noise. A fast “click-clack” was a dot; a slower “click…clack” was a dash.
我不是塑料袋电报的发明标志着现代通讯的开始,第⼀次,⼈们交流可以超过眼睛能看到的和⽿朵能听到的距离,⽽且⽐马飞奔的速度还要快。尽管⼀些电报系统能进⾏⼤约300多⽶的通信,但是,我们依然做不到更远距离的通信,于是⼈们就想出了⼀个解决⽅案,发明了继电器,系统就被改进成下图的样⼦:
继电器是⼀个伟⼤的设备,它⽆疑也是个开关,但是它的开与关不⽤⼈⼿去控制,⽽是⽤电流。
Our Ten Digits
这章主要介绍了我们今天使⽤的 number system - Hindu-Arabic or Indo-Arabic 相⽐与其它 number system 的好处,以及它的⼀些特点:
The Hindu-Arabic number system is said to be positional
There’s no special symbol for ten
Zero
热敏油墨The lowly zero is without a doubt one of the most important inventions in the history of numbers and mathematics. What’s best about the positional system of notation isn’t how well it works, but how well it works for counting systems not based on ten.
Alternatives to Ten
之所以我们⼈类的 number system 是 base ten 的,是因为我们本⾝就有10个⼿指,如果我们⼈类的
⼿指像下图⼀样,那我们⽣活中的数字系统就很有可能是8进制的,那么我们的数字世界就只有0,1,2,3,4,5,6,7.
上图的最右⾯的⼿指可以看到有个10,这⾥的10并不代表具体的数量,为了不混淆,你可以把它读成 one zero,它只是代表上图中⼿指的个数。如果我们在⽤这个8进制的系统,当数量达到10(one zero)时,我们就可以进位,这就是基于 positional 的 数字系统的伟⼤之处,你甚⾄可以⽤5进制,3进制,随你怎么做。
既然这样,看来2进制系统是最适合计算机的,In previous chapters, we’ve been looking at switches and wires and lightbulbs and relays, and any of these objects can represent the binary digits 0 and 1:
A wire can be a binary digit. If current is
flowing through the wire, the binary digit is 1. If not, the binary digit is 0. A switch can be a binary digit. If the switch is on, or closed, the binary digit is 1. If the switch is off, or open, the binary digit is 0. A lightbulb can be a binary digit. If the lightbulb is lit, the binary digit is 1. If the lightbulb is not lit, the binary digit is 0. A telegraph relay can be a binary digit. If the relay is closed, the binary digit is 1. If the relay is at rest, the binary digit is 0. Binary numbers have a whole lot to do with computers.
Bit by Bit by Bit
Letters and words and Morse code and Braille and decimal digits convey information as well. But in the computer age, the
bit has come to be regarded as the basic building block of information.
Information 代表的是在2种或更多种可能之间的⼀种选择,⽐如,当我们⽤另⼀个⼈交流的时候,every word we speak is a choice among all the words in the dictionary. 如果给字典中的每个 word ⽤数字编号,我们也可以⽤数字来准确地传达我们想要传递的信息,当然了,沟通的2⼈之间要明⽩具体的数字表达什么含义。The flip side of this is that any information that can be reduced to a choice among two or more possibilities can be expressed using bits. ⽐如我们有2个bit,因此我们有4种可
能,00,10,01,11,但是当我们想表达信息的时候,我们只会拿出这其中的⼀种可能去传递出去。同时,The more bits we have, the greater the number of different possibilities we can convey.
As we shall see later in this book, bits can represent words, pictures, sounds, music, and movies as well as product codes, film speeds, movie ratings, an invasion of the British army, and the intentions of one’s beloved. But most fundamentally, bits are numbers. All that needs to be done when bits represent other information is to count the number of possibilities. This determines the number of bits that are needed so that each possibility can be assigned a number.
Logic and Switches
与传统代数不⼀样的是,Boolean algebra 的操作数是类别,传统代数的那些法则它也⼀样可以⽤,⽐如:commutative, associative, and distributive rules,但是在 Boolean algebra 中, + 操作符 is distributive over the x 操作符:
Gates (Not Bill)
⽤不同的⽅式连接 relays,我们可以组成不同的 logic gates,作者在这章中介绍了4个 logic gates 和 1个 inverter. 通过组合这些 logic gates,我们可以得到很复杂的电路,执⾏复杂的逻辑任务。4个 logic gates 的相应逻辑如下图所⽰:
作者也介绍了 buffer,它的 output 与 它的 input 相同,它有如下2点作⽤:
1. You can use a buffer when an input signal is weak
2. A buffer can be used to slightly delay a signal. This works because the relay requires a little time—some fraction of a
second—to be triggered

本文发布于:2024-09-24 08:29:30,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/279097.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:系统   电池   作者   字母   交流
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议