Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have two disks on my local computer, so when you write to these disks simultaneously, are changes writting to them serially or in parallel?

share|improve this question

3 Answers 3

Are the disks mirrored? If so, then they are writing as close to simultaneously as makes no odds. If not, are they on the same controller? If so, they're probably writing sequentially (or possibly they're doing interleaved writes). If they're on different controllers, they could be writing either simultaneously or sequentially, depending on the profile of the write operations, and numerous other factors such how caching is configured on the system.

share|improve this answer

Yes, writes are asynchronous unless you specify the sync option for a block device in /etc/fstab.

Even block devices sharing the same system BUS are able to work asynchronously, as your SCSI/IDE controller supports driving more than one at a time.

share|improve this answer

I'll explain using an example. These numbers are not intended to be real, just a demonstration.

Assume that it takes 10 seconds to write one block of data (ignoring the size of that block) but it only takes 1 second to instruct the disk to write a block.

Also assume that in this simplistic example the CPU can only send commands to one disk at a time.

In the first second the CPU instructs disk 1 to write a block. In the second second disk 1 begins writing while the CPU instructs disk 2 to write a block. In the third second disk 2 begins writing.

In second 11 disk 1 will finish and in second 12 disk 2 will finish. So in this example the commands were sent serially but the write operations were conducted mostly (about 9 seconds worth) in parallel.

Pile on about a thousand layers of complexity and it gets close to what actually happens on your computer.

So in short, yes, the system will do its best to write in parallel.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.