You can use CPULimit to restrict CPU usage on Ubuntu Linux, as demonstrated in a tutorial from Howtoforge.
How to limit CPU usage with CPULimit on Ubuntu Linux
This tutorial describes how to limit CPU usage in Ubuntu. I will use CPU-limit utility for this purpose. Cpulimit is a tool which limits the CPU usage...