Early Programming: Crash Course Computer Science #10

CrashCourse
3 May 201709:26

Summary

TLDR本集《计算机科学速成课》由Carrie Anne主持,深入探讨了计算机程序如何被加载到计算机内存中。节目首先回顾了计算机如何使用复杂电路进行数据存储和检索,以及执行操作的过程。随后,介绍了早期纺织机械的编程需求,特别是Joseph Marie Jacquard在1801年展示的可编程纺织机,它通过穿孔卡片来定义布料的图案。这种穿孔卡片的方式,不仅在后来的人口普查中得到应用,也成为了早期编程的一种形式。随着时间的推移,商业机器的功能不断增强,但编程方式依然复杂。直到20世纪40年代末,电子存储器的出现使得程序可以完全存储在计算机内存中,形成了所谓的存储程序计算机。节目还介绍了冯·诺依曼架构,它将程序和数据统一存储在单一共享内存中。此外,还提到了穿孔卡片和纸带等数据输入输出方式,以及面板编程等早期编程方法。最后,节目预告了下一集将讨论编程语言,为观众揭示了计算机科学发展的历程。

Takeaways

  • 💾 计算机程序是如何被加载到计算机内存中的,这并非魔法,而是计算机科学的一部分。
  • 🧵 在计算机发展之前,编程需求就已经存在,如纺织制造业中的可编程织布机。
  • 📇 约瑟夫·玛丽·雅卡尔在1801年发明了一种可编程的纺织机,使用穿孔卡片来定义布料的每一行图案。
  • 📊 穿孔卡片成为了一种廉价、可靠、相对人类可读的方式来存储数据,并在1890年的人口普查中被使用。
  • 🔢 早期的制表机虽然能够进行计算,但它们并非真正的计算机,因为它们的操作是固定的,不能编程。
  • 🔌 在20世纪20年代,通过控制面板上的插座和电缆,程序员可以激活不同的机器功能,这些控制面板也被称为插线板。
  • 🚀 随着电子存储器在1940年代末到50年代变得可行,程序可以完全存储在计算机的内存中,这导致了存储程序计算机的诞生。
  • 🌐 冯·诺依曼架构将程序和数据统一存储在单一共享内存中,这是现代计算机的基础架构。
  • 🏛️ 1948年,曼彻斯特大学建造了第一个冯·诺依曼架构的存储程序计算机,绰号为“婴儿”。
  • 📚 穿孔卡片在20世纪80年代之前被广泛用于计算机数据的输入和输出。
  • 🔵 早期计算机编程是专家的领域,需要对底层硬件有深入的了解。
  • 🔠 为了简化编程,人们开始寻求更简单的方法来编写程序,这引导了编程语言的发展。

