CHS, LBA, performance (was: ELF Bootloader)

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: ELF Bootloader

Post by bluemoon »

SparrowOS wrote:Modern hard drives use CHS internally
Learn to read please. whether the hardware use CHS representation internally is open to implementation, but sure such CHS geometry, if any, is different to BIOS's CHS which is limited to 2GB.
Furthermore, for SSD driver the CHS geometry make no sense at all.
SparrowOS wrote:otherwise how would they access cylinder, head, sector?
Now you are asking question. I'll leave this for the expert.

By the way, we have enough trolling and off-topic, and I believe the original poster got his answer, and been pointed to related reference materials, I hereby request a lock.
If you are interest in how hard-disk work you should open up a new thread.
rdos
Member
Member
Posts: 3271
Joined: Wed Oct 01, 2008 1:55 pm

Re: ELF Bootloader

Post by rdos »

SparrowOS wrote:
Combuster wrote:
SparrowOS wrote:And CHS is faster still! because... the drive doesn't have to do the math.
Proof wanted.
I was mocking him. :-) Why would 28-bit be faster than 48-bit?
Because it needs fewer IO-instructions. IOW, it assumes the driver uses PIO-mode. For DMA-mode, there would be little if no difference.
User avatar
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

Re: ELF Bootloader

Post by SparrowOS »

rdos wrote:
SparrowOS wrote:
Combuster wrote:Proof wanted.
I was mocking him. :-) Why would 28-bit be faster than 48-bit?
Because it needs fewer IO-instructions. IOW, it assumes the driver uses PIO-mode. For DMA-mode, there would be little if no difference.
CHS is faster still becauase the hard drive gets to work faster because it does not have to convert it.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: ELF Bootloader

Post by bluemoon »

This is so extreme that I request a quadruple facepalm... :twisted:
User avatar
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

Re: ELF Bootloader

Post by SparrowOS »

1 I/O is roughly 1uS

Doing PIO
For 28LBA it's about 5 to set-up
For 48LBA is's about 9 to set-up
Seek time is what? 1000uS?
One block is 512/4 = 128 to transfer
You can do multiple blocks, too.
rdos
Member
Member
Posts: 3271
Joined: Wed Oct 01, 2008 1:55 pm

Re: ELF Bootloader

Post by rdos »

SparrowOS wrote:1 I/O is roughly 1uS

Doing PIO
For 28LBA it's about 5 to set-up
For 48LBA is's about 9 to set-up
Seek time is what? 1000uS?
One block is 512/4 = 128 to transfer
You can do multiple blocks, too.
Seek time is zero for a compact flash. :mrgreen:
User avatar
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

Re: ELF Bootloader

Post by SparrowOS »

rdos wrote:
SparrowOS wrote:1 I/O is roughly 1uS

Doing PIO
For 28LBA it's about 5 to set-up
For 48LBA is's about 9 to set-up
Seek time is what? 1000uS?
One block is 512/4 = 128 to transfer
You can do multiple blocks, too.
Seek time is zero for a compact flash. :mrgreen:

I'll bet it uses 48-bit LBA because it's new.

I'm not sure you can use 28 on a 48 bit device.
rdos
Member
Member
Posts: 3271
Joined: Wed Oct 01, 2008 1:55 pm

Re: ELF Bootloader

Post by rdos »

SparrowOS wrote:
rdos wrote:
SparrowOS wrote:1 I/O is roughly 1uS

Doing PIO
For 28LBA it's about 5 to set-up
For 48LBA is's about 9 to set-up
Seek time is what? 1000uS?
One block is 512/4 = 128 to transfer
You can do multiple blocks, too.
Seek time is zero for a compact flash. :mrgreen:

