什么是kernel_task,为什么在Mac上运行?

什么是kernel_task,为什么在Mac上运行?

So you found something called “kernel_task” in Activity Monitor, and you want to know what it is. Good news: it’s nothing nefarious. It’s actually your operating system.

因此,您在Activity Monitor中找到了一个名为“ kernel_task”的东西,并且您想知道它是什么。 好消息:这绝不是邪恶的。 实际上是您的操作系统。

This article is part of our ongoing series explaining various processes found in Activity Monitor, like hiddmdsworkerinstalld, and many others. Don’t know what those services are? Better start reading!

这篇文章是一部分我们正在进行一系列的解释活动监视器中发现,像各种Craft.iohiddmdsworkerINSTALLD ,和其他许多人 。 不知道这些服务是什么? 最好开始阅读!

A “kernel,” if you didn’t know, is at the core of any operating system, sitting between your CPU, memory, and other hardware and the software that you run. When your turn on your Mac, the kernel is the first thing that starts, and basically everything you do on your computer flows through the kernel at some point. Activity Monitor puts all of this varied activity under one banner: kernel_task.

如果您不知道,“内核”是任何操作系统的核心,位于CPU,内存,其他硬件和运行的软件之间。 打开Mac时,首先启动内核,并且基本上,您在计算机上执行的所有操作都会在某个时刻通过内核。 活动监视器将所有这些不同的活动置于一个横幅下:kernel_task。

If you’re computer isn’t running slowly, don’t worry about this process taking up a lot of memory or occasionally using up CPU cycles: that’s normal. Unused memory is wasted memory, so kernel_task will put it to work for things like caching files, and running a modern operating system means sometimes using some CPU power.

如果您的计算机运行缓慢,请不要担心此过程占用大量内存或偶尔消耗CPU周期:这是正常的。 未使用的内存是浪费的内存 ,因此kernel_task会将其用于缓存文件之类的工作,而运行现代操作系统意味着有时会使用一些CPU功能。

But if kernel_task is constantly using a majority of your system resources, and your Mac is really slow, you might have a problem. Restarting your Mac is the only way to restart your kernel, and sometimes that will solve all problems. But if the behavior persists, here’s a bit more information.

但是,如果kernel_task一直在使用大部分系统资源,而Mac确实很慢,则可能有问题。 重新启动Mac是重新启动内核的唯一方法,有时这可以解决所有问题。 但是,如果行为仍然存在,这里还有更多信息。

kernel_task假装使用CPU周期保持凉爽 (kernel_task Pretends to Use CPU Cycles To Keep Things Cool)

If you’re doing something that takes up a lot of processing power—converting 4K videos, say—you might wonder what’s taking so long and look at the Activity Monitor. Often you’ll see kernel_task is using up a lot of CPU power…power which you’d rather that power be used by your intensive process.

如果您正在做的事情占用了很多处理能力(例如转换4K视频),您可能会想知道花了这么长时间来查看活动监视器。 通常,您会看到kernel_task消耗了大量的CPU能力……您宁愿由密集型过程来使用这些能力。

It’s understandable if you’re frustrated, but it turns out your operating system is doing this on purpose to prevent your CPU from overheating. To quote Apple’s support page:

如果您感到沮丧,这是可以理解的,但是事实证明,操作系统是故意这样做的,目的是防止CPU过热。 引用Apple的支持页面

One of the functions of kernel_task is to help manage CPU temperature by making the CPU less available to processes that are using it intensely. In other words, kernel_task responds to conditions that cause your CPU to become too hot, even if your Mac doesn’t feel hot to you. It does not itself cause those conditions. When the CPU temperature decreases, kernel_task automatically reduces its activity.

kernel_task的功能之一是通过减少CPU对频繁使用它的进程的可用性来帮助管理CPU温度。 换句话说,即使您的Mac感觉不热,kernel_task也会对导致CPU过热的情况做出响应。 它本身不会导致这些情况。 当CPU温度降低时,kernel_task会自动减少其活动。

So kernel_task isn’t really using up all that CPU power: it’s just preventing your intensive process from using it in order to prevent overheating. Everything should get back to normal when you’re out of the danger zone.

