Can hard disks read and write simultaneously on different tracks? How?

6

5

Is it possible that one read-write head can do both copy and paste at the same time even on different tracks? How does that happen?

NullPoiиteя

Posted 2011-12-08T07:42:20.093

Reputation: 191

2If you mean "why is moving a large file from one directory to another on the same volume so much faster than moving it to a different partition?" then the answer is because only the file's entry in the file table is altered rather than physically moving the file. – Andrew Lambert – 2011-12-08T08:21:16.463

Nope. Except that there have been, at times in computer history, disk drives with more than one head, and sometimes more than one arm. – Daniel R Hicks – 2011-12-08T12:28:56.463

Answers

14

I/O requests are put in a queue, and handled one by one.

There are various disk scheduling algorithms, picking the best one improves the time required to handle all the requests that are in the queue. A disk scheduling algorithm in general orders this queue in an attempt to more efficiently handle the request such that the head has to move less, the FIFO aka FCFS algorithm is an exception to this as it just reads the queue...

Given that the seek time (the time to go to a location) is smaller if the head has to move less fast, multiple requests are handled fairly fast using the right disk scheduling algorithm. This is why it looks like if it was read/written very fast, but not in any case simultaneous... :)

I'll list the most popular disk scheduling algorithms, more can be found at Wikipedia.

Note: Files are usually fragmented, so to read one file multiple requests are put in the queue.

Note 2: If you mean "why is moving a large file from one directory to another on the same volume so much faster than moving it to a different partition?" then the answer is because only the file's entry in the file table is altered rather than physically moving the file. — Comment by Amazed

FIFO aka FCFS: First-In First-Out aka First Come First Served

All requests are taken from the start of the queue without reordering them.

SSTF: Shortest Seek Time First.

The request that takes the least move of the head is taken from the queue.

Note how the head has to move less, it stays still for the first three images.

SCAN: Like an elevator.

This always take the furthest away, then handling stuff it passes along the way.

In this picture it starts at track 2 and plans to go to track 4; so, it tries everything at track 2, then track 3 (nothing), then track 4, after which it goes to the furthest request which is track 1; so, it goes back and tries track 4, track 3 (nothing), track 2 (nothing) and then track 1.

Images: University of Wisconsin-Madison - CS 537 - Disk Scheduling (Originally might be by a book)

Tamara Wijsman

Posted 2011-12-08T07:42:20.093

Reputation: 54 163

Thanks. So SATA protocols like AHCI aren't really parallel? – Stas – 2018-12-23T15:35:05.767

4

One step at a time.

  1. Set k to 0.
  2. Read from x+k.
  3. Write to y+k.
  4. Increment k by 1.
  5. If not done, go to 2.

Ignacio Vazquez-Abrams

Posted 2011-12-08T07:42:20.093

Reputation: 100 516

What is k, x and y? That numbered list is meaningless now... – Tamara Wijsman – 2011-12-08T11:45:21.023

1@Tom: This whole question is meaningless. I can't for the life of me understand how someone can't visualize moving stones from one pile to another one stone at a time. – Ignacio Vazquez-Abrams – 2011-12-08T12:29:09.487

The problem with that metaphor is that you can also move them all at the same time. The question might be stated in a bad way, but you can't expect much more from a layman... – Tamara Wijsman – 2011-12-08T13:11:42.160

4

How is it possible that one read-write head can do both copy and paste at the same time even on different tracks?

It isn't possible.

Firstly read-write heads do not perform "copy" or "paste" operations. Those are much higher level concepts that apply in file-management applications such as Windows Explorer.

The application and the operating system progressively break the copy and paste operation down into multiple smaller and smaller operations. Eventually the disk controller asks the disk to read some sectors. Later it asks the disks to write some data to certain other sectors. During and between these operations the actual disk-heads may also be performing lots of other unrelated operations and seeking back and forth across the physical columns or tracks. Optimisations are carried out at many levels in this process to maximise the amount of useful work that can be carried out by the disk every microsecond and to maximise the number of processes whose IO-operations can be progressed, according to their established priorities.

RedGrittyBrick

Posted 2011-12-08T07:42:20.093

Reputation: 70 632

i got it sir,its about cpu scheduling – NullPoiиteя – 2012-04-19T09:56:43.663