I experienced a frequent issue on a Lenovo Thinkpad T440p computer running Windows 10.
The system would sometimes become completely unresponsive for around 30 seconds, where every program would freeze.
Then the system would resume with very high disk activity for a while from the System and compressed memory process.
(Initially this made me suspect an issue with this process, but it seems like this was just a side effect)
In Event Viewer I found events like these around the time the freezes occured:
Log Name: System Source: storahci Event ID: 129 Description: Reset to device, \Device\RaidPort0, was issued.
I found this blog post and discussion, which seems to have a solution and explanation:
The issue may be caused by AHCI power saving settings.
The simple workaround is to change the system power profile to High Performance under:
Control Panel -> Power Options
(This disables a number of power saving settings including one for AHCI)
Be aware that system freezes can also be caused by firmware bugs, driver bugs, defective SATA cable, failing harddisk/SSD and possibly other causes.