How come terminal processes are paused when display sleeps?

I'm running some long-running CPU intensive scripts, but I've noticed that the CPU utilisation becomes 0 when the display sleeps. I've already kept the machine awake using caffeine. Is this expected behaviour?


Solution 1:

In High Sierra there is a 2 setting in System Preferences > Energy for that. Enable Prevent computer from sleeping....or/and set Display sleep to Never.

enter image description here