Sponsored Content
Top Forums UNIX for Dummies Questions & Answers CPU usage restrictions for users? Post 302682001 by bakunin on Sunday 5th of August 2012 07:05:26 AM
Old 08-05-2012
There is no genuine way of restricting processor resources on a per-user basis, just on a per-process basis. Per process you can use "nice"/"renice", but this is not limiting the resources in an absolute way either, just in relation to all the other processes.

If you are looking for a "of the 5 available processors this process is only entitled to use 1"-solution: such a thing doesn't exist, at least not in general. In AIX there is the bindprocessor command (look at the man page of this command and search for "processor affinity AIX" in your favourite search engine to find out more), which comes close to this, i don't know if other OSes have a similar mechanism.

nice manipulates a process' priority (to be precise: it manipulates the way the kernel assigns a priority to said process): lets assume we have only one processor and several processes competing for its use. The Unix kernel would let the first process have the the processor for some time, then stop it, assign the processor for the same time to the next process, etc., until all the processes had their turn, then start over with the first one again. As this happens in rapid succession it looks like all the processes run simultaneously, but in fact they do not.

With priority entering the picture not all the processes will be given equal time any more. A process with high priority will get the processor for a longer time then a process with lower priority, so that a high-priority-process seems to run faster than a low-priority process.

Still, as long as all the processes' CPU demands can be satisfied every process gets as much as it wants, regardless how much that is. Even the lowest priority process can get 99% CPU as long as no other process demands it.

You might want to read the man pages for nice and renice to learn more about "process scheduling" and "process priority" (use these as starting points for web research) in the Unix kernel.

For limitations on a per-user basis there is "ulimit", but this does not limit processor use, only file size and memory usage. You may want to read the man page for ulimit too to see what you can do with it. Notice there are "hard" and "soft" limits. Basically, hard limits are imposed by the root user and the user cannot change them. Soft limits are also imposed by the root user, but can be changed by the user himself until reaching the hard limit, which is the absolute upper limit the user (and his processes) can use. Usually there is a hard limit somewhat higher than the soft limit and the difference serves as contingency for especially demanding situations. Users should be able to do their usual work within the soft limits and if they can't these values need rework.

I hope this helps.

bakunin

Last edited by bakunin; 08-05-2012 at 08:12 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies

2. UNIX for Dummies Questions & Answers

Setting password restrictions for all users

I would like to change the password requirements for all our AIX 5.2 logins but am having trouble finding a place where I can set the rules for everyone at the same time. I know I can go user by user in smit passwords but is there a way to create rules for everyone at the same time? Thanks,... (2 Replies)
Discussion started by: drathbone
2 Replies

3. Programming

CPU usage and memory usage

Please tell me solaris functions/api for getting following information 1- Function that tells how much memory used by current process 2- Function that tells how much memory used by all running processes 3- Function that tells how much CPU is used by current process 4- Function that tells how... (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

4. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

5. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

6. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

7. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

8. AIX

balance CPU usage between users

Hi! Is there any way to balance CPU usage between users on percentage basis? Something like Resource Manager in Oracle databases. Regards. ---------- Post updated at 02:17 PM ---------- Previous update was at 02:09 PM ---------- Workload Manager? ---------- Post updated at 03:44 PM... (0 Replies)
Discussion started by: bas_ua
0 Replies

9. Shell Programming and Scripting

Admin user command usage restrictions

Hi, I need to work on restricting the Linux commands to the ADMIN user to some extent. It means for example, Admin users should not use passwd command to change the password of "root" or other important accounts like oracle, etc., So, I want to know which commands should be restricted upto which... (5 Replies)
Discussion started by: Dpu
5 Replies

10. AIX

High CPU Usage , users affected

Dear All, One production Server is affected by high usage. Application is slow now. Please guide me how to solve it? NMON Report shows full cpu usage. Here im posting some server details. bash-3.2# lparstat -i Node Name : ********* Partition Name ... (6 Replies)
Discussion started by: Thala
6 Replies
renice(8)						      System Manager's Manual							 renice(8)

Name
       renice - alter priority of running processes

Syntax
       /etc/renice priority [ [ -p ] pid ... ] [ [ -g ] pgrp ... ] [ [ -u ] user ... ]

Description
       The  command  alters the scheduling priority of one or more running processes.  The who parameters are interpreted as process ID's, process
       group ID's, or user names.  Using on a process group causes all processes in the process group to have their scheduling	priority  altered.
       Using on a user causes all processes owned by the user to have their scheduling priority altered.  By default, the processes to be affected
       are specified by their process ID's.

Options
       To force who parameters to be interpreted as process group ID's, a may be specified.  To force the who parameters to be interpreted as user
       names, a may be given.  Supplying will reset who interpretation to be (the default) process ID's.

       Users  other than the superuser may only alter the priority of processes they own, and can only monotonically increase their ``nice value''
       within the range 0 to PRIO_MIN (20).  (This prevents overriding administrative fiats.)  The superuser can alter the priority of any process
       and set the priority to any value in the range PRIO_MAX (-20) to PRIO_MIN.  Useful priorities are: 19 (the affected processes will run only
       when nothing else in the system wants to), 0 (the ``base'' scheduling priority), anything negative (to make things go very fast).

Examples
       The following command changes the priority of process ID's 987 and 32, and all processes owned by users daemon and root:
       /etc/renice +1 987 -u daemon root -p 32

Restrictions
       If you make the priority very negative, then the process cannot be interrupted.	To regain control you make the priority greater than zero.
       Non-superusers  cannot  increase  scheduling priorities of their own processes, even if they were the ones that decreased the priorities in
       the first place.

Files
       Maps user names to user IDs

See Also
       getpriority(2), setpriority(2)

																	 renice(8)
All times are GMT -4. The time now is 09:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy