@ShadowJonathan if it's only about simulating those conditions for a single process (and its sub-processes), cgroups might be worth a look.
If you don't want to fiddle around with the low-level details of them, wrap the execution of your process in "systemd-run --user --wait --pty ..." and use "--slice" to assign the process to the corresponding slice with the desired resource constraints.
https://www.freedesktop.org/software/systemd/man/latest/systemd-run.html
https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html