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)游戏、从网络iTunes更加多视频、检查你否敲打了键盘或挪动了鼠标,以及其它许多进程。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.如果你想要只想做到点事情,就别多达那个号召标准。
本文关键词:开云(中国)Kaiyun·官方网站,开云(中国)Kaiyun
本文来源:开云(中国)Kaiyun·官方网站,开云(中国)Kaiyun-www.ntzswl.com