进程和线程上下文切换_编码人员:上下文切换对于计算机和关系而言都很难

进程和线程上下文切换

进程和线程上下文切换

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?

你怎么看? 您如何上下文切换和关闭工作并尝试在家人面前出现?

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

进程和线程上下文切换

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值