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:

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.