CPU-bound (computing-intensive) and I/O bound (I/O-intensive)

Source: Internet
Author: User
Tags high cpu usage

I/O bound indicates that the CPU performance of the system is much better than that of the hard disk/memory. In this case, the system is operating, and most of the situations are that the CPU is waiting for I/O (Hard Disk/memory) in this case, the CPU loading is not high.
CPU bound indicates that the system's hard disk/memory performance is much better than the CPU performance. In this case, most of the system's operations are in the CPU loading 100%, the CPU needs to read/write I/O (Hard Disk/memory), I/O can be completed in a short time, and the CPU still has many operations to process, the CPU loading is very high.

Computing-intensive (CPU-bound)
In multiple program systems, most of the time is the CPU bound used for computing, logical judgment, and other CPU actions. For example, a program that calculates the circumference rate to a decimal point of less than one thousand digits is executed.

Most of the time is used in the calculation of trigonometric functions and root numbers, which is a CPU bound program.
It is because the performance characteristic of most protocol codec implementations is CPU-bound, which is the same with I/O processor threads.

According to the above analysis, it can be considered that most programs are usually targeted at a specific performance metric.
It can be divided into two types: CPU bound and I/O bound.
CPU bound programs generally have high CPU usage. This may be because the task itself does not need to access the I/O device, or because the program is a multi-threaded implementation, thus shielding out the waiting time for I/O.
The I/O bound program generally achieves the performance limit, and the CPU usage is still low. This may be because the task itself requires a large number of I/O operations, and the pipeline is not doing well, not making full use of the processor capabilities

It may also be because the Data Locality is not very good, resulting in many page errors, resulting in a large amount of disk I/O overhead.
There are many possibilities. Let's take a look at the specific situation.
?
Speaking of how to determine whether it is a CPU bound or I/O bound, I usually use top to first look at the CPU usage when the performance limit is reached, and then use SAR, iostat, etc.
Obtain the statistical data of specific I/O operations or page errors. If more precise information is required, such as determining which code generates these overhead
Oprofile or vtune is used.
?
Generally, I/O bound programs include web server static page access, or database-based applications.
A large number of computing applications belong to the CPU bound.
?
Finally, what if the CPU bound program runs with the I/O bound program in a system?
It should be the CPU Bound Program's CPU usage will be very unfair close to 100%. Because the I/O bound program may block a time slice and give up the CPU. Therefore, the CPU Bound Program receives many scheduling opportunities and runs the CPU every time. Therefore, in such a system, I/O bound programs should be given a higher priority so that they can be scheduled more.

 

For Io-intensive programs, the program running in upper-layer languages is not that different.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.