bash commands to change processor


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting bash commands to change processor
# 8  
Old 08-10-2012
Yea that might be the better way to do it. I guess I could write logic to check how busy a CPU is but that would be time consuming. I didn't know it doesn't try to run everything on the same core, but that's good knowledge.

---------- Post updated at 12:11 PM ---------- Previous update was at 12:01 PM ----------

By the way how do you tell the OS to run a block of commands under the same background process such that there are multiple instances of these command blocks running in parallel?

Last edited by stevensw; 08-10-2012 at 04:22 PM..
# 9  
Old 08-10-2012
Quote:
Originally Posted by stevensw
Yea that might be the better way to do it. I guess I could write logic to check how busy a CPU is but that would be time consuming. I didn't know it doesn't try to run everything on the same core, but that's good knowledge.
And what would prevent your CPU busy-checking script making your CPU's busy? And how long would you expect one process to keep running on one CPU before it has to wait for something else? Should it sit idle while that process has to wait, or should another process run on it in the meantime?

What you are trying to write is an operating system, but you happen to already have one Smilie

Unless you have a real good reason to want a process on a specific CPU, you probably don't need to do so.

There are good reasons, sometimes... Imagine you have two long-running, CPU intensive processes where the timing works out that, sometimes, they swap CPU's. A really intensive game on one processor perhaps, and Firefox in another. Switching processes from CPU to CPU wastes a bit of bandwidth sending cache bouncing around, causing both to lag. The OS, not being psychic, doesn't know they're destined to be long-running processes and may make less than ideal choices here. You, the user, know they're not quitting until you say so, so alter their CPU affinity masks to make sure they always execute on specific CPU's, reducing the lag.
Quote:
By the way how do you tell the OS to run a block of commands under the same background process such that there are multiple instances of these command blocks running in parallel?
I think you're confused on the definition of process -- if they're concurrent, and not threads, then by definition they're different processes -- so could you explain what you want in other terms?

Last edited by Corona688; 08-10-2012 at 05:54 PM..
# 10  
Old 08-10-2012
The forementioned for loop, how to get each iteration of executing command1 command2 commandN in parallel in the same process (since they must be executed sequentially) such that the operating system might run them on different CPUs and cores?
# 11  
Old 08-10-2012
Quote:
Originally Posted by stevensw
The forementioned for loop, how to get each iteration of executing command1 command2 commandN in parallel in the same process (since they must be executed sequentially) such that the operating system might run them on different CPUs and cores?
Ah, so command1 command2 command3 must be executed sequentially, but the different instances can go in parallel.

Code:
for X in 1 2 3 4 5
do
        ( command1 ; command2 ; command3 ) &
done

wait

Again, be careful not to exceed the number of CPU's you have.
This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to change pset.size value in processor set in Solaris zone?

Hi I have a pool name yuk-pool and its associated pset is yuk-pset. It has a min value is 20 and max value is 56. But size field has 48 value . This same pool is assign to 4 local zones. Whenever Cpu usage is high on one local zone it impact the cpu usage at other local zone as well during high... (1 Reply)
Discussion started by: sb200
1 Replies

2. Shell Programming and Scripting

Using commands within bash script

The purpose of enclosed script is to execute selected command and output success or failure in whiptail msgBox Works as expected when command returns zero to msgBox. I cannot figure out how to continue / automate my script when command expects reply to continue / terminate. I am doing it... (2 Replies)
Discussion started by: annacreek
2 Replies

3. Shell Programming and Scripting

How to run several bash commands put in bash command line?

How to run several bash commands put in bash command line without needing and requiring a script file. Because I'm actually a windows guy and new here so for illustration is sort of : $ bash "echo ${PATH} & echo have a nice day!" will do output, for example:... (4 Replies)
Discussion started by: abdulbadii
4 Replies

4. Shell Programming and Scripting

Regarding change in column numbers after some commands

Hi All, I was using some commands to: replace a column by a constant string character awk -v a=CA 'NF>1{ $3=a; print; } ' $line>$line"_1" to copy a column and paste it in another place awk '$5=$2" "$5' $line>$line"_2" to delete the extra columns awk '{for(i=1;i<=NF;i++)... (9 Replies)
Discussion started by: CAch
9 Replies

5. AIX

Change processor compatibility mode without hmc

Hello, One of my colleagues is working on a p730 without HMC, only one LPAR has all resources. The server is showing some issues with Informix (10.00 & 11.50), the same config (OS & IFX) works perfectly on Power6 so I would like to ask him to change the processor compatibility mode to power6 on... (3 Replies)
Discussion started by: fapl
3 Replies

6. Shell Programming and Scripting

Bash scripts as commands

Hello, the bulk of my work is run by scripts. An example is as such: #!/bin/bash awk '{print first line}' Input.in > Intermediate.ter awk '{print second line}' Input.in > Intermediate_2.ter command Intermediate.ter Intermediate_2.ter > Output.out It works the way I want it to, but it's not... (1 Reply)
Discussion started by: Leo_Boon
1 Replies

7. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

8. Shell Programming and Scripting

running commands from outside of bash

Hello all! I have two consoles.I know the PID of these two.Now I want to execute a command in console#1 but from console#2. How can I achieve this? Anyone can do something for my query? Click here if you can't understand my query or to know the need for this query. (3 Replies)
Discussion started by: rakabarp
3 Replies

9. AIX

LPAR processor/virtual processor settings

Question is on setting of Physical and Virtual processors for LPARs to make proper use of virtualization capabilities. Environment is a 8-way p570 with 4 LPARs. lparVIO1 and lparVIO2: AIX 5300-04-01 Mode/Type= Shared-SMT/Capped Minimum Processors= 0.10 Desired Processors= 0.50 Maximum... (1 Reply)
Discussion started by: guttew
1 Replies

10. Linux

Commands for OS patch, processor and disk partition

Hi All, Can anybody please help me with finding commands on LINUX for the following: processor: Availability PowerManagementSupported Description also for OS patch i need to know the following info: SeverityRating ServicePackInEffect for disk partition: Description BlockSize ... (1 Reply)
Discussion started by: Veenak15
1 Replies
Login or Register to Ask a Question