I'm running MacOS Sierra on a mid-2014 MacBook Pro. About once/week, Safari’s CPU usage becomes very high, and it becomes very laggy. In the last instance I had just six windows open, none of which were playing videos, but Safari’s CPU usage was at 332%. In addition, even after closing all six windows, Safari’s CPU usage remained at a high level. I could only get it to stop by quitting and restarting Safari.
I got a Capture Data trace while it was happening, and sent it to AppleCare, where a senior advisor forwarded it to their engineering team. The response he got back was that it looks like I wasn't rebooting my computer often enough, which is necessary because the kernel expires (he recommends weekly, and I was rebooting it about every two months). As this was second-hand through the senior advisor, I wasn't able to get a more complete technical explanation. Further, I've not been able to find any official Apple documentation on this.
Can anyone give me a detailed technical explanation that elucidates what's actually going on here? I'm particularly curious if this is something particular to MacOS's microkernel (as opposed to monolithic kernel) design, and whether kernel expiration time is fixed based on wall clock, CPU time, etc. since last reboot, or varies based on certain factors. Thanks!
[I'll add that, from 2004-2009, I used a Power Mac G5, often running 10 applications w/ 10 windows each, as well as C++ programs that took weeks to finish, never rebooted except when needed for software updates, and got kernel panics less than once/year. But all three MacBook Pros I've owned (2008, 2011, 2014) have given kernel panics every month or two. I'm now wondering if this is because I'm not rebooting my MacBook Pros often enough — except this wasn't an issue with the G5.]
In case it's helpful, here's a screenshot showing the Activity Monitor during the event described in the first paragraph. Also displayed is the Intel Power Gadget readout; it seems odd that the CPU frequency is only 1.3 GHz (it's a 2.8 GHz Intel i7-4980HQ processor with a 4.0 GHz Turbo Boost) when a process is running at 332%. This behavior reminds me of (but is of course different from) thermal throttling of the CPU, where the system creates a fictitious high-load kernel task (typically ~>600%) to keep other processes from running, resulting in a low CPU frequency (0.8 GHz) (an example of thermal throttling is shown after). I didn't post these initially because I thought they might be a distraction from my core question about "kernel expiration" and weekly reboots, but have reconsidered given that forum members have disagreed with that explanation.
HIGH SAFARI ACTIVITY:
THERMAL THROTTLING OF CPU (FOR COMPARISON): The thermal throttling on my current MacBook Pro is a separate issue from the kernel crashes, since I got the crashes even in the winter when I first got the computer and when there was no thermal throttling, and also got them with my previous two MacBook Pros as well. I've just posted this for comparison. [In case you're curious: The throttling occurs consistently when the discrete video card is being used (4K monitor attached) and the ambient temp reaches 83F; I've never gotten throttling when the monitor is disconnected. The computer is properly-ventilated; it sits on a raindesign mStand. The Apple engineer says it needs to be brought in for service to check the fans for dust, and for possible reapplication of thermal paste. It's under warranty, but I can't do that until I can arrange for a loaner.]
UPDATE, JUNE 23, 2017: I was unable to reconnect with the original AppleCare senior advisor, so I spoke to a new one who took over my case. He's been with Apple for about a decade, and said the following (I'm paraphrasing):
1) Weekly reboots. It's too strong to say they're required. Rather, they represent good practice. MacOS loads as much as possible into RAM to maximize performance and, if your computer doesn't use ECC memory (which only the MacPros do), errors creep in. Eventually, these can cause a kernel panic. How much time this takes varies greatly depending on your usage pattern. Some can get away with going a long time without panics, others can't. [It's not just how heavy your usage is, but also what you use. So one heavy user may be fine with infrequent reboots, while another, using different software, may need more frequent ones.] It's really about risk management. Rebooting clears the RAM, allowing it to start fresh. The longer you wait between reboots, the more errors accumulate, and the greater the risk of kernel panics. While one week isn't a specific guideline — indeed, there are no specific guidelines; you might use, say, two weeks — it's generally held within Apple that regular reboots are a good practice, for the above reasons. If you want to keep that risk at a very low level, weekly reboots are an excellent practice.
[My one observation: This doesn't explain why I didn't get regular kernel panics with my PowerPC which, while it can take ECC memory, can't make use of the ECC functionality—unless the PowerPC chip itself used memory differently from the Intel chip, even with the same OS.]
As to the server farm example that's been raised, this wouldn't be an issue for servers using ECC memory, such as the old Mac XServe. However the Mac Minis of course do not, so I'm curious how often https://macminicolo.net (mentioned by Matt Holland in a comment below) finds the Mac Minis they host in their server farm need to be rebooted.
2) Kernel expiration: He's never heard of this. He will contact the engineer for clarification, and should report back within about a week. I'll let you know what he says. As part of this, he will try to get a clearer answer on the Safari CPU usage (as I mentioned above, the Apple engineers have an actual data trace of this event, so they have good information on it).
FINAL REPORT ON "KERNEL EXPIRATION" (UPDATED JAN 9, 2018): I never got a reply from the new senior advisor about "kernel expiration." I did some research myself and found that, while it seems there is no such thing as "kernel expiration" in OSX, there are (as was also mentioned by Zan Lynx in the discussion, below) "kernel timers" that do expire (see http://www.sciencedirect.com/science/article/pii/S174228761500050X ). So my best speculation is that the Apple Care engineer was referring to kernel timer expiration, and that this somehow got lost in translation (to use Monomeeth's expression) between the engineer and the original senior advisor, thus morphing into "kernel expiration" when that senior advisor tried to relay it to me. Alas,even if so, I don't know why the AC engineer was concerned about this in relationship to my uptime.
EPILOG (JULY 1, 2018): Over the past seven months I've used my Mac both with and without the weekly reboots. I've found, consistently, that when I do the weekly reboots my Mac behaves well, but when I miss them wonky behavior begins to pop up. My conclusion is that, while it may not be generally true that Macs require weekly reboots, my specific configuration does.
I have mid-2014 MacBook Pro 11,3 (2.8 GHz Intel i7-4980HQ & 1TB SSD w/ 4-lane PCIe link, formatted with APFS). During this entire time (since Jan. 2018) I've been running a clean install* of High Sierra with only the following non-Apple programs installed: MS Office, Mathematica, Logitech Gaming Mouse, Keyboard Maestro, Carbon Copy Cloner, Canon Printer, TomTom HOME, MacTeX (suite for using LaTeX), Firefox, Opera, Kindle, Copy Less, Size Up, Decelerator, TestGen, Turbo Tax, Flux, Launch Bar, and EtreCheck. [*I.e., I wiped the drive, installed High Sierra, and then installed the above programs.]
Further, prior to this (in Nov 2017), I brought the computer to Apple for warranty repair to address the thermal throttling and other issues. They found the thermal paste was indeed worn out, and replaced the entire motherboard, along with the battery (it was swollen), case, and trackpad. I've not experience thermal throttling since then.
My Mac spends most of its time at home, connected to a Logitech K811 keyboard and G502 mouse, and a Dell P2715Q 27" 4K monitor.