LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 07-19-2005, 07:15 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
limit CPU consumption


How can I force a CPU consumption limit? Say per user.... or system-wide.... both if possible?
 
Old 07-19-2005, 08:24 PM   #2
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
You can limit the cpu time a process or user can use and the process priorities but you cannot limit a user to only use, say 50% of the available cpu cycles.

An easy way to set user limits is through pam_limits.so. The drawback is, that these limits are enforced on a per session basis, not system wide. So if you limit the cpu time to n minutes for a particular user this limit will be enforced on the current login session. If the user logs in m times he has m*n minutes cpu time available. Of course, you can also limit the number of simultanous logins through pam_limits. See /etc/security/limits.conf and man limits.conf.

If you need something more sophisticated you might need to turn on process accounting and write a script to automatically take action once certain limits are reached.
 
Old 07-19-2005, 08:29 PM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
mmmmmmmm.......... well.... I think it would be OK if I set the nice level to a reasonable value... say......... 19 . Could that be set by root so that users can't set it BELOW the value set by root?

Last edited by eantoranz; 07-19-2005 at 08:33 PM.
 
Old 07-19-2005, 08:32 PM   #4
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
Quote:
Originally posted by eantoranz
Could that be set by root so that users can't set it BELOW the value set by root?
Yes.

man renice and see my last post.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit Cpu Use Of Threads yakotey Programming 1 10-03-2005 09:12 AM
Limit the performance of CPU? LostIn Linux - Hardware 8 05-23-2005 07:32 PM
How can I limit the CPU usage of a PID? ideasman Linux - Software 1 04-01-2004 07:15 AM
what means cpu limit? joda Linux - General 0 01-15-2004 09:23 AM
Limit CPU on Certain Apps? GT_Onizuka Linux - Newbie 3 11-16-2003 02:05 PM


All times are GMT -5. The time now is 04:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration