First, the computer theory Past and Present

Computer, meaning, people originally designed when it is to solve the "calculate calculation" of things, in addition to the earliest of the abacus, the first census in the United States with AD 1880, the United States held a national census, more than 5000 million for the then inventoried the US population. When the US economy is in a stage of rapid development, population movements are frequent; Census project together with the range of statistical methods are backward, from the beginning of the census year in January, spent seven and a half years and only then processed the data. That is, until a second faster census, the US government before we get the first condition of the country's population during the census.

Until there is one called "Huolieruisi" who invented the "punch tabulating machine", transformed into the punched tape punched cards, because the survey data of each person have a number of different projects, such as gender, place of origin, age, and many more. Huolieruisi of each person all survey items are sequentially arranged in a card, then the punch at a position corresponding item on the basis of the findings. ? For example, punch cards "gender" under the section, the "male" and "female" are two options; there is from "0 years" to "more than 70 years" and other series options under "age" column, is how to achieve specific kind of , let us know at:

His core idea is to use the device of machinery to count , the above data we mentioned hole on the card to represent an item, as shown, when the card is inserted into the machine, small metal needles to the machine will on the card, if a perforated place, so the needle will pass through small metal, a vial of mercury injection, Unicom circuit, the circuit drives the motor to the gear of an option +1. This automatic electromechanical behavior instead of manual operation. At that time the efficiency of such machines is 10 times the artificial operation. You know, the order of magnitude of improvement is very significant at the time, that would have been the first artificial census took seven years, now reduced to less than a year.

 

With the gradual increase in the age of discovery and computing needs, people need more computing power of the machine, in fact, is the essence of drilling distinguish 0 and 1, so the people found there a faster way to divide over and over again, such a "relay" It arises, as, when the current flows through the coil, the coil generates an electromagnetic field to attract metal arm, thereby closing the circuit. This circuit may be connected to other circuits, such as a motor, the motor gear will count + 1, similar to the above tabulation punch machine. This type of computer is representative of the Harvard Mark series.

 

 

Unfortunately, much of the quality of the relay, resulting in speed switch is not fast enough, then the best relay, 1 second flip it 40 times. Further, a large circuit composed of relays, will issue a high temperature during operation. And because these temperatures will attract insects. In 1947, the Harvard Mark type 2 appeared in a major failure, and finally found the reason is that there is a "dead bug" in which the relay stuck. So today we call a computer failure "bug"!

It is for these defects, so we have to think of a more advanced model to replace it! Middle experienced vacuum, until 1947, Bell Labs scientists invented the transistor, a brand new computer age was born! Under the principle of transistor physics students who are interested in depth understanding of their own, involving physics and quantum mechanics. We used to talk about the principles and basic computer.

Two electrodes of the transistor, and we call the transmitter current collectors. There spaced electrodes between them of a material, such material is sometimes electrically conductive, and sometimes non-conductive (called semiconductors), the control line is connected to a "gate" electrode, by changing the level of the base charge, we can control the semiconductor material conductive to allow current flow is eligible does not flow. To achieve a vacuum tube, the same as before and relay functions.

 

====================== ① So up here, we finally know the best 0 and 1 for control of individual elements. ==================== [So the computer is composed of a transistor, it will be mentioned below cpu three parts, in fact, are the core essence of the various transistors logic! ]

Next we will use all types of logic transistors, the following is the easiest and a circuit ( "and" gate), can be composed of two transistors, two inputs and one output, only when both inputs are 1, the output to be 1, or any one of the input is not 1, the result is not true:

 

 

 而同理,我们可以组成或门、非门、或非门。然后这些基础门再组成庞大的电路来处理复杂的运算。下面组成了一个“半加器”

而利用“半加器”又可以组装成“全加器”(有进位的加法器)【这些都是“数字逻辑电路”这门课中讲到的原理,有兴趣的同学可以自行深入了解!】

最早的因特尔74181处理器打工用了70个逻辑门,但不能执行乘除,具体的逻辑电路结构如下:

 

 