Q & A

  • 计算机程序是如何进入计算机内存的?

    -计算机程序需要被加载到计算机的内存中。这通常不是通过魔法,而是通过计算机科学的方法实现的。早期,程序通过穿孔卡片读取器输入,后来发展到使用电子内存,使得程序可以完全存储在计算机的内存中,方便程序员修改和CPU快速访问。

  • 约瑟夫·玛丽·雅卡尔是如何改进纺织机的?

    -约瑟夫·玛丽·雅卡尔开发了一种可编程的纺织机,通过穿孔卡片来定义布料每一行的图案。卡片上的孔洞决定织布机上的纱线是抬高还是降低,从而形成不同的图案。

  • 穿孔卡片是如何帮助进行人口普查的?

    -在1890年的人口普查中,穿孔卡片被用来存储每个人的数据,如种族、婚姻状况、孩子数量、出生国家等。人口普查工作人员会在卡片上适当位置打孔,卡片被送入制表机后,每个孔洞都会使得对应答案的运行总数增加一。

  • 早期的制表机与真正的计算机有什么区别?

    -早期的制表机功能固定,不能编程,它们只能进行单一的操作——制表。与之相比,真正的计算机是可编程的,可以根据不同的程序执行不同的任务。

  • 什么是控制面板(plug board)?

    -控制面板是早期计算机用来触发不同计算功能的一种方式。程序员通过在面板上插入电缆来传递值和信号,因此也被称为插线板。这种方式编程非常复杂,需要重新布线以运行不同的程序。

  • 冯·诺依曼架构是什么?

    -冯·诺依曼架构是一种将程序和数据统一存储在单一共享内存中的计算机架构。它以数学家和物理学家约翰·冯·诺依曼命名,其特征包括一个包含算术逻辑单元、数据寄存器、指令寄存器和指令地址寄存器的处理单元,以及一个存储数据和指令的内存。

  • 世界上第一台冯·诺依曼架构的存储程序计算机是什么时候建造的?

    -世界上第一台冯·诺依曼架构的存储程序计算机是在1948年由曼彻斯特大学建造的,绰号为“婴儿”(Baby)。

  • 为什么穿孔卡片在计算机早期历史中非常重要?

    -穿孔卡片是将编程数据加载到计算机内存中的一种方式。它们也被用于将数据从计算机输出,通过在程序结束时将结果打印到穿孔卡片上,然后这些卡片可以由人工分析或加载到另一个程序中进行进一步计算。

  • 什么是打孔纸带,它与穿孔卡片有何不同?

    -打孔纸带是穿孔卡片的近亲,其基本思想相同,但是数据是连续存储在一条纸带上,而不是单独的卡片上。

  • 面板编程是如何进行的?

    -面板编程是通过控制台面板上的大量开关和按钮来编程和控制计算机的一种方式。与物理插线板相比,面板编程可以通过操作开关和按钮来激活某些功能,并且有指示灯显示内存中不同功能和值的状态。

  • 早期计算机编程为什么是专家的领域?

    -早期计算机编程需要对底层硬件有深入的了解,比如处理器的操作码和寄存器位。这意味着编程是困难和繁琐的,即使是专业的工程师和科学家也难以充分利用计算所能提供的优势。

  • 为什么需要更简单的编程语言?

    -为了简化告诉计算机如何执行任务的过程,需要一种更简单的编写程序的方式。这导致了编程语言的发展,使得非专业人士也能更容易地使用计算机。

Outlines

00:00

📚 计算机程序的起源与存储

Carrie Anne在Crash Course Computer Science中介绍了计算机如何工作,包括使用复杂电路存储和检索内存中的值,以及执行操作,如加法。她提到了操作序列,即计算机程序,并探讨了程序如何加载到计算机内存中。早期的编程需求出现在纺织制造业,Joseph Marie Jacquard在1801年开发了可编程的纺织机,使用穿孔卡片来定义布料的图案。穿孔卡片后来被用于1890年的人口普查,每个卡片存储一个人的数据。早期的制表机虽然能够进行计数,但它们不是可编程的计算机。随着时间的推移,商业机器的功能不断增强,但编程仍然复杂。到了20世纪40年代,电子存储器变得可行,程序可以完全存储在计算机的内存中,这导致了存储程序计算机的出现,即冯·诺依曼架构计算机。

05:04

📋 早期计算机编程与数据输入

尽管电子计算机内存的出现极大地提高了编程的便利性,但在计算机运行之前,仍然需要将编程数据加载到计算机中。为此,使用了穿孔卡片。几乎所有的计算机直到1980年代都配备了穿孔卡片阅读器,可以逐个读取穿孔卡片,并将卡片内容写入计算机内存。如果加载了一叠穿孔卡片,阅读器会将它们全部顺序加载到内存中。此外,穿孔卡片不仅用于将数据输入计算机,还用于将数据从计算机中输出。在程序结束时,结果可以被写入穿孔卡片。除了穿孔卡片,还有打孔纸带,这是一种连续的打孔方式。早期计算机编程通常是专家的领域,需要对底层硬件有深入的了解。随着时间的推移,人们需要一种更简单的编程方式,这引出了下一集将要讨论的编程语言。

Mindmap

Keywords

💡计算机程序

