A brief history of concurrency

  • Resource utilization: In some cases, the program must wait for the completion of an external operation is performed, such as input or output operations and other operations, and the program can not perform any other operations while waiting. So, if you can run another program while waiting, it will undoubtedly improve resource utilization.
  • Equity: different users and resources for the program on the computer with the same use rights. An efficient mode of operation is fragmented (Tmie Slicing) passing through the coarse-grained time these programs and users to share computer resources, rather than a large column  brief history concurrently executed by a program from the beginning to the end, then start the next program.
  • Convenience: In general, in the calculation of multiple tasks, you should write multiple programs, each performing a task and communicate with each other when necessary, more than just write a program to calculate all tasks easier to implement.

No matter what time, as long as you modify variables may next be read by another thread, or if you will read the last variable is being written by another thread, you must be concerned with concurrency and take appropriate synchronization mode .

Guess you like

Origin www.cnblogs.com/wangziqiang123/p/11710810.html