当前位置

首页 > 英语阅读 > 双语新闻 > 《赖以生存的算法》 助你提高效率

《赖以生存的算法》 助你提高效率

推荐人: 来源: 阅读: 2.94W 次

《赖以生存的算法》 助你提高效率

Can computer scientists — the people who think about the foundations of computing and programming — help us to solve human problems such as having too many things to do, and not enough time in which to do them?

计算机科学家们——那些研究计算机和编程的原理的人,能否帮助我们解决人类的问题,例如,要做的事太多,可用的时间却不够?

That’s the premise of Algorithms to Live By, a book by Brian Christian and Tom Griffiths.

这是布赖恩•克里斯蒂安(Brian Christian)和汤姆•格里菲思(Tom Griffiths)合著的新书《赖以生存的算法》(Algorithms to Live By)中提出的主张。

It’s an appealing idea to any economist.

这是对任何经济学家都有吸引力的想法。

We tend to think of everyday decisions as a branch of applied mathematics, which is what computer science is.

我们倾向于认为日常决策是应用数学的一个分支,而计算机科学亦是如此。

To be clear, using computer science is not the same as using computers.

准确来说,利用计算机科学和使用计算机不是一回事。

Computer scientists have devoted decades to problems such as sorting information, setting priorities and networking.

计算科学家倾注了数十年时间来解决各种问题,如整理信息、排定优先顺序和联网。

Many of the algorithms they have developed for computers can also work for human beings.

他们为计算机开发的许多算法也适用于人类。

An algorithm, after all, is not a computer program. It’s a structured procedure, a kind of recipe.

毕竟,算法并非计算机程序,而是一种结构化的步骤方法,类似于菜谱。

(Algorithms are named after a 9th-century Persian mathematician, Al-Khwārizmī, but they predate his work by thousands of years.)

(算法一词因9世纪波斯数学家花拉子密(Al-Khwārizmī)而得名,但在其研究工作的数千年前就已存在。)

So, what is the optimal recipe for working through the to-do list? Perhaps it is simpler than you think: do all the jobs on the list in any order, as it will take the same amount of time in the end.

那么,什么是完成待办事项列表的最佳配方呢?也许比你以为的更简单:以任意顺序来做列表上的事,因为最后耗费的总时长一样。

There is a touch of brilliance in this advice but it also seems to show that computer science will never shed light on the stress and wheel-spinning that we feel when we have too much to do.

这是个带有一点儿天才的建议,但似乎表明,当我们有太多事情要做而感到压力和手忙脚乱时,计算机科学永远不能给我们带来启示。

Or so I thought.

或者说我以前是这么认为的。

Then I read a 1970 paper by the computer scientist Peter Denning, which describes a problem that computers can have when multitasking.

接着我读到计算机科学家彼得•丹宁(Peter Denning)在1970年发表的一篇论文,文中描述了计算机在多线程工作时可能遇到的一个问题。

Most computers do not literally multitask; instead, like humans, they switch rapidly between one thing and another.

大多数计算机实际上无法真的多线程工作;而是像人类一样,会迅速从一件事切换到另一件事。

A computer will flit between updating your screen with a Pokémon, downloading more videos from the internet, and checking to see if you have clicked the keyboard or moved the mouse, among many other processes.

计算机会在以下任务中快速切换:在你的屏幕上更新口袋妖怪(Pokémon)游戏、从网络下载更多视频、检查你是否敲击了键盘或挪动了鼠标,以及其它许多进程。

But even a computer cannot do an unlimited number of tasks and, at a certain point, disaster can strike.

但即使是计算机,也不能同时做无限量的工作,一旦达到某一限度,灾难就会发生。

The problem stems from the use of readily accessible caches to store data.

这一问题源于使用易存取的高速缓存(caches)来储存数据。

To understand caches, imagine a pianist playing from two or three sheets of music in front of her.

可以这么理解高速缓存:想象有一名钢琴家在演奏她面前的两三页乐谱。

Those sheets are in the fastest cache.

这些乐谱都是储存在最高速的缓存中。

There are other sheets behind them, accessible in a few moments.

乐谱背后还有其他乐谱,一会儿就能读取。

Then there are larger but slower caches: music in the piano stool; more up in the attic, and yet more in a music shop.

