Apple - iMac occasionally gets very sluggish. Memory Pressure is high and its hard to use computer. Why is this?
A dying a hard drive will actually cause this symptom as the system "waits" for read/write operations to complete. It'll eventually get there, but often times, it will crash.
From the comments, you've confirmed this with the SMART status saying "Failed" which means that drive literally has one foot in the grave and slowly putting the other one in now.
I just hate putting money into my old computer.
I can't agree more. However, this one might be worth an SSD upgrade. You can get a 120GB for under $20USD and a 250GB for under $40. Why go through the trouble?
Here's a little teaser....
This is a little side project I've been hacking away on... It's a white 2007 MacBook.
(Forgive the bezel, I'm dealing with an unscrupulous vendor in NJ who sent me a dead LCD and refused to exchange it due to COVID-19 and I'm waiting on a resolution from AMEX). I'm into this for about $40 (a little horse trading on ebay helps) and everything works - Ethernet, Bluetooth, external display, and even WiFi! It's utterly useless, from a macOS perspective, but not for FreeBSD with the MATE DE. Even if all else fails, I still have a good SSD that I got for $20 that can go into another machine...
Your iMac is a tank, and I'd hate to see it meet an untimely demise. ;-)
Relatively high memory usage for helpd in your screenshot is a hint that this might be the
helpd indexing problem.
It is supposed to index help files when a new contents appears (that is, rarely, like when you install a new application), which is detected by monitoring the /Applications
folder. Something goes wrong and it confuses launching the application with changing the folder contents, and triggers the indexing process without the real reason. (the implementation is broken anyway, because obviously taking most of the RAM for a background process and effectively killing the performance can't be intentional. But you can consider yourself lucky with 16 GB of RAM - my mac mini was routinely being halted for an hour or two whenever the mac os decided it is time to take 12GB(!) of its 8GB for the pointless indexing task.)
How did I solve the problem? Unfortunately, I can no longer find the website that helped me save my machine last year, but if I recall correctly, I have deleted the contents of helpd cache, like this:
rm ~/Library/Caches/com.apple.helpd/*
...then restart. If I am mistaken, perhaps it might have been some other cache, but at least you have a new hypothesis to investigate. Deleting the cache files should be safe no matter what, because they are, well, just caches so they are recreated when needed.
Similar questions, not necessarily helpd related:
helpd uses 100% CPU after installing any application with documentation
MacOS Mojave: Always indexing, the whole OS is too slow
https://discussions.apple.com/thread/3209466