Interleaving on floppy format (still) useful?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
johank
Posts: 7
Joined: Sun Dec 20, 2009 5:25 pm

Interleaving on floppy format (still) useful?

Post by johank »

Hi all,

Is interleaving while formatting floppies (i.e., instead of having sector IDs that are physically ordered 1,2,3,...,18 have them in an other order like 1,10,2,11,3,...,9,18 to decrease the amount of time the floppy has to wait for the next sector to appear) still useful on nowadays systems? If so, can anyone suggest a typical order for a typical 3,5 floppy?

thanks!

Johan
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Interleaving on floppy format (still) useful?

Post by Solar »

I wouldn't bother. I don't think anyone will still have a 3,5" floppy around by the time your OS reaches version 1.0. 8)

(Actually, I think writing a floppy driver at all is a waste of time.)
Every good solution is obvious once you've found it.
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: Interleaving on floppy format (still) useful?

Post by rdos »

Solar wrote:I wouldn't bother. I don't think anyone will still have a 3,5" floppy around by the time your OS reaches version 1.0. 8)

(Actually, I think writing a floppy driver at all is a waste of time.)
When I was at version 1.0 (currently version 9.2.1), the 3.5'' floppy did not even exist. :mrgreen:

As for writing floppy drivers today, I agree it probably is not the first thing one needs to do, since few machines have the controller required, and the ability to actually attach a drive.
johank
Posts: 7
Joined: Sun Dec 20, 2009 5:25 pm

Re: Interleaving on floppy format (still) useful?

Post by johank »

Thanks for your comments; actually, the floppy driver is ready and working (assumes a single 3.5" floppy), but I did not implement interleaving and I was just wondering.

I don't want to argue about whether a floppy driver is relevant; it's just that I'd like to test my OS on different machines while developing and then it makes sense to boot it from a floppy. All MY machines still have a floppy drive ;-)
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Interleaving on floppy format (still) useful?

Post by Chandra »

johank wrote:I don't want to argue about whether a floppy driver is relevant;
It doesn't hurt to have a floppy driver implemented. I already have one and I take it as a bonus.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
CrypticalCode0
Member
Member
Posts: 81
Joined: Wed Nov 09, 2011 2:21 am
Location: Behind a keyboard located in The Netherlands

Re: Interleaving on floppy format (still) useful?

Post by CrypticalCode0 »

IMHO it still is a fun thing to have as long if you don't make it a hardware prerequisite for running your OS.

As for interleaving the floppy drive the platter of the disk rotate's about 150 to 300 RPM depending on if it's a DD or HD drive.

I know this because i have machines who are stuck with the DD drive. :(

for a floppy drive it is still benefits from interleaving when reading back however do you really want to spend time on this?
johank
Posts: 7
Joined: Sun Dec 20, 2009 5:25 pm

Re: Interleaving on floppy format (still) useful?

Post by johank »

Hi CrypticalCode0,
for a floppy drive it is still benefits from interleaving when reading back however do you really want to spend time on this?
Well, not really if it involves computing gaps. If there is a good rule of thumb (like 1,10,2,11,3,...,9,18 or any other reasonable fixed order) that would be great. If there isn't, I'll stick with 1,2,...,17,18.

best
Johan
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Interleaving on floppy format (still) useful?

Post by Combuster »

The idea of interleaving is that if you read a sector, you can start the next read close to where the head physically is. Since the surface is spinning continuously, there used to be some time between completing the read and requesting the next one, which often meant that the head already entered the next sector and would need an entire rotation before the next read.

The idea is that the 1,10,2,11 order requires two complete track rotations on practically any hardware while sequential requires either one or 18 rotations depending on the combination of hardware and software. I have not benchmarked anything myself, but that would be the only right thing to do if you want to make sure.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Interleaving on floppy format (still) useful?

Post by Brendan »

Hi,

For standard 1440 KiB (3.5 inch) floppies with a rotational speed of 360 RPM it takes 166.66 ms for one rotation; and you could (incorrectly) estimate that it takes 9.25 ms to go from the start of one sector to the start of the next. This is incorrect though, as it assumes the gap between sectors is equal, and typically the gap isn't - normally there's 18 sectors closer together, then a larger gap between the last sector and the first. If you assume 9 ms from the start of one sector to the start of the next, then:

For no delay between reading sectors (e.g. reading an entire track), no interleaving at all would be fastest.

For up to 9 ms delay between reading sectors an "interleave by 2" pattern would be fastest. This is "1, 10, 2, 11, 3, 12, 4, 13, 5, 14, 6, 15, 7, 16, 8, 17, 9, 18".

For between 9 ms and 18 ms delay between reading sectors an "interleave by 3" pattern would be fastest. This is "1, 7, 13, 2, 8, 14, 3, 9, 15, 4, 10, 16, 5, 11, 17, 6, 12, 18".

For between 18 ms and 27 ms delay between reading sectors an "interleave by 4" pattern would be fastest. This is "1, 6, 10, 15, 2, 7, 11, 16, 3, 8, 12, 17, 4, 9, 13, 18, 5, 14".

However; because floppies are slow you want to cache sectors. Because the data is small (e.g. one cylinder is only 18 KiB) and because shifting the heads is expensive ("step rate time * steps + head settle time"), it makes sense to cache entire cylinders (so you never need to shift the heads back to a previously accessed track for reads). In this case, you'd always read entire tracks in a single "read 18 sectors" operation; and you'd never want interleaving.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Interleaving on floppy format (still) useful?

Post by Brynet-Inc »

Hmm, time to show off my blazing fast LS-120 drive.

Code: Select all

$ dmesg | grep sd0
sd0 at scsibus0 targ 0 lun 0: <MATSHITA, LS-120 VER5 00, F527> ATAPI 0/direct removable
..
$ dd if=/dev/rsd0c of=/dev/null bs=64k
22+1 records in
22+1 records out
1474560 bytes transferred in 13.305 secs (110827 bytes/sec)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Post Reply