# Resource limits in FreeBSD (kind of linux cgroups)



## jacum (Dec 2, 2016)

Hello everyone.
After a long time spent with linux (we use it for development at work), I decided to go back and have a look at FreeBSD.
I used to compile software using the ports collection. On the other side, I use gentoo linux and, as a developer and building everything from source in  gentoo, my machine spends 80% of the time compiling...
I must admit that since the introduction of CGROUPS I have forgotten the times when compiling meant (almost) not doing anything else in a desktop system, which used to turn slow and unresponsive.
When you get accustomed to such a great thing of doing everything smoothly and forget that you are rebuilding the world at the same time (with make -j9) , I  am wondering if FreeBSD has something similar. Another problem is, apart from the CPU time eaten by gcc while compiling, the extraction of a big archive (again in the very same context of a port installation). While this is taking place, the system is unusable (CPU + disk I/O).

I tried to launch portupgrade (as root) with the lowest nice possible, to no avail.

I hope there is a solution (or a future planned solution) in order to make FreeBSD desktop multi tasking performance comparable to other modern operating systems.

If this is not the most appropriate Forum thread, please tell me where to post my request.

Thanks in advance.
---
Giacomo
Elettra Synchrotron Radiation Facility.
Trieste, Italy.


----------



## SirDice (Dec 2, 2016)

Have a look at limits(1).


----------



## jacum (Dec 20, 2016)

Hello SirDice. This kills the process and this is not what I want.


----------



## hukadan (Dec 20, 2016)

I do not know much about CGROUPS but it seems to me that rctl(8) is what you are looking for. It requires a custom kernel but it should not be a problem according to your post. As a side note, I use FreeBSD as a Desktop (not much as a programming platform) and I can compile ports(7) (including LibreOffice) without freezing my entire system (asking synth(1) - ports-mgmt/synth - to be nice(1)).


----------



## bvansomeren (Dec 20, 2016)

hukadan said:


> I do not know much about CGROUPS but it seems to me that rctl(8) is what you are looking for. It requires a custom kernel but it should not be a problem according to your post. As a side note, I use FreeBSD as a Desktop (not much as a programming platform) and I can compile ports(7) (including LibreOffice) without freezing my entire system (asking synth(1) - ports-mgmt/synth - to be nice(1)).



It's already part of the GENERIC kernel in fact (from the release notes for 11):

The GENERIC kernel configuration now includes RACCT and RCTL by default. [r282901] (Sponsored by The FreeBSD Foundation)


----------



## ShelLuser (Dec 20, 2016)

I would also like to point out that the FreeBSD handbook has a whole chapter dedicated to resource limits. Chapter 13, paragraph 13.


----------