I'll bet it uses 48-bit LBA because it's new.
If I remember it correctly, every disk must support 24-bit LBA (if it isn't very old and only supports CHS), while support for 48-bit LBA is optional. Thus, an operating system could decide to skip the 48-bit interface and use the 24-bit interface if the disk is smaller than a certain limit (8G).
User avatar
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

CHS, LBA, performance (was: ELF Bootloader)

Post by SparrowOS »

A typical drive is 1TB and you can save 5 uS if the access is to a block under 130Gig. I don't bother. When doing a compiler, you encounter the same thing and I often do bother.
User avatar
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

CHS, LBA, performance (was: ELF Bootloader)

Post by SparrowOS »

Tell me you code does this optimization and is not just old.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: CHS, LBA, performance (was: ELF Bootloader)

Post by Brendan »

Hi,

There are:
  • disks smaller than 528 MB
  • disks smaller than 8 GB that don't support LBA
  • disks smaller than 8 GB that do support LBA
  • disks larger than 8 GB
  • things that aren't hard drives (CD/DVD and SSD)
There are also 3 cases:
  • Software using the BIOS (e.g. an OSs boot code), where the BIOS doesn't support "int 0x13 extensions"
  • Software using the BIOS (e.g. an OSs boot code), where the BIOS does supports "int 0x13 extensions"
  • Software that doesn't use the BIOS (e.g. an OS's native driver)
5 possibilities multiplied by 3 possibilities = 15 permutations.

Now here's the important part: NONE OF YOU PEOPLE ARE SAYING WHICH CASES YOU'RE TALKING ABOUT.

Most of the statements made in this topic are true for some cases and false for other cases; and are therefore false when no specific case/s are specified.


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
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

Re: CHS, LBA, performance (was: ELF Bootloader)

Post by SparrowOS »

http://en.wikipedia.org/wiki/Logical_block_addressing

28-bit LBA and 48-bit LBA.

It happens at 130GB
User avatar
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

Re: CHS, LBA, performance (was: ELF Bootloader)

Post by SparrowOS »

You're right - not relevant for boot-loaders.

Int 13h 42 has a 64-bit block number



2^(28+9)=130GB
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: CHS, LBA, performance (was: ELF Bootloader)

Post by thepowersgang »

I'm going to interject here (and possibly feed the troll) with what I am lead to believe is true about modern hard disks.

All modern disks internally (within the on-disk controller) use LBA, and perform remapping of known bad sectors automatically. They then provide almost completely false CHS dimensions to the BIOS so that legacy software can still access at least some of the disk. (Another thing to note is that any high-density disk doe not have the same number of sectors on every track, as the outer tracks are far longer than the inner tracks)

Yes, at the lowest levels, the disk needs to know what head to read from, what track to seek to, and how long to wait after the sync sector. However, these values are not known to the OS (and due to remapping and variable SPT values, can't be).

As for any (minor) speed changes due to either IO-port access speeds or calculations - I'd still say that CHS would be slower, as the drive (or controller) now has to convert the CHS address into the LBA address the drive expects.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
User avatar
SparrowOS
Member
Member
Posts: 72
Joined: Wed Nov 14, 2012 5:22 pm
Location: Vegas
Contact:

Re: CHS, LBA, performance (was: ELF Bootloader)

Post by SparrowOS »

thepowersgang wrote:I'm going to interject here (and possibly feed the troll) with what I am lead to believe is true about modern hard disks.

All modern disks internally (within the on-disk controller) use LBA, and perform remapping of known bad sectors automatically. They then provide almost completely false CHS dimensions to the BIOS so that legacy software can still access at least some of the disk. (Another thing to note is that any high-density disk doe not have the same number of sectors on every track, as the outer tracks are far longer than the inner tracks)

Yes, at the lowest levels, the disk needs to know what head to read from, what track to seek to, and how long to wait after the sync sector. However, these values are not known to the OS (and due to remapping and variable SPT values, can't be).

As for any (minor) speed changes due to either IO-port access speeds or calculations - I'd still say that CHS would be slower, as the drive (or controller) now has to convert the CHS address into the LBA address the drive expects.
This whole discussion occurred because rdos said 28-bit was faster than 48-bit. That seemed to me as silly as saying CHS was faster than 28-bit. If you had a 1TB drive, who would use CHS even if it was faster? rdos is suggesting you only use the first 130Gig of a 1TB drive because he thinks the negligable port I/O time saved is worth it. In actual fact, he is a troll arguing for his own operating system that supports 28-bit and not 48-bit, being silly and dishonest.
Post Reply