1. 程式人生 > 實用技巧 >程序和執行緒上下文切換_編碼人員:上下文切換對於計算機和關係而言都很難

程序和執行緒上下文切換_編碼人員:上下文切換對於計算機和關係而言都很難

程序和執行緒上下文切換

程序和執行緒上下文切換

Coders: The Making of a New Tribe and the Remaking of the World

Clive Thompson is a longtime contributing writer for the New York Times Magazine and a columnist for Wired and now has a new book out called "Coders."

克萊夫·湯普森(Clive Thompson)是《紐約時報》(New York Times Magazine)的長期特約作家,也是《連線》(Wired)的專欄作家,現在有一本新書叫做《編碼員》

"Along the way, Coders thoughtfully ponders the morality and politics of code, including its implications for civic life and the economy. Programmers shape our everyday behavior: When they make something easy to do, we do more of it. When they make it hard or impossible, we do less of it."

“一路走來,編碼人員若有所思地思考程式碼的道德和政治問題,包括其對公民生活和經濟的影響。程式設計師塑造了我們的日常行為:當他們使事情變得容易時,我們就會做更多的事情。甚至是不可能的事情,我們會少做些。”

I'm quoted in the book and I talk about how I've struggled with context-switching.

我在書中被引用過,並且談論了我如何在上下文切換中苦苦掙扎。

Here is TechTarget's decent definition of Context Switching:

這是TechTarget對上下文切換的合理定義:

A context switch is a procedure that a computer's CPU (central processing unit) follows to change from one task (or process) to another while ensuring that the tasks do not conflict. Effective context switching is critical if a computer is to provide user-friendly multitasking.

上下文切換是計算機的CPU(中央處理單元)遵循的過程,以從一個任務(或程序)更改為另一個任務(或程序),同時確保任務不衝突。 如果計算機要提供使用者友好的多工處理,則有效的上下文切換

至關重要。

However, human context switching is the procedure we all have to go through to switch from "I am at work" mode to "I am at home" mode. This can be really challenging for everyone, no matter their job or background, but I propose for certain personalities and certain focused jobs like programming it can be even worse.

但是,人類上下文切換是我們所有人都必須經歷的過程,才能從“我在工作中”模式切換到“我在家裡”模式。 對於每個人,無論他們的工作或背景如何,這都可能是真正的挑戰,但我建議某些個性和某些重點工作(例如程式設計)會變得更糟。

Quoting Clive from an ArsTechnica article where he mentions my troubles, emphasis mine:

在ArsTechnica文章中引用Clive的話,他提到了我的麻煩,重點是我的:

One of the things that really leapt out is the almost aesthetic delight in efficiency and optimization that you find among software developers. They really like taking something that's being done ponderously, or that's repetitive, and optimizing it. Almost all engineering has focused on making things run more efficiently. Saving labor, consolidating steps, making something easier to do, amplifying human abilities. But it also can be almost impossible to turn off. Scott Hanselman talks about coding all day long and coming down to dinner. The rest of the family is cooking dinner and he immediately starts critiquing the inefficient ways they're doing it: "I've moved into code review of dinner."

真正的突破之一是您在軟體開發人員中發現的效率和優化方面的美學享受。 他們真的很喜歡採取一些艱鉅或重複的工作,並對其進行優化。 幾乎所有工程技術都致力於提高效率。 節省勞動力,鞏固步驟,使事情變得更容易,增強了人類的能力。 但是關閉它幾乎也是不可能的。 斯科特·漢瑟曼(Scott Hanselman)整天都在談論編碼,然後晚飯。 其餘的家人正在做晚餐,他立即開始批評他們做飯的效率低下:“我已經進入晚餐的程式碼審查。”

Ordinarily a good rule of thumb on the internet is "don't read the comments." But we do. Here's a few from that ArsTechnica thread that are somewhat heartening. It sucks to "suffer" but there's a kind of camaraderie in shared suffering.

通常,網際網路上的一個很好的經驗法則是“不要閱讀評論”。 但是我們做到了。 這是來自ArsTechnica執行緒的一些令人振奮的訊息。 它很“痛苦”,但在共同的痛苦中卻有一種友情。

With reference to "Scott Hanselman talks about coding all day long and coming down to dinner. The rest of the family is cooking dinner and he immediately starts critiquing the inefficient ways they're doing it: "I've moved into code review of dinner.""

關於“ Scott Hanselman整天談論編碼並開始吃飯。家庭其他成員正在做晚餐,他立即開始批評他們做事效率低下的方式:”我已經進入晚餐的程式碼審查。”

Wow, that rings incredibly true.

哇,真是令人難以置信。

