LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-10-2012, 04:36 PM   #1
indiajoe
Member
 
Registered: Jan 2009
Location: India
Distribution: Porteus atma
Posts: 84

Rep: Reputation: 21
Lightbulb Assigning a button for top or htop.


When some program chocks the CPU or memory to 100%, the keyboard too hangs.
I want to assign a button (like the lid close button or power button) for calling top or htop with nice -20 so that i can kill the application.
The script which keeps watch of this event has be running with -20 nice number.
Is this a good idea to implement? Any ideas?

-cheers
indiajoe
 
Old 03-10-2012, 04:50 PM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,470

Rep: Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538
Quote:
Originally Posted by indiajoe View Post
When some program chocks the CPU or memory to 100%, the keyboard too hangs.
I want to assign a button (like the lid close button or power button) for calling top or htop with nice -20 so that i can kill the application.
The script which keeps watch of this event has be running with -20 nice number.
Is this a good idea to implement? Any ideas?
Doesn't make alot of sense to me. If the keyboard hangs, then ANY key/button on your system will also be affected and hang. You could just use whatever your GUI manager (Gnome/KDE) keyboard settings to program a key to run whatever script you want, but again, if the keyboard hangs, that will ALSO hang, so you're right back where you started.
 
Old 03-11-2012, 03:26 AM   #3
indiajoe
Member
 
Registered: Jan 2009
Location: India
Distribution: Porteus atma
Posts: 84

Original Poster
Rep: Reputation: 21
I was thinking of situations when it is not completely hung. Mostly my system only gets extremely slow. So do you think that running a script which watches for a particular key stroke and run top with nice -20 will be as good as assigning it to any other button on my laptop?
(Many a times i have noticed that the power button starts shutdown even when my keyboard is responding very slow)
Thanking you,
indiajoe
 
Old 03-11-2012, 06:00 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,140
Blog Entries: 54

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
Linux is quite efficient in how it utilizes and shares available resources among processes. Instead of searching for a way to kill processes you should find out what is or are the bottlenecks and how to make those processes play nice (more RAM, review processor and disk energy-saving states, different type of scheduler, process niceness, ionice, running certain processes sequentially like cronjobs, etc, etc). Basic tools to gather resource statistics (aka SAR) are Atop, Dstat and collectl.
 
1 members found this post helpful.
  


Reply

Tags
button, kill


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
free, top and htop show different memory usage wulp Linux - General 2 07-13-2011 12:22 AM
Htop vs 'top' vs 'free' disparity schachwizard Ubuntu 2 09-22-2010 04:33 PM
Looking for direction with reagarding a top/htop like app energyAlchemist Programming 3 09-22-2009 08:39 PM
LXer: Htop, a tip-top ncurses interactive tool for system monitoring your desktop LXer Syndicated Linux News 0 03-26-2009 02:21 PM
Assigning 'double-click' to a specific mouse button theMonkeY Linux - Hardware 1 09-06-2004 07:11 AM


All times are GMT -5. The time now is 07:12 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