Re: send/expect in a loop causes CPU to choke



In article <1175667025.037991.149650@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Sharad <sharad1087@xxxxxxxxx> wrote:
Hi

I had a simple send/expect script that shoots up the CPU usage to 100%
on Unix server.

The script looks like this:
While {1} {
expect {
a {
.
exp_continue
}
b {
.
exp_continue
}
}
}

I understand that while loop could have been avoided but somehow the
user wrote the script like this. Somebody pointed out that using send/
expect in a while loop is causing this behavior (excess CPU
utilization) but I'm not sure about the logic behind this.

Expert advice needed.
.
.
.
What's the question?

Someone else wrote this. You're already aware that it's not
recommended style. You want ... well, what is it that you
want? I suspect you're trying to ask for the same behavior,
but with a lower CPU load, but I don't understand what
behavior (written by a third person) you're trying to preserve.

My summary advice: don't do that; decide what you do want to
do.
.



Relevant Pages

  • Re[2]: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?
    ... RF> script first starts up, the CPU rarely exceeds 30%, even when many ... And it stays high until I stop the script and restart it. ... loop as there are a few thousand rows. ... One way to solve the memory issue is to have the script started by ...
    (php.general)
  • next command started before previously called script is finished
    ... The main script contains two nested for loops and each time a function do_build ... cpu family: 6 ... cpuid level: 10 ...
    (Linux-Kernel)
  • Re: DBI Performance Issues
    ... use the cpu or the network hardware during remote tests. ... first the live script is run from a sun solaris machine using ... server machine. ...
    (comp.lang.perl.misc)
  • Re: Thermal Monitor & automatic shutdown on over temperature event
    ... My reading has led me to believe that the kernel can do at least the CPU ... > I wrote this small script using sensors to detect and warn high temps. ... I run the script with nohup. ... > echo temp OK: $TEMP ...
    (Debian-User)
  • Re: Got idle CPU cycles?
    ... Your CPU cycles could help ... We can easily script 8-hour overnight runs. ... Most people who would donate CPU time don't want you ssh-ing into ... their compilers to discover whether or not they have the neccessary ...
    (comp.os.linux.misc)