The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
High memory usage in AIX 5.1 jayakumarrt AIX 5 02-14-2008 07:17 PM
memory usage : kernel, oracle, other users thierryUX UNIX for Dummies Questions & Answers 4 09-18-2006 12:17 PM
Need to send email on HIGH Disk usage csaha Shell Programming and Scripting 1 05-07-2006 06:43 AM
Sun: High kernel usage & very high load averages lorrainenineill UNIX for Advanced & Expert Users 4 02-06-2006 12:32 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-19-2005
handak9 handak9 is offline
Registered User
  
 

Join Date: Jul 2004
Posts: 31
High kernel usage using sleep

Hi

I have a lot of scripts running on a Sun Solaris server, which are constantly running in a loop looking for work to do. When they have no work they sleep for a certain amount of time (60secs normally). I have 13 of these scripts running the number of sleep command issued can be in the order of 40,000 per hour.

This level of sleeping is causing higher than normal kernel usage.

Is there an alternative to sleep which will not cause so much kernel usage? Or can anyone suggest anything else.

Thanks,
  #2 (permalink)  
Old 09-19-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,124
Sleeping processes do not cause kernel usage.
  #3 (permalink)  
Old 09-19-2005
handak9 handak9 is offline
Registered User
  
 

Join Date: Jul 2004
Posts: 31
I have noticed that when the shell scripts are down then the kernel usuage returns back to normal.

Can you suggest anything in a script that would then? The scripts are doing usual things like sqlplus calls, writing/reading from files, ls, ps commands - nothing out of the ordinary. These scripts are running 24/7.
  #4 (permalink)  
Old 09-19-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,124
Kernel usage on behalf of a process means that the kernel is running a system call. The pause() system is only charged for kernel time while it is putting the process to sleep and once the signal arrives, it gets charged again until it returns. That is only a few microseconds. The 60 seconds that the process spends sleeping does not count as kernel time. If the processes are really being charged for kernel time, they must be invoking other system calls. sleep will be a separate process. So will ps, etc. The shell itself can't be using much kernel time.
  #5 (permalink)  
Old 09-19-2005
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683
Quote:
Originally Posted by handak9
I have noticed that when the shell scripts are down then the kernel usuage returns back to normal.

Can you suggest anything in a script that would then? The scripts are doing usual things like sqlplus calls, writing/reading from files, ls, ps commands - nothing out of the ordinary. These scripts are running 24/7.
sqlplus and sleeping 60 seconds (typically) is not out of the ordinary? How are you calling sqlplus? Most scripts that I see use something like this:
Code:
sqlplus us/pw <<EOF
   ...
EOF
Spawning sqlplus every 60 seconds with a login request takes time. You could try a sqlplus co-process and establish one connection for the life of your script.

Code:
sqlplus -s /nolog |&
print -p "connect un/pw"
Then you can use print -p and read -p to communicate to the resident sqlplus session.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0