CPU usage restrictions for users?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers CPU usage restrictions for users?
# 1  
Old 08-04-2012
CPU usage restrictions for users?

I was wondering if there was a way to set resource usage per user. For example, if I use "grep -f <file1> <file2>" and the two files are very big it consumes a lot of resources. Onetime someone pinged me and asked what the hell I was doing and to kill it. Is there any way an SA can restrict usage so that no one consumes too many resources ? Maybe to divide resources evenly upon those actively logged in?
# 2  
Old 08-04-2012
what is output of uname -a
if linux, what distro?
# 3  
Old 08-05-2012
We use various distros - Linux, AIX, Solaris, and HP-UX. Uname -a does not list the distro (for Linux). It just identifies it as Linux.

Last edited by MaindotC; 08-05-2012 at 03:09 AM..
# 4  
Old 08-05-2012
Hi MaindotC,

You may try using the nice, renice and taskset commands.

Need some more help? - Try Man pages and search engines.

And, also we're there to help you Smilie

Br,
VB
# 5  
Old 08-05-2012
# 6  
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..
# 7  
Old 08-05-2012
bash man page excerpt:
Quote:
ulimit [-HSTabcdefilmnpqrstuvx [limit]]
Provides control over the resources available to the shell and to processes started by it, on systems that allow such control.
But: this would not limit the share or percentage of resources a user process will get during execution, but stop it from execution once it reaches the limits.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question