High kernel usage using sleep


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users High kernel usage using sleep
# 1  
Old 09-19-2005
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  
Old 09-19-2005
Sleeping processes do not cause kernel usage.
# 3  
Old 09-19-2005
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  
Old 09-19-2005
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  
Old 09-19-2005
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Usage of Sleep in UNIX

Hi Guys, In my script i need to sleep for some seconds till the previous command exeuction is successful #!/bin/bash cp test.txt /direct/sub_dir if ; then echo "file copied" else echo "file not copied" sleep 5 exit 1 fi i need to sleep for 5 seconds if the copy command... (7 Replies)
Discussion started by: Master_Mind
7 Replies

2. UNIX for Advanced & Expert Users

Identify cause of high resource usage

hello all, on linux servers sometimes any of these resources (cpu,memory,disk) get a spike when you are not in front of the server. the duration of these spikes might be 5 mins or even whole weekend. my question is there a good way of capturing the events that caused these issues ( cpu or... (5 Replies)
Discussion started by: coolatt
5 Replies

3. Shell Programming and Scripting

High cpu usage

I have created one script and i have added it into cron to run after 10 mins. However I have noted that whenever that script runs, It causes CPU utilization of server to increase about 10-20 % I have rechecked script and there is no way i can make changes, Script contain only 2-3 commands. So... (4 Replies)
Discussion started by: Nakul_sh
4 Replies

4. AIX

AIX memory usage always high

hi, I want to ask , my AIX 6.1 is always used about 97% memory. Is this normal ? or any command can free up memory like Linux ? thanks. (1 Reply)
Discussion started by: virusxx
1 Replies

5. UNIX for Advanced & Expert Users

Kernel usage is high

Hi all, I have a solaris box, and I would like to know if anyone has commands to check kernel usage's. Scenario: solaris box is having cpu 100 % issue. . I have used sar -u 10 5 it shows 35 % kernel usage. If you can guide with some docs that would be good.. waiting for... (1 Reply)
Discussion started by: SunSolars_admin
1 Replies

6. UNIX for Advanced & Expert Users

Memory usage shown is high

Hello all, I am facing a memory related issue on my linux that is CentOS 4.0. What I see as an output of top command, free command is that memory usage is almost 90% which is quite high without much load on the system. This is continuously showing 90% or so of memory usage with top or free... (2 Replies)
Discussion started by: radiatejava
2 Replies

7. Ubuntu

High System CPU Usage

I am running a Dell PE R815 with 4 x AMD 12 core CPUs with 128GB of RAM and a RAID 5 array of 6 SAS disks. This is an HPC application and is definitely CPU bound, however once I run 16 of these processes (thus pinning 16 cores) the work performed slows down dramatically, to maybe 5 or 10% of what... (2 Replies)
Discussion started by: mowmentous
2 Replies

8. UNIX for Advanced & Expert Users

Extremely high kernel CPU Usage (Solaris 10 SPARC)

I've got a domain running on a few boards of a 25k. I'm seeing very high kernel cpu usage in top and cant' quite explain it. System runs a large number of smallish Oracle 10g2 databases (30), used mainly for development. load average: 36.63, 36.68, 37.42 2489 processes: 2452 sleeping, 21... (0 Replies)
Discussion started by: utopiajoe
0 Replies

9. AIX

High memory usage in AIX 5.1

Hi, We have AIX 5.1 machine of RAM 8 GB and paging space is 8GB. we are getting high memory usage of almost 99%.Can anybody please help in this ? Partial vmstat o/p kthr memory ----- ----------- r b avm fre 2 1 278727 1143 There is no paging issue.Becoz in... (5 Replies)
Discussion started by: jayakumarrt
5 Replies

10. UNIX for Advanced & Expert Users

Sun: High kernel usage & very high load averages

Hi, I am seeing very high kernel usage and very high load averages on my system (Although we are not loading much data to our database). Here is the output of top...does anyone know what i should be looking at? Thanks, Lorraine last pid: 13144; load averages: 22.32, 19.81, 16.78 ... (4 Replies)
Discussion started by: lorrainenineill
4 Replies
Login or Register to Ask a Question