Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create devices in nonsequential order #15

Open
1RedOne opened this issue May 9, 2019 · 2 comments

Comments

Projects
None yet
1 participant
@1RedOne
Copy link
Owner

commented May 9, 2019

Let's look into creating the devices sequentially to be more obvious that it is working.

@1RedOne

This comment has been minimized.

Copy link
Owner Author

commented May 23, 2019

Here's how device numbers are chosen now. Imagine we create 200 devices, using 4 threads.

Thread 1 - Device001
Thread 2 - Device049
Thread 3 - Device100
Thread 4 - Device150

This is how the device names are completed now. We could instead create a ConcurrentQueue to handle this request. I'm not sure how much work it would required to replace our current structure of Parallel.ForEach with this approach.

Parallel.ForEach(DeviceList, new ParallelOptions { MaxDegreeOfParallelism = maxThreads}, device =>
{
Device ThisDevice = new Device() { Name = device, Status = "Starting...", ImageSource = "Images\\step01.png", ProcessProgress = 10 };
Devices.Add(ThisDevice);
int thisIndex = devices.IndexOf(ThisDevice);
RegisterClient(thisIndex);
progress.Report(0);

@1RedOne 1RedOne added this to the 2.2 milestone May 23, 2019

@1RedOne 1RedOne added the help wanted label May 23, 2019

@1RedOne

This comment has been minimized.

Copy link
Owner Author

commented May 24, 2019

I was actually distracted looking at that this morning and came up with some untested code. I think this will make the make the device names get created in pseudo-succession rather than uniformly distributed in the list. pic.twitter.com/Agwt5N5Eth

— Chris Muster (@mustercj) May 23, 2019
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.