开发者

simultaneous 2 or more read/write to/from harddisk

it is said that there is only one spindle in hard disk which reads or writes data to/from hard disk, how is it possible to write or read 2 or more data's to/from hard disk SIMULTANEOUSLY. the operating system used is windows xp.EXAMPLE, i need to copy two different movies to hard disk from pen drive so i click both movies copy them from pen drive and am pasting them in a disk partition, copi开发者_如何学编程ng process of two movies to hard disk occurs simultaneously. how does this happen?


These operations aren't simultaneous at all, but the operating system manages both operations concurrently.

What happens is the file manager (say, windows explorer) tells the operating system to copy file from one location to another, once each for the two copy operations.

The operating system breaks this command across two parts of its own system, the "filesystem" and the "disk driver". The file system works out what blocks on what disk are associated with the particular files in question, and tells the disk driver to read or write to those blocks.

The disk driver builds up a queue of reads and writes and figures out the most efficient way to satisfy them. A desktop operating system will usually try to service those requests quickly, to make the system as responsive as possible, but a server operating system will queue up the block operations as long as possible so that it can handle them in an order that allows it to make the most efficient use of block ordering.

Once the disk driver decides to act on a block operation, it tells the disk to move it's head and read or write some data. The result of the action is then passed back to the filesystem, and ultimately to the user application.

The fact that the operations appear simultaneous is only an illusion of the multitasking facilities of the operating system. This is pretty easy discern since multiple file copies take a little longer than just one copy (or sometimes a LOT longer, if you're trying to do a bunch at the same time.)

of course, the OS is still able to move two separate drives simultaneously if they really are different disks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