也許這足以爲每個進程創建不同的用戶ID,然後通過「ulimit」限制它們。在Debian下bash的的ulimit的聯機幫助:
ulimit [-HSTabcdefilmnpqrstuvx [limit]]
提供超過可用的外殼和由它啓動的進程資源的控制,在允許這種控制系統。 -H和-S選項指定爲給定資源設置的硬限制或軟限制爲 。非root用戶一旦設置硬限制就不能增加;軟限制可以增加到硬限制的值。如果既不指定-H也不指定 ,則設置軟限制和硬限位。限制的值可以是爲資源指定的單位中的數字,也可以是硬,軟或無限的特殊值之一,分別代表當前硬限制,當前軟限制和無限制的 。如果省略限制,則會打印資源軟限制的當前值,除非給出-H選項爲 。當指定多個資源時,限制名稱和單位將打印在值的前面。其他選項解釋如下:
-a All current limits are reported
-b The maximum socket buffer size
-c The maximum size of core files created
-d The maximum size of a process's data segment
-e The maximum scheduling priority ("nice")
-f The maximum size of files written by the shell and its children
-i The maximum number of pending signals
-l The maximum size that may be locked into memory
-m The **maximum resident set size** (many systems do not honor this limit)
-n The maximum number of open file descriptors (most systems do not allow this value to be set)
-p The pipe size in 512-byte blocks (this may not be set)
-q The maximum number of bytes in POSIX message queues
-r The maximum real-time scheduling priority
-s The maximum stack size
-t The maximum amount of cpu time in seconds
-u The maximum number of processes available to a single user
-v The maximum amount of virtual memory available to the shell and, on some systems, to its children
-x The maximum number of file locks
-T The **maximum number of threads**
我認爲限制線程爲1你可以得到公平的CPU計算時間分佈。
限制也是最大的RSS。
與Docker一起使用看起來就像解決方案。 – 2014-07-17 10:43:04