Thank you for leading me to know the solution!
I’m 5-6 hours in both playing game, and normal dev work without freezing although I’m using integrated GPU on Ryzen 2200g without dedicated one. Prior to this I experienced random freezing, and crashing.

Another solution is to use cronjob for root user as follows.

sudo crontab -e

then append the following line

@reboot /yourdir/yourscript.sh

I just knew that @reboot is special and will be executed only once when user logs in to the system. If user logs out, and logs in again, it will execute again.