英語閱讀雙語新聞

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

本文已影響 3.04W人 

ing-bottom: 56.29%;">《賴以生存的算法》 助你提高效率

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.

如果你想好好做點事情,就別超過那個響應標準。

猜你喜歡

熱點閱讀

最新文章

推薦閱讀