计算机程序是一组指令,用于告诉计算机执行特定的任务。在视频中,它与计算机如何工作紧密相关,涉及如何使用复杂的电路来存储和检索内存中的值,并对这些值进行操作。例如,将两个数字相加。程序通过一系列操作序列来实现,这是计算机程序的基础。

💡存储程序计算机

存储程序计算机是一种将程序完全存储在计算机内存中的计算机。与早期的计算机相比,这种类型的计算机允许程序和数据统一存储在单一共享内存中,使得程序可以被程序员轻松更改,并且可以被CPU快速访问。视频中提到,这种计算机被称为存储程序计算机,是冯·诺依曼架构的一个特点。

💡冯·诺依曼架构

冯·诺依曼架构是一种计算机组织架构,由处理单元、算术逻辑单元、数据寄存器、指令寄存器、指令地址寄存器和存储数据及指令的内存组成。这种架构将程序和数据存储在同一内存中,是现代计算机设计的基础。视频中提到,冯·诺依曼架构是以数学家和物理学家约翰·冯·诺依曼命名的。

💡打孔卡片

打孔卡片是一种早期的数据存储介质,通过卡片上的孔来表示数据。在视频中,打孔卡片被用于纺织机械中定义布料的图案,每个孔的位置决定织布机上的线是否上升或下降。此外,打孔卡片也被用于1890年的人口普查,每个卡片上存储了一个人的信息。打孔卡片是早期编程和数据输入的一种方式。

💡打孔纸带

打孔纸带与打孔卡片类似,但数据是连续存储在一条长带上,而不是单独的卡片上。这种存储方式在视频中被提及,作为数据存储和输入的一种方式,是计算机早期发展中的一种数据输入和输出手段。

💡面板编程

面板编程是一种通过控制面板上的开关和按钮来编程和控制计算机的方法。在视频中,它被描述为一种在1980年之前的计算机上常见的编程方式,其中控制台通常装有大量的开关和按钮,以及显示内存中各种功能和值状态的指示灯。

💡Altair 8800

Altair 8800是第一款商业上成功的家用计算机,它在1975年以大约400美元的价格出售,相当于2017年的2000美元。在视频中提到,要编程Altair 8800,用户需要通过面板上的开关输入二进制操作码,然后按下存储按钮将该值写入内存。

💡汇编语言

虽然视频没有直接提到汇编语言,但它是早期计算机编程中常用的一种低级语言。汇编语言与机器语言密切相关,它允许程序员使用助记符来编写程序,这些助记符可以被汇编器转换成机器可以执行的指令。在早期计算机编程中,汇编语言是专家和技术人员使用的编程语言之一。

💡电子管计算机

电子管计算机是使用电子管作为其主要逻辑元件的早期计算机。在视频中提到了ENIAC,这是世界上第一台通用电子计算机,它使用了大量的插头板进行编程。电子管计算机由于其体积大、成本高和维护复杂,随着技术的发展逐渐被晶体管和集成电路所取代。

💡CPU

CPU,即中央处理单元,是计算机的核心部件,负责执行程序中的指令。在视频中,CPU被提及为执行简单示例程序的部件,它通过复杂的电路来存储和检索内存中的值,并对这些值进行操作。CPU是计算机执行所有计算和逻辑运算的中心。

💡内存

内存是计算机中用于暂时存储数据和程序的硬件部分。在视频中,内存被描述为计算机工作的基础,它允许计算机保存和检索值,并执行操作。内存对于计算机程序的运行至关重要,因为所有的计算和数据处理都需要在内存中进行。

Highlights

计算机程序是如何进入计算机内存的,这并非魔法,而是计算机科学的一部分。

在计算机发展之前,编程机器的需求就已经存在,最著名的例子是在纺织制造业。

Joseph Marie Jacquard在1801年开发了一种可编程的纺织机,被认为是编程最早的形式之一。

穿孔卡片是存储数据的一种廉价、可靠且相对易读的方式。

1890年的人口普查使用了穿孔卡片来帮助统计数据。

早期的制表机并不是真正的计算机,它们的操作是固定的,不能编程。

