This is a common computer problem, this do happens due to insufficient RAM. When this happen, first check your computer if it has sufficient RAM.
If the computer is hanging randomly, it could be damaged system files, software compatibility or damaged registry files. You can repair corrupted system files by running the System Update Readiness tool, the Deployment Image Servicing and Management (DISM) tool or the System File Checker (SFC).
If you have recently installed an app or driver and find that Windows is now hanging randomly, try removing the recently installed software. Also you can try running System Restore to return the system to a working state.
Recommend To Read: Network Architecture
If the registry becomes damaged, it is recommended that you restore Windows to a working state using either System Restore or Refresh.
Disconnect all external devices connected to the computer and try starting the computer with devices disconnected.
Update the computer firmware and drivers available from the PC manufacturer. These updates may resolve the issue.
Making changing on the computer can cause the computer to freeze. If that is the case you can resolve the problem by using System Restore.
If Chkdsk runs while starting Windows, it could be a sign of a hard disk failure. Restart the computer, and let Windows complete the disk check. Windows will repair the file system errors automatically or Manually run the Chkdsk command prompt utility to check the drive. If the issue not resolved, then you may remove the storage device.
Read: Computer Components