Home > Software engineering >  The concurrent execution of the program
The concurrent execution of the program

Time:10-03

If in a sequential function, network operation, has the I/O operations, or open and printers, etc., there has been no contact these tasks on the logic, but to write in a function, in the build after operation, the single operation process can be divided into three, concurrent execution?

CodePudding user response:

Look, your these operations are involved in IO, all IO operations generally provide both synchronous and asynchronous invocation mode,

Asynchronous mode is thought to be multi-threaded concurrent, there may be problems on the execution order,
Synchronously is sequentially, in a complete, will perform the next,

CodePudding user response:

Must tell you, not.

Hope that when the compiler can reach this level, we are no longer care about multithreading.

CodePudding user response:

refer to the original poster beautiful_face response:
if in a sequential function, network operation, has the I/O operations, or open and printers, etc., there has been no contact these tasks on the logic, but to write in a function, in the build after operation, the single operation process can be divided into three, concurrent execution?


Multi-threading function must be reentrant, that is to say, can't use of global and static variables, under the multithreading is each do not affect each other (your function need to determine some state variables to distinguish between operating)

In your description, unless you create multiple threads running, would not be broken up into multiple threads, will run in multithreaded way

CodePudding user response:

"Windows core programming"
  • Related