20世纪20年代,插线板变得可互换,使得编程更加舒适,并允许不同的程序插入机器。

ENIAC,世界上第一台通用电子计算机,使用了大量的插线板,即使在纸上完全设计出程序后,物理连接ENIAC并运行程序可能需要三周时间。

随着1940年代末到50年代电子存储器变得可行,程序可以完全存储在计算机的内存中。

存储程序计算机(stored-program computers)可以将程序容易地由程序员更改,并快速地被CPU访问。

冯·诺依曼架构将程序和数据统一到单个共享内存中,以冯·诺依曼命名,他是曼哈顿计划和几台早期电子计算机的杰出数学家和物理学家。

1948年,曼彻斯特大学建造了第一台冯·诺依曼架构的存储程序计算机,绰号为“Baby”。

穿孔卡片直到1980年代仍被广泛用于计算机,用于将数据加载到计算机内存中。

美国空军的SAGE防空系统是已知最大的穿孔卡片程序,使用了62,500张穿孔卡片,相当于大约5兆字节的数据。

穿孔纸带是穿孔卡片的近亲,其概念相同,但是连续的而不是单独的卡片。

50年代和60年代的计算机通常配有巨大的控制台,上面有大量的开关和按钮,以及指示灯显示内存中不同功能和值的状态。

Altair 8800是第一款商业上成功的家用计算机,业余计算机爱好者可以通过面板上的开关输入程序。

编程早期计算机是专家的领域,需要对底层硬件有深入的了解,这意味着编程是困难和繁琐的。

需要一种更简单的方式告诉计算机做什么,一种更简单的编程方式,这引出了下一期将讨论的编程语言。

Transcripts

play00:02

Hi, I'm Carrie Anne and welcome to Crash Course Computer Science.

play00:05

Over the last few episodes,

play00:07

We've talked a lot about the mechanics of how computers work.

play00:10

How they use complex circuits to save and retrieve values from memory,

play00:13

and perform operations on those values,

play00:15

like adding two numbers together.

play00:17

We've even briefly talked about sequences of operations,

play00:19

which is a computer program.

play00:21

What we haven't talked about

play00:22

is how a program gets into a computer.

play00:24

You might remember in episode 7 and 8 ,

play00:25

when we stepped through some simple example programs for the CPU that we had created.

play00:30

For simplicity, we just waved our hands

play00:33

and said that the program was already magically in memory.

play00:35

But in reality, programs have to be loaded into a computer's memory.

play00:38

It's not magic. It's computer science.

play00:40

[Theme Music]

play00:49

The need to programme machines existed way before the development of computers.

play00:53

The most famous example of this was in textile manufacturing.

play00:56

if you just wanted to weave a big red tablecloth,

play00:58

you could simply feed red thread into a loom and let it run.

play01:01

But what about if you wanted the cloth to have a pattern like stripes or plaid?

play01:05

Workers would have to periodically reconfigure the loom as dictated by the pattern,

play01:09

but this was labor intensive which made patterned fabrics expensive.

play01:12

In response, Joseph Marie Jacquard developed a programmable textile loom,

play01:16

which he first demonstrated in 1801.

play01:18

The pattern for each row of the cloth was defined by a punched card.

play01:21

The presence or absence of a hole in the card determined

play01:24

if a specific threat was held high or low in the loom.

play01:26

Such that the cross thread called the weft passed above or below the thread.

play01:30

To vary the pattern across rows these punch cards were arranged in long chains,

play01:34

forming a sequence of commands for the loom.

play01:36

Sound familiar?

play01:37

Many consider Jacquard's loom to be one of the earliest forms of programming.

play01:40

Punched cards, turned out to be a cheap , reliable,

play01:43

fairly human readable way to store data.

play01:45

Nearly a century later,

play01:46

punch cards were use to help tabulate the 1890 newest census

play01:49

which we talked about in episode 1.

play01:51

Each card held an individual person's data.

play01:54

Things like race,

play01:54

marital status,

play01:55

number of children,

play01:56

country of birth, and so on.

play01:57

For each demographic question,

play01:59

