Compute-intensive and IO-intensive

May I ask why exactly what kind of business is computing-intensive and what kind of business is IO-intensive? Why do you say that PHP was originally designed for computer-intensive and node.js is for IO-intensive?



We can divide tasks into compute-intensive and IO-intensive.

Computation-intensive tasks are characterized by a large amount of computation and CPU resource consumption, such as calculating the pi ratio, decoding video in high-definition, etc., all of which depend on the computing power of the CPU. Although this kind of computing-intensive task can also be completed by multitasking, the more tasks, the more time spent in task switching, and the lower the efficiency of the CPU to perform tasks. The number of simultaneous tasks should be equal to the number of CPU cores.

Computation-intensive tasks mainly consume CPU resources, so the efficiency of the code is very important. Scripting languages ​​like Python are inefficient and completely unsuitable for computationally intensive tasks. For computationally intensive tasks, it is best to write in C.

IO-intensive , tasks involving network and disk IO are all IO-intensive tasks. This type of task is characterized by low CPU consumption and most of the time of the task is waiting for the IO operation to complete (because the speed of IO is much lower than CPU and memory speed). For IO-intensive tasks, the more tasks, the higher the CPU efficiency, but there is a limit. Most common tasks are IO-intensive tasks, such as web applications.

During the execution of IO-intensive tasks, 99% of the time is spent on IO, and very little time is spent on the CPU. Therefore, it is completely impossible to replace the extremely slow scripting language such as Python with the extremely fast C language. Improve operational efficiency. For IO-intensive tasks, the most suitable language is the language with the highest development efficiency (the least amount of code), the scripting language is the first choice, and the C language is the worst.



  • IO-intensive: It is an application with more IO, such as network transmission, database calls, etc. Most web applications are like this

  • Computational Intensive: As the name suggests, it is the type of application that requires a lot of CPU computing. Applications like cloud computing should fall into this category.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325624875&siteId=291194637