此外还有容量更大但速度更慢些的缓存:放在琴凳里的乐谱;阁楼上还有更多乐谱,再有更多是存放在音乐商店里。

There is a trade-off between the volume of information and the speed with which it can be accessed.

在信息储存量和读取速度之间存在一种取舍。

This set-up is no problem if the pianist only plays one complete piece at a time.

如果钢琴家一次只演奏一首完整的乐曲,那么这样的设置是没有问题的。

But if she is asked to switch every minute or so, then some of her time will be taken retrieving a piece of music from the piano stool.

但是,如果要求她每隔1分钟左右换一首曲子,那么她就要花一些时间来取出琴凳里乐谱。

If she must change every few seconds, then she will be unable to play a note; all her time will be taken switching sheet music between the stand and the piano stool.

如果她必须每隔几秒就换一首曲子,那她就没法演奏了;她所有的时间都会被用来调换谱架上和琴凳里的乐谱。

It is the same with a computer cache: there will be a hierarchy — from super-fast memory in the microprocessor itself all the way down to a hard drive (slow) and offsite back-up (very slow).

这跟计算机的高速缓存一样:存在一个等级制度——从微处理器自身的超高速内存,向下一直到硬盘(慢速)和异地备份(非常慢)。

To speed things up, the computer will copy the data it needs for the current task into a fast cache.

要想提高速度,计算机必须把当前任务所需的数据复制到快速缓存。

If the tasks need to be switched too often, the machine will spend all its time copying data for one task into the cache, only to switch tasks, wipe the cache and fill it with something new.

如果任务切换太频繁,机器会把所有时间用来将一个任务的数据复制到缓存,然后切换任务、清除缓存并存入新的内容。

At the limit, nothing will ever be achieved.

在极限状态下,什么事都完成不了。

Denning described this regrettable state of affairs as thrashing.

丹宁将这种令人遗憾的状态形容为系统崩溃(thrashing)。

We’ve all had days filled with nothing but thrashing, constantly switching focus from one task to another but never actually doing anything.

我们都有过除了崩溃以外一事无成的日子,不断从一项任务切换到另一项,实际上却什么都做不了。

Can we borrow a solution from the computers? The most straightforward solution is to get a bigger cache; that is easier for a computer than for a human, alas.

我们能否从计算机借鉴解决方案?最直截了当的方法是换个更大的缓存;可惜,这对计算机来说比人类更容易。

The obvious alternative is to switch tasks less often.

显而易见的替代方法是减少任务切换。

Computers practice interrupt coalescing, or lumping little tasks together.

计算机采用中断合并(interrupt coalescing)技术,即把多个小任务合并到一起处理。

A shopping list helps prevent unnecessary return trips to the shop.

一份购物清单有助于避免多次往返商店的不必要旅程

You can put your bills in a pile and deal with them once a month.

你还可以把账单放在一块儿,每月一并处理。

But we often find it difficult not to flit from one task to another.

但我们往往发现很难不从一个任务切换到另一个。

Computer science says there’s a reason for the pain: there is a trade-off between being swiftly responsive and marking out chunks of time to be productive.

计算机科学认为这种痛苦有一个原因:即在迅速响应和划出大块时间以提高生产率之间存在取舍。

If you want to respond to your boss’s emails within five minutes, you must check email at least once every five minutes.

如果你想在5分钟之内回复你老板的邮件,你必须至少每5分钟查一次邮件。

If you want to go off-grid for a week to work on your novel, your response time must slow to a week.

如果你想戒网一周来写小说,那么你的响应时间就必须放慢至一周。

Any solution should acknowledge that trade-off.

任何解决方案都应该承认这种取舍。

Decide on an acceptable response time and interrupt yourself accordingly.

确定一个可接受的响应时间,然后据此打断自己的工作。

If you think it’s perfectly fine to answer emails within four hours — fine by most standards — then you only need to check your email once every four hours, not once every four minutes.

如果你认为在4小时之内回复邮件完全没有问题(按多数标准都没问题),那么你只需要每4个小时查一次邮件,而不是每4分钟查一次。

As Christian and Griffiths advise, decide how responsive you want to be.

正如克里斯蒂安和格里菲思建议的那样,决定自己想要如何响应。

If you want to get things done, be no more responsive than that.

如果你想好好做点事情,就别超过那个响应标准。