a census worker would punch out a hole of the appropriate position.

play02:02

When a card was fed into the tabulating machine,

play02:04

a hole would cause the running total for that specific answer to be increased by one.

play02:09

In this way you could feed the

play02:10

entire county's worth of people

play02:12

and at the end you'd have running totals for all of the questions that you asked.

play02:15

It is important to note here that early tabulating machines

play02:18

were not truly computers as they can only do one thing-tabulate.

play02:22

Their operation was fixed and not programmable.

play02:24

Punished cards stored data, but not a program.

play02:26

Over the next 60 years, these business machines grew in capability,

play02:30

adding features to subtract, multiply, divide,

play02:33

and even make simple decisions about when to perform certain operations.

play02:36

To trigger these functions appropriately,

play02:38

so that different calculations could be performed,

play02:40

a programmer accessed a control panel.

play02:42

This panel was full of little sockets, into which a programmer would plug cables

play02:45

to pass values and signals between different parts of the machine.

play02:50

For this reason they were also called plug boards.

play02:52

Unfortunately, this meant having to rewire the machine each time a different program needed to be run.

play02:57

And so by the 1920s, these plug boards were made swappable.

play03:01

This not only made programming a lot more comfortable,

play03:04

but also allowed for different programs to be plugged into a machine.

play03:07

For example, one board might be wired to calculate sales tax, while another helps with payroll.

play03:12

But plug boards were fiendishly complicated to program.

play03:15

This tangle of wires is a program for calculating a profit loss summary,

play03:18

using an IBM 402 accounting machine, which were popular in the 1940s.

play03:23

And this style of plug board programming wasn't unique to electromechanical computers.

play03:26

The world's first General-Purpose electronic computer,

play03:30

the Eniac, completed in 1946, used a ton of them.

play03:33

Even after a program had been completely figured out on paper,

play03:36

physically wiring up the Eniac and getting the program to run could take upwards of three weeks.

play03:42

Given the enormous cost of these early computers, weeks of downtime simply to switch programs

play03:47

was unacceptable and the new, faster, more flexible way to programme machines was badly needed.

play03:51

Fortunately by the late 1940s and into the 50s, electronic memory was becoming feasible.

play03:57

As costs fell, memory size grew.

play03:58

Instead of storing a program as a physical plug board of wires, it became possible to store a program entirely in a computer's memory.

play04:05

Where it could be easily changed by programmers and quickly accessed by the CPU.

play04:09

These computers were called stored-program computers.

play04:11

With enough computer memory, you could store not only the program you wanted to run,

play04:15

but also any data your program would need.

play04:17

Including new values it created along the way,

play04:20

Unifying the progrmming data into a single shared memory is called the von Neumann architecture.

play04:25

Named after John von Neumann, a prominent mathematician and physicist,

play04:29

who worked on the Manhattan project and several early electronic computers.

play04:33

And once said, "I'm thinking about something much more important than bombs, I'm thinking about computers".

play04:38

The hallmarks of a von Neumann computer are a processing unit containing an arithmetic logic unit,

play04:43

data registers, an instruction register, and an instruction address register.

play04:47

And finally, a memory to store both data and instructions.

play04:51

Hopefully, this sounds familiar, because we actually built a von Neumann computer in episode 7.

play04:55

The very first von Neumann architecture stored program computer

play04:59

was constructed in 1948 by the University of Manchester, nicknamed "Baby".

play05:04

And even the computer you are watching this video right now uses the same architecture.

play05:08

Now electronic computer memory is great and all,

play05:10

but you still have to load the programming data in to the computer before it can run.

play05:14

And for this reason, punch cards were used.

play05:16

Let's get to the Thought Bubble.

play05:17

Well into the 1980s, almost all computers had a punch card reader.

play05:20

Which could suck in a single punch card at a time and write the contents of the card into the computer's memory.

play05:26

If you loaded in a stack of punch cards, the reader would load them all into memory sequentially, as a big block.

play05:31

Once the programming data were in memory, the computer would be told to execute it.

play05:35

