Sponsored Content
Top Forums Shell Programming and Scripting Is there a way to make bash [or another shell] use all CPU cores to execute a single script? Post 302389918 by ph0enix on Tuesday 26th of January 2010 11:33:55 AM
Old 01-26-2010
Is there a way to make bash [or another shell] use all CPU cores to execute a single script?

I wrote a very simple script that matches combinations of alphabetic characters (1-5). I want to use it to test CPU speeds of different hardware/platforms. The problem is that on multi-core/processor systems, only one CPU is being utilized to execute the script. Is there a way to change that? Shouldn't the OS automatically start using the second, third, (etc..) CPU once the first one becomes overloaded?

The script:

Code:
#!/bin/bash
for a in {a..z}
do
 for b in {a..z}
 do
  for c in {a..z}
  do
        x="$a$b$c"
     done
    done
   done
echo $x
exit

Thank you! Smilie

J.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to execute sh script in bash shell via crontab

hello. we are porting over from HPUX Shell to Linux. my default shell is bash so i can no longer schedule to execute a sh script in crontab. can anyone pls help me out? I searched the site but didnt find any details. thanks! (1 Reply)
Discussion started by: jigarlakhani
1 Replies

2. Shell Programming and Scripting

Help with make sure shell script execute instruction in flow

Hi, I want to write a shell script to make sure all the instruction is executive in flow. eg. I want my shell script to run finish this two progress first: ./program input_file_1.txt > input_file_1.txt.out & ./program input_file_2.txt > input_file_2.txt.out & After then, only run the... (1 Reply)
Discussion started by: edge_diners
1 Replies

3. Red Hat

Lost CPU CORES

Hey all, dmidecode | grep -i CPU Socket Designation: CPU 0 Version: Intel(R) Xeon(R) CPU E5530 @ 2.40GHz Socket Designation: CPU 1 Version: Intel(R) Xeon(R) CPU E5530 @ 2.40GHz cat /proc/cpuinfo | grep -i cpu cpu family : 6... (24 Replies)
Discussion started by: rmokros
24 Replies

4. UNIX for Dummies Questions & Answers

how to run two unix/linux programs on two different cpu cores

Hi folks, I want to know how to run two unix programs on two different cpu cores on a 2-core or 4-core or 8-core CPU machine? Extending this how would i run four and eight unix programs on 4-core and 8-core machine respectively? If this can be done, how to know which program is assigned to... (1 Reply)
Discussion started by: kaaliakahn
1 Replies

5. Shell Programming and Scripting

How to make a bash or shell script run as daemon?

Say i have a simple example: root@server # cat /root/scripts/test.sh while sleep 5 do echo "how are u mate" >> /root/scripts/test.log done root@server # Instead of using rc.local to start or another script to check status, I would like make it as daemon, where i can do the following: ... (2 Replies)
Discussion started by: timmywong
2 Replies

6. Solaris

CPU/processor/cores in M4000

Hi Gurus Can someone help me in explaining the below outputs . psrinfo -p 4 /usr/sbin/psrinfo -pv The physical processor has 4 virtual processors (0-3) SPARC64-VI (portid 1024 impl 0x6 ver 0x93 clock 2150 MHz) The physical processor has 4 virtual processors (8-11) SPARC64-VI... (3 Replies)
Discussion started by: ningy
3 Replies

7. Solaris

Numbers-of-cpu-cores-in-Solaris-10

Hello All, How do I find the number of CPU's, virtual processors in solaris 10? Thank you Sunil Kumar (2 Replies)
Discussion started by: msgforsunil
2 Replies

8. Red Hat

CPU and Cores information

Hi all. I have a question about linux command to find number of CPU and Core. I usually use the command dmidecode -t processor to find cpu and core numbers . On this machine with Red Hat 4. 0 when I try to insert the command is returned the error -bash: dmidecode: command not found I try to... (8 Replies)
Discussion started by: piccolinomax
8 Replies

9. Solaris

Questions regarding CPU cores vs rctl limit

Hi, I am trying to gather cpu core details and used this script - Solaris & Scripting: Script - Find cpu - model / type / count / core / thread / speed - Solaris Sparc For auuditing purpose, we want to know how many cores are being used by Oracle, because oracle license will be charged on... (2 Replies)
Discussion started by: solaris_1977
2 Replies
intrbald(1M)															      intrbald(1M)

NAME
intrbald - daemon for balancing interrupts SYNOPSIS
interval | DESCRIPTION
Balancing interrupts is a process which distributes interrupts across the available CPUs in an optimal fashion. This action is performed by (see intctl(1M)). Performing frequent CPU migrations between system partitions may require you to perform periodic balancing of interrupts. This is espe- cially true with systems that use WLM (Workload Manager), iCAP (Instant Capacity), and vPars (Virtual Partitions) products. If the fre- quency of CPU migration is high, then balancing of interrupts should be performed more frequently. The daemon monitors the system for imbalance in interrupt distribution. If an imbalance is detected after the specified interval executes to balance the interrupt distribution. uses the parameters from the configuration file for balancing the interrupts. For more information about the command, see intctl(1M) and the configuration file. The daemon is started from the general purpose sequencer script (see rc(1M)), at run level 2 and is killed at run level 1. By default, the daemon is not enabled. The daemon configuration file must be edited and the parameter set to in order to enable running the daemon. After setting to for the first time, you can start the daemon manually by executing the script Otherwise, the daemon will automatically start the next time the system is restarted. Any actions performed by the daemon are logged in and details of interrupt migrations performed will be logged in the file Options recognizes the following options: Instructs the running daemon to reexamine the configuration file If the parameter has been updated, then the running daemon uses the new value. If the parameter is set to then the running daemon stops executing. The daemon checks if the system requires any balancing of interrupts after interval seconds; the valid range is 5 seconds to seconds (see limits(5)). This value can also be specified persistently in the configuration file by setting the parameter. The default value is 60 seconds. Setting this value too small can cause unnecessary interrupt migrations. Gracefully kills the running daemon. intrbald rc Configuration File is the configuration file. The following parameters can be persistently specified in this configuration file: Specifies if the daemon should be started automatically during the system bootup process by the script. The daemon will only be started automatically if this parameter is set to NOTE: This value is by default. Before using the daemon, needs to be changed to in the file. Then the daemon needs to be started, either manually by running or it will be started automatically at next boot via the script. The daemon checks if the system requires any interrupt balancing after this interval. The interval is specified in seconds; the valid range is 5 seconds to seconds (see lim- its(5)). The default is 60 seconds. Setting this value too small could cause unnecessary interrupt migrations. RETURN VALUE
Exit values are: Successful completion. An error condition occurred. WARNINGS
The command can be executed only by the superuser. This command should be used only by performance analysts for performance tuning pur- poses. If the interrupts are not redistributed properly, a possible decrease in overall system performance can occur. Some processors can become overloaded while other processors will not be optimally utilized. FILES
configuration file. See the section above. script. start symbolic link. kill symbolic link. daemon log file. SEE ALSO
intctl(1M), ioscan(1M), rc(1M), limits(5). intrbald(1M)
All times are GMT -4. The time now is 12:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy