I'm working on an application for part of a school project that simulates an operating system and which I launch using the Terminal. By nature it will consume all possible resources to loop over and over. Is there a command or flag I can enter in Terminal to limit the amount of CPU it can utilize while it is running? I tried using the following command:
$ nice -n 20 ./a.out
to set the priority as low as possible, but it still took up 100% CPU to run. It's a rather simple program and hardly needs any resources to work properly so any limits imposed on it should be fine.