简体   繁体   中英

Clarification on multithreaded/asynchronous/parallel programming

I have been reading many articles in the net on multithreaded/asynchronous/parallel programming and often I have come across a similar statement as below.

While a file is being written, the CPU will not be used even if in the meantime there are requests waiting to be processed. A general indication of these systems is a long response time with low CPU usage, even in stress conditions.

How is it that a CPU is not being used when a file is being written?

Hope my question is clear.

CPU正在等待硬件指示它已完成处理所请求的操作,您的处理器不会将文件写入硬盘,这是由IDE / SATA / RAID控制器处理的。

Basically when you 'write' on a file, you send information to the hard-drive (this bit use CPU) but then you need to wait that the information have been physically written to the disk. This waiting time doesn't use CPU but is significantly longer that the previous one. The same when you load, you spend 99% of the time waiting for the harddrive to fetch the information physically.

Because the CPU is waiting for a response from the disk. The disk is an independent unit, which is communicating with the CPU through a serial bus (or parallel bus for older disks). The technical difference between an internal and an external drive is actually mostly whether it's inside or outside the computer box.

A packet of data is sent to the disk to be written, and then the CPU can only wait until the disk has done it's job, and returns the status of the operation requested.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM