Question

Recently I am recording the amount of data written in my SSD from kernel_task on my new M1 MacBook because that is the main source of memory swapping. I found that memory swapping is less when the MacBook is newly booted up, and more when I don't shut down for a few days. memory data However, I cannot find any relation why that is the case, or is that just a coincidence? I also got similar results when I use iStatMenus 6. Here is the recent 7 day results (white portion is when the computer is shutted down): enter image description here It seems like kernel_task is writing more the longer I leave it on, but I don't see any correlations between the two. I am using similar apps each day. Also, I am currently not worried about my SSD life because it is only writing 30GB per day max, and I have 100% SSD lifetime. Thanks for answering.

Was it helpful?

Solution

kernel_task is not an actual process like the others you see in Activity Monitor, it is a kind of “virtual process” that actually represents the kernel itself.

This means that it is not kernel_task itself that performs some job and in the process writes to disk, rather the kernel is continually (many, many times per second often) asked by your running programs to do stuff on their behalf.

You won’t find any “template” or “fixed model” for how kernel_task behaves, as that depends on whatever the rest of the programs on your computer is doing.

You also write about swapping. This is done when the amount of free RAM is not sufficient to cover the requests from running programs. These requests are dependent on whatever you’re doing with your computer. For example if you’re running a web browser, some sites might require almost no RAM to display - and others might require lots and lots of RAM.

As for why it tends to be more after running your computer for a long time - that is actually quite logical. Over time you have probably run more and more different programs, have more things loaded in (open documents, web site tabs, etc), and even more that contribute to your total RAM Usage than when you just booted the computer.

Some programs might also leak memory due to bugs This means that long running programs request some memory, and then forget about it, never giving it back to the operating system, even though they’re no longer using it. The longer you keep programs running, the more leaks you’ll eventually have. You can reclaim the leaked memory by closing the program - or by rebooting the computer.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top