That's good to hear. I'm not alone!

聽起來還不錯。 我不孤獨!

I am not this person. I have never been this person.Then again, I'm more of a hack than hacker, so maybe that's why. I'm one of those people who enjoys programming, but I've never been obsessed with elegance or efficiency. Does it work? Awesome, let's move on.

我不是這個人。 我從來都不是這個人,再說一次,我更像是一個黑客而不是黑客,所以也許這就是原因。 我是喜歡程式設計的人之一,但我從未被優雅或效率所困擾。 它行得通嗎? 太好了,讓我們繼續前進。

That's amazing that you have this ability. For some it's not just hard to turn off, it's impossible and it can ruin relationships.

您擁有這種能力,真令人驚訝。 對於某些人來說,不僅要關閉它,這是不可能的,並且可能破壞關係。

When you find yourself making "TODO" and "FIXME" comments out loud, it's time to take a break. Don't ask me how I know this.

當您發現自己在大聲說“ TODO”和“ FIXME”時,該休息一下了。 不要問我我怎麼知道的。

It me.

是我

Yep, here too 2x--both my wife and I are always arguing over the most efficient way to drive somewhere. It's actually caused some serious arguments! And neither one of us are programmers or in that field. (Although I think each of us could have been.)From the day I was conscious I've been into bin packing and shortest path algorithms--putting all the groceries up in the freezer even though we bought too much--bin packing. Going to that grocery store and back in peak traffic--shortest path. I use these so often and find such sheer joy in them that it's ridiculous, but hey, whatever keeps me happy.

是的,在這裡也是2倍-我和我妻子都一直在爭論最有效的駕駛方式。 實際上引起了一些嚴重的爭論! 我們倆都不是程式設計師,也不是那個領域的程式設計師。 (儘管我認為我們每個人都應該這樣做)從我意識到這一天起,我就開始研究箱裝箱和最短路徑演算法-將所有雜貨都放進冰箱,即使我們買得太多-箱裝箱。 去那家雜貨店,然後返回高峰流量-最短路徑。 我經常這樣使用它們,並在它們中找到如此巨大的快樂,這很荒謬,但是,嘿,無論什麼讓我高興。

This is definitely a thing that isn't programmer-specific. Learning to let go and to accept that your partner in life would be OK without you is an important stuff. My spouse is super competent and I'm sure could reboot the router without me and even drive from Point A to Point B without my nagging. ;)

這絕對不是特定於程式設計師的事情。 重要的是,學會放手並接受生活中的伴侶,沒有你就可以了。 我的配偶非常有能力,我敢肯定,如果沒有我,我可以重啟路由器,甚至可以在不打擾的情況下從A點開車到B點。 ;)

However we forget these things and we tend to try and "be helpful" and hyper-optimize things that just don't need optimizing. Let it go. Let people just butter their damn bread the way they like. Let them drive a mile out of the way, you'll still get there. We tend to be ruder to our partners than we would be to a stranger.

但是,我們忘記了這些事情,我們傾向於嘗試“有所幫助”並對那些不需要優化的事情進行超優化。 放手吧。 讓人們以自己喜歡的方式給該死的麵包塗黃油。 讓他們開一英里,您仍然可以到達那裡。 我們對合作夥伴的態度往往比對陌生人的態度更魯rud。

That’s part of the reason why I’m now making all dinners for my family ;-)

這就是我現在為家人做所有晚餐的部分原因;-)

LOL, this is also a common solution. Oh, you got opinions? Here's the spatula!

大聲笑,這也是一種常見的解決方案。 哦,你有意見嗎? 這是鏟子!

What do YOU think? How do you context switch and turn work off and try to be present for your family?

你怎麼看? 您如何上下文切換和關閉工作並嘗試在家人面前出現?



Sponsor: Manage GitHub Pull Requests right from the IDE with the latest JetBrains Rider. An integrated performance profiler on Windows comes to the rescue as well.

贊助商:使用最新的JetBrains Rider從IDE直接管理GitHub Pull Requests。 Windows上的整合效能分析器也可以解決。

關於斯科特 (About Scott)

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

斯科特·漢塞爾曼(Scott Hanselman)是前教授,前金融首席架構師,現在是演講者,顧問,父親,糖尿病患者和Microsoft員工。 他是一位失敗的單口相聲漫畫家,一個玉米種植者和一本書的作者。

facebook twitter subscribe About 關於 Newsletter 時事通訊 Hosting By 主持人 Hosted in an Azure App Service

翻譯自: https://www.hanselman.com/blog/coders-context-switching-is-hard-for-both-computers-and-relationships

程序和執行緒上下文切換