One of the classic problems in multi-user operating systems is that, by default, the scheduler will treat all processes or threads equally. Priorities were in part introduced to provide some way of differentiating between tasks, but they do nothing to make sure there's a fair distribution of CPU time across all users. In other words, the scheduler assumes all users and their processes are equal and should be treated the same.
Unix and Linux based operating systems then began to introduce abstractions to group or pool threads together according to some user specified notion of task. There's usually some amount of granularity involved here, but to keep this short, we'll work with "projects".
In Solaris (and its open source derivatives), a project is used to group threads together and can be tied to user attributes and/or various resource management features (there are many). Here's one way of setting up a shared system so that all users get the same amount of CPU time.
Add a project for each user with projadd(1). The '-p 123' argument is a project id, I suggest just using the user id for that user. The name of the project "user.bob" must begin with "user." so the system will automatically assign that user's processes to this project.
Unix and Linux based operating systems then began to introduce abstractions to group or pool threads together according to some user specified notion of task. There's usually some amount of granularity involved here, but to keep this short, we'll work with "projects".
In Solaris (and its open source derivatives), a project is used to group threads together and can be tied to user attributes and/or various resource management features (there are many). Here's one way of setting up a shared system so that all users get the same amount of CPU time.
Add a project for each user with projadd(1). The '-p 123' argument is a project id, I suggest just using the user id for that user. The name of the project "user.bob" must begin with "user." so the system will automatically assign that user's processes to this project.
# projadd -p 123 -c "bobs project" -U bob -K "project.cpu-shares=(privileged,5,none)" user.bob
Which will look like the last line in /etc/project:
$ cat /etc/project
system:0::::
user.root:1::::
noproject:2::::
default:3::::
group.staff:10::::
user.bob:123:bobs project:bob::project.cpu-shares=(privileged,5,none)
The number of shares is not a percentage or an absolute value. It's a proportionate amount in relation to other users' shares: projects with more shares will get more than others. The values themselves are only significant when compared to other projects.Then make FSS the default scheduling class:
# dispadmin -D FSS
The per user projects will only start to be used for new user logins, so you'll need to ask your users to logout and back in. After that, you can monitor per project stats with 'prstat -J':$ prstat -J
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
422 root 0K 0K sleep 99 -20 15:40:29 0.6% zpool-build/85
518 root 10M 4384K sleep 29 0 1:51:33 0.0% automountd/8
1212 bob 12M 9156K cpu4 49 0 0:00:00 0.0% gcc/1
PROJID NPROC SWAP RSS MEMORY TIME CPU PROJECT
123 10 145M 76M 0.2% 0:00:04 1.2% user.bob
0 61 183M 163M 0.3% 20:25:34 0.6% system
3 274 1087M 1050M 2.1% 2:16:54 0.1% default
No comments:
Post a Comment