Of course, even simple computer programs might have hundreds of

play05:38

instructions, which meant that programs were stored as stacks of punch cards.

play05:41

So if you ever have the misfortune of accidentally dropping your program on the floor,

play05:45

it could take you hours, days, or even weeks to put the code back in the right order.

play05:49

A common trick was to draw a diagonal line on the side of the card stack called striping,

play05:53

so you'd have at least some clue how to get it back into the right order.

play05:57

The largest program ever punched into punch cards was the US Air Force's sage air defense system, completed in

play06:03

1955. At its peak, the product is said to have employed

play06:06

20% of the world's programmers. Its main control program was stored on a whopping

play06:11

62,500 punch cards, which is equivalent to roughly 5 megabytes of data.

play06:16

Pretty underwhelming by today's standards.

play06:20

And punch cards weren't only useful for getting data into computers, but also getting data out of them.

play06:25

At the end of a program, results could be written out of computer memory and onto punch cards by, well, punching cards.

play06:31

Then this data could be analyzed by humans or loaded into a second program for additional computation.

play06:36

Thanks, Thought Bubble.

play06:38

A close cousin to punch cards was punched paper tape,

play06:40

which is basically the same idea, but continuously instead of being on individual cards.

play06:44

And of course, we haven't talked about hard drives, CD-Roms, DVDs, USB thumb drives, and other similar goodies.

play06:50

We'll get to those more advanced types of data storage in a future episode.

play06:54

Finally, in addition to plug boards and punch paper,

play06:57

there was another common way to program and control computers pre-1980: panel programming.

play07:00

Rather than having to physically plug in cables to activate certain functions, this could also be done with huge panels full of switches

play07:07

and buttons. And there were indicator lights to display the status of various functions and values in memory.

play07:12

Computers of the 50s and 60s often featured huge control consoles that look like this.

play07:17

Although it was rare to input a whole program using just switches, it was possible.

play07:21

And early home computers made for the hobbyist market used switches extensively, because most home users couldn't afford expensive

play07:27

peripherals like punch card readers. The first commercially successful home computer was the Altair 8800, which sold in two versions:

play07:35

preassembled and as a kit. The kit, which was popular with amateur computing enthusiasts, sold for the then unprecedented low price of around

play07:42

$400 in 1975 or about $2,000 in 2017.

play07:47

To program 8800 you'd literally toggle the switches on the front panel to enter the binary Op codes for the instruction you wanted.

play07:53

Then you press the deposit button to write that value into memory.

play07:57

Then in the next location in memory, you toggle the switches again for your next instruction, deposit it and so on.

play08:03

When you had finally entered your whole program into memory, you would toggle the switches, move back

play08:08

to memory address zero, press the run button, and watch the little lights blink. That was home computing in 1975, wow.

play08:15

Whether it was plug board switches or punched paper

play08:17

Programming these early computers was the realm of experts. Either professionals who did this for a living, or technology enthusiasts.

play08:23

You needed intimate knowledge of the underlying hardware,

play08:26

So things like processor Op codes and register wits to write programs.

play08:30

This meant programming was hard and tedious. And even professional engineers and scientists struggle to take full advantage of what computing could offer.

play08:37

What was needed was a simpler way to tell computers what to do; a simpler way to write programs.

play08:43

And that brings us to programming languages which we'll talk about next episode. See you next week.

play08:49

Crash Course Computer Science is produced in association with PBS Digital Studios.

play08:53

At their channel you can check out a playlist of shows like Braincraft,

play08:56

Coma Niddy and PBS Infinite Series. This episode was filmed at the Chad and Stacey Emigholz studio in Indianapolis, Indiana

play09:03

And it was made with the help of all these nice people and our wonderful graphics team is Thought Cafe.

play09:08

Thanks for the Random Access Memories, I''ll see you next time.

Rate This

5.0 / 5 (0 votes)

Related Tags
计算机科学编程历史存储技术打孔卡电子记忆冯·诺依曼架构Jacquard织布机早期计算机程序加载控制面板家庭计算机
Do you need a summary in English?