The task is that I have a process that tabulates a function, make the imputation of this function in 2x, 4x, 8x processes, tell me how to implement these conditions.

  • Processes or all the same flows? - ArchDemon
  • If the process does not know how to "calculate" a function on a certain interval, but only as a whole is able - by no means. And what side it refers to the problem of creating multiple processes is completely unclear. - Vladimir Martyanov
  • ArchDemonn, process - KolyaOlya

1 answer 1

Since what you are asking is similar to a learning task, I will not give you a specific code, but I will just give general suggestions for how I would do it.

The simplest option is the division of work at the very beginning, in which the task “to tab a function” is divided into 2 (or 4, or 8) subtasks. You run a control process that divides a job into parts, starts workflows, and collects the result from them.

For example, if you need to tab a function on the [ a , b ] segment, you can divide the segment into 8 parts, and each part will represent a separate tab subtask. After that, you run 8 copies of the workflow, passing each of them a subtask as an input parameter (for example, via the command line).

You will need to think more about collecting results. For example, if all processes write to the output files (the path to which would also be nice to pass to the input), at the end you will need to collect all the results into one output file.

A more complicated option is communication of processes through one or another kind of IPC. For example, working 8 processes can write not to a file, but to an output stream, your control process will have to redirect the input-output streams of working processes, and collect the result from them.

An even more advanced option is the dynamic distribution of workload between workflows. To do this, you will need two-way communication with workflows. You start your workflows, and give them the task of tabulating a small part of the original segment. The process that finishes first gets the next task. Thus, no workflow will be idle.

  • You can link to useful documentation how to implement these actions? - KolyaOlya
  • @KolyaOlya: Well, there is no documentation that says how to implement such a system. That is, it is docs.microsoft.com/ru-ru/dotnet , the documentation for the entire system. Documentation talks about specific things, like how to create a process and how to pass arguments to it. - VladD