To use only 2 cores of the CPU of the computer, do the following action after opening a terminal window in Linux, where Device10.avd is the Android 10 AVD created:
vi ~/.android/avd/Device10.avd/config.ini <enter>
Change the values in red for the below parameters in the file to those in blue as below.
Save the file and restart Android Studio. This should reduce the risk of the system crashing.