This is just as easy in most other programming languages... probably even easier with a bash script.
On the other hand, and machine with properly configured limits will mitigate either one.
the problem is you need root for that. The OPs code there, even though it is quite amateurish, doesn't require root.