#How to run terminal process and limit its cpu and ram usage?

10 messages · Page 1 of 1 (latest)

dark galleon
#

Im currently working on process manager (like pm2 or smth). I need somehow run process (like python main -m) and limit its ram and cpu usage. Also would be great to change process cwd (/some/dir, python main -m).

I tried to google it, but only thing i found is how to limit the the java app itself...

royal minnowBOT
#

This post has been reserved for your question.

Hey @dark galleon! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

shut pumice
#

That's OS dependent. You need to call specific APIs giving them the correct process ids etc

dark galleon
#

so... no crossplatform solution?

shut pumice
#

Not really no, unless there's a java library that does things like this for you

#

Although maybe if you use the process api you can set some priorities etc

#

The processbuilder api does let you set the working directory, that's a start. No priorities though

dark galleon
#

ok, process api looks kinda what i need, but i'll leave question open for some time

#

perhaps someone here knows a lib i need