======================②到这里为止,已经把计算机中的ALU(cpu三大部件之一)讲清楚了。============================

寄存器,也是由晶体管组成的,看以下两个电路,第一个电路,开始的时候A、B输入都为1,那么输出也为1,如果之后A设为0,由于是AND门,输出会变成0,无论后面输入变成什么,output一直为0.因此,这个电路能记录0;

 同理下面这个电路可以记录1

 

 现在有了能记录0和1的电路,我们把它们组合起来,变成AND-OR锁存器,它有两个输入,“设置”输入,把输出可以变成1,“复位”输入

,把输出可以变成0。如果“设置”和“复位”都是0,电路会输出最后放入的内容。(大家可以自己模拟试以下,只要复位不为1,输出就永远是上一次的输入!也就是说,它存住了1bit的信息,这就是传说中的内存原理!!!

 

 

 

 ======================到这里为止,已经把计算机中的寄存器(cpu三大部件之一)讲清楚了。============================

 

 cpu控制器由两个阶段组成,第一个阶段就是“取指令阶段”,第二个阶段是“解吗阶段”,这两种都是通过电路连接解决。这部分用视频过程演示可以会更清楚,文字的描述篇幅太大了(具体过程可以参考视频讲解,关注微信公众号后,直接发信息即可,我会把视频链接发给大家)。 

 ======================到这里为止,已经把计算机中的控制器(cpu三大部件之一)讲清楚了。============================

剩下的就是执行程序了,有好多好多程序语言,最本质的原理无非是每一个程序指令会和机器码对应,而计算机也保存着这份对应关系。以便用作解码用。

而最终程序也是放在存储中,让cpu控制器去取了,然后逐条执行完成计算。这样就是cpu最简单的工作模型。

总结下,计算机核心部件如下,而cpu内部包括内存都是由晶体管组成的,其实就看我们如何去做我们的集成电路!

 

可以关注公众号“python三人行”,我们会定期分享讨论数据、架构、算法以及计算机或操作系统底层原理,欢迎参与!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

---恢复内容开始---

【1】什么是操作系统?

“操作系统是管理计算机硬件软件资源的计算机程序,同时也是计算机系统的内核与基石。操作系统需要处理如管理与配置内存、决定系统资源供需的优先次序、控制输入设备输出设备、操作网络与管理文件系统等基本事务。操作系统也提供一个让用户与系统交互的操作界面。”------这个是百度百科的解释

其实最简单的理解就是一个程序,一通电第一个启动的程序,包含了shell和kernel两个模块,shell对接其他应用程序,也就是用户;而kernel对接硬件,这里硬件包含了计算机的底层硬件,另外还有一些外设(包括键盘、鼠标等)

计算机底层硬件其实最主要由三部分构成:CPU、内存和磁盘,其中CPU和内存都是由三极管构成的(此部分如果想深入了解可以看计算机原理,或联系楼主微信allenforu,我这边有快速理解的视频资料可分享,这里不展开来讲)

因此操作系统为了管控其他各类的应用程序,它有特殊的权限,它的最重要的作用就是把实际的CPU、磁盘、内存分布抽象成进程、文件、地址空间。所以操作系统是一个非常复杂的软件,像window操作系统一共有4500万行的代码

所以一般人不可能读完所有源码,我们读懂其中自己关心的一部分已经是很不错了!

 

上面说到操作系统是一通电第一个启动的程序,因此我们来看下启动的过程及原理:

DISK:存放OS

BIOS:基本I/O处理系统

芯片里的电路结构会把CS设置为0xFFFF,IP设置为0x0000,这样组成的地址就是0xFFFF0,而这个就是BIOS的入口地址,因此通电以后第一时间,CPU读取这个地址的代码。然后BIOS去读取放在磁盘里的OS,这样OS就被运行起来了!

操作系统的三种:

1)中断:外设

2)异常:应用程序意想不到的行为

3)系统调用:应用程序请求操作提供服务

 

 

 

【2】

 

---恢复内容结束---

 

Guess you like

Origin www.cnblogs.com/pythonfor/p/11442414.html