ulimit -H -u 10
will (hard)limit the current process (the shell) to 10 subprocesses. You can also use it to limit the number of open files etc.
To globally configure that for a user/group you’d use /etc/security/limits.conf
instead.
If you want to prevent users from filling up the disk, take a look into quota.
An(n)ons favourite song: https://youtu.be/xvT2h0DRfX0