因此kernel_task并没有真正消耗掉所有的CPU功能:它只是在防止繁琐的过程使用它来防止过热。 当您离开危险区域时,一切都应该恢复正常。

One application with a bad habit of using up a lot of CPU and prompting this is Flash. If you see Flash or browser tabs taking up a lot of CPU power alongside kernel_task, consider uninstalling or disabling Flash completely to avoid the problem. This will stop Flash from using up your CPU with its various bugs, and kernel_task from having to shield your CPU to keep things cool.

Flash是使用不良习惯占用大量CPU并提示它的一个应用程序。 如果看到Flash或浏览器选项卡与kernel_task一起占用大量CPU资源,请考虑完全卸载或禁用Flash以避免此问题。 这将阻止Flash耗尽CPU的各种错误,并阻止kernel_task屏蔽CPU以保持良好状态。

引导到安全模式以解决内核问题 (Boot Into Safe Mode to Troubleshoot Kernel Problems)

If you find kernel_task using up a lot of CPU or memory when you’re not doing much of anything, you might have another problem on your hands. Usually this has to do with third party kernel extensions, called “kexts” by macOS. These modules that come with hardware drivers and some software, and interface directly with the kernel. A faulty kext could cause kernel_task to take up excessive system resources.

如果您在不执行任何操作时发现kernel_task占用大量CPU或内存,那么您可能会遇到另一个问题。 通常,这与macOS称为“ kexts”的第三方内核扩展有关。 这些模块与硬件驱动程序和某些软件一起提供,并直接与内核交互。 错误的kext可能导致kernel_task占用过多的系统资源。

To test this, you should boot your Mac into Safe Mode, one of the hidden Mac startup options every Mac user should know about. Shut down your Mac, then turn it on while holding the Shift key. You’ll see the word “Safe Boot” in the login screen.

要对此进行测试,您应该将Mac引导到安全模式,这是每个Mac用户都应该知道的隐藏的Mac启动选项之一 。 关闭Mac,然后在按住Shift键的同时将其打开。 您会在登录屏幕上看到“安全启动”字样。

什么是kernel_task,为什么在Mac上运行?

Safe Mode does not enable third party kexts, so if your Mac doesn’t have any problems in safe mode, you’ve found your problem. Uninstall any third party software or drivers you’ve installed recently and see if that helps.

安全模式不会启用第三方kext,因此,如果您的Mac在安全模式下没有任何问题,则说明您已找到问题。 卸载您最近安装的任何第三方软件或驱动程序,看看是否有帮助。

什么是kernel_task,为什么在Mac上运行?

If you want to dive in further, Etrecheck runs dozens of diagnostics, including a list of all kexts installed and running on your system. Uninstall anything you think may be causing the problem, and see if that solves it. If not, you might need to consider a trip to the Apple Store, or your friendly local Mac repair shop.

如果您想进一步研究, Etrecheck会运行许多诊断程序 ,包括系统上已安装并正在运行的所有kext的列表。 卸载您认为可能导致问题的任何东西,然后查看是否可以解决。 如果没有,您可能需要考虑去Apple Store或您当地的Mac维修店。

其他一些尝试 (A Few Other Things to Try)

If you still have a problem after all that, there’s a few things you could try.

如果毕竟还是有问题,可以尝试一些方法。

Sometimes resetting the NVRAM on your Mac will help. Consider scanning your Mac for malware, which could be causing the problem. You could also do the usual things to speed up your Mac, like removing unnecessary startup items and freeing up hard drive space.

有时在Mac上重置NVRAM会有所帮助。 考虑在Mac上扫描恶意软件 ,这可能是导致问题的原因。 您还可以执行通常的操作来加快Mac的速度 ,例如删除不必要的启动项并释放硬盘空间。

If nothing helps, sometimes you need to stop wasting your time and re-install macOS from scratch. Obviously that should be a last resort, but it’s important to know when you’re beaten.

如果没有帮助,有时您需要停止浪费时间,然后从头开始重新安装macOS 。 显然,这应该是不得已的方法,但是知道何时被殴打很重要。

Photo Credit: Matthew Pearce

照片来源: 马修·皮尔斯(Matthew Pearce)

翻译自: https://www.howtogeek.com/310293/what-is-kernel_task-and-why-is-it-running-on-my-mac/