0

Hello:

I hope that someone can help me; and it's probably so simple, I'm missing it. I want to specify a number of CPUs, and loop through them, forcing a program to run in each. Let me try to explain. Let me way that I have 12 CPUS (this is true, it's a main frame). And I want to equally run the programs in each 6 of the CPUs (say 4-9). So it I have 18 programs, and I want to run 3 in each of the above cpus (4-9). How can I loop through these CPUS several times in CODE and assign the programs to each CPU?

PROGRAM/CPU
1/4
2/5
3/6
4/7
5/8
6/9
7/4
8/5
9/6
10/7
11/8
12/9
13/4
14/5
15/6
16/7
17/8
18/9

Like I said, that it's probably do simple that I'm missing it. The problem is that once I it (in this example), CPU 9, I need to reset the CPU number back to 4, and start all over again. The code to spawn the programs isn't the issue, it's just the looping. I've been working on this for awhile, and I'm tired. With my luck, I will come too me in the morning. But I wanted to ask for help.:mrgreen: :mrgreen:

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by John A
0

Get your user input first. Number of CPUs, and which range.

First loop goes through the programs. If there's 18 programs, it goes for 18 iterations.

Second loop's iterator variable starts and the starting range variable that you inputted eariler, and goes to the end of the range of CPUs. Inside this loop, you can reference program/cpu by using the first loop's iterator variable / this loop's iterator.

Hope this helps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.