Author Topic: how long is a kilobyte?  (Read 3231 times)

how long is a kilobyte?
« on: July 08, 2008, 04:58:52 pm »
To my extreme annoyance, I've just found out that the 'kilobyte' was redefined as 1000 bytes in 1998. The term 'kibibyte' was invented to stand for 1024 bytes.

This patent moronic act was perpetated by the keepers of the SI standards. 'kibibytes' and 'mibibytes' sound like some bl**dy catfood.

Therefore . . .


Schrodingers cat,
Is a discerning breed,
Extremely fussy,
About his feed.

Regardless of,
His appetites,
He refuses to eat,
kibibytes.
<i>Marmite slave</i>

Re: how long is a kilobyte?
« Reply #1 on: July 08, 2008, 05:00:43 pm »
Binary Rage! :P

Re: how long is a kilobyte?
« Reply #2 on: July 08, 2008, 05:03:03 pm »
Not redefined, they just instroduced a new standard (IEC).

The good thing about standards in computing is that there are so many different ones to choose from.

The only people who use MB to mean 1,000,000 bytes are Hard Drive Manufacturers (and even then it was down to some iditiotic marketing people).

I don't think I've worked with anyone in computing (management excluded) who honestly thought 1KB was 1,000 bytes.
"Yes please" said Squirrel "biscuits are our favourite things."

urban_biker

  • " . . .we all ended up here and like lads in the back of a Nova we sort of egged each other on...."
  • Known in the real world as Dave
Re: how long is a kilobyte?
« Reply #3 on: July 08, 2008, 05:04:10 pm »
I'm sorry but 1k =1024 bytes. The people who think it is 1000bytes are just plain wrong. There was no need to invent the kibibyte!

Update - wiki says

Quote
The kibibyte is closely related to the kilobyte, which can be used either as a synonym for kibibyte or to refer to 103 bytes = 1,000 bytes (see binary prefix).

Usage of these terms is intended to avoid the confusion, common in describing storage media, as to the ambiguous meaning of "kilobyte". Thus the term kibibyte has been defined to refer exclusively to 1,024 bytes.

and

Quote
Adoption of this term has been limited. In most cases the "kilo" prefix is used even if the meaning is a power of two.


Which shows that the SI can call things what the like but there's no reason why we all have to be so stupid  ;D
Owner of a languishing Langster

Re: how long is a kilobyte?
« Reply #4 on: July 08, 2008, 05:07:35 pm »
<i>Marmite slave</i>

Re: how long is a kilobyte?
« Reply #5 on: July 08, 2008, 05:10:09 pm »
More annoying are the people who should know the difference between 1kb and 1kB but don't.
"Yes please" said Squirrel "biscuits are our favourite things."

chris

  • (aka chris)
Re: how long is a kilobyte?
« Reply #6 on: July 08, 2008, 05:21:57 pm »
More annoying are the people who should know the difference between 1kb and 1kB but don't.

but not as annoying as the hardware engineers I used to work with who use kb to represent kilobits.

border-rider

Re: how long is a kilobyte?
« Reply #7 on: July 08, 2008, 05:26:23 pm »
http://physics.nist.gov/cuu/Units/binary.html

It's wrong, just plain wrong

Is it ?

It looks like a fairly rational way to discriminate between 2n and 10n

given that kilo is accepted as meaning 103, it was a bit odd to have it also representing 210

That SI page seems to explain it all rather well

Re: how long is a kilobyte?
« Reply #8 on: July 08, 2008, 05:42:14 pm »
More annoying are the people who should know the difference between 1kb and 1kB but don't.

but not as annoying as the hardware engineers I used to work with who use kb to represent kilobits.

Err, that's exactly what I was saying.

1kb is 1 kilobit.

1kB is 1 kilobyte.

The capitalisation is important. I agree that it often leads to confusion, but that's because ill-informed people use it wrongly.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: how long is a kilobyte?
« Reply #9 on: July 08, 2008, 05:42:36 pm »
It may seem odd, but it's normal behaviour, and for everyone (other than mass storage manufacturers) it's generally pretty clear from context which is meant.
Actually, it is rocket science.
 

Regulator

  • That's Councillor Regulator to you...
Re: how long is a kilobyte?
« Reply #10 on: July 08, 2008, 05:43:12 pm »
About 0.3mm...


HTH   ;D
Quote from: clarion
I completely agree with Reg.

Green Party Councillor

Re: how long is a kilobyte?
« Reply #11 on: July 08, 2008, 05:54:39 pm »
About 0.3mm...

On a copper Gigabit (assuming 1000E6 bps) ethernet cable, 1kB is about 1569metres long.

Working:

1kB = 8192 bits
8192 bits / ( 1000 * 1024 * 1024 bits per second) = 1 / 128000 seconds.

Electrical signal propagation along copper is about 67% the speed of light.

So in a 128000th of a second the signal would have moved about 1569m along the wire.

The reason network cables have a maximum length is that with the smallest packet available (64 bytes) it's possible for the sending network card to have finished sending it before it even reaches the other end of the wire. If this happens it may not detect an collisions on the wire if something else starts to send a packet at the same time. It messes with your head when you start considering these details as most people assume that electrical transmission is instantaneous.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: how long is a kilobyte?
« Reply #12 on: July 08, 2008, 06:29:15 pm »
Anyone who's tried to play Quake on a US server will tell you about latency.  And packetloss  :-\
And Darkness and Decay and the Coronavirus held illimitable dominion over all.

Re: how long is a kilobyte?
« Reply #13 on: July 08, 2008, 06:44:02 pm »
Anyone who's tried to play Quake on a US server will tell you about latency.  And packetloss  :-\
I was once doing some stuff at Telehouse and working on a router in the next rack were a couple of Yank engineers. Their (non technical) boss was giving them hell over the phone regarding the latency on the link to New York they were commissioning. They just couldn't get through to him that a packet cannot travel faster than the speed of light which it would need to do in order for the latency to improve to the degree he was demanding.
I think you'll find it's a bit more complicated than that.

Re: how long is a kilobyte?
« Reply #14 on: July 08, 2008, 06:54:38 pm »
I was once doing some stuff at Telehouse and working on a router in the next rack were a couple of Yank engineers. Their (non technical) boss was giving them hell over the phone regarding the latency on the link to New York they were commissioning. They just couldn't get through to him that a packet cannot travel faster than the speed of light which it would need to do in order for the latency to improve to the degree he was demanding.

It's even better when they suggest beaming it via satellite as if that is somehow magically faster:-

Light moves along optical fibre at about the same speed as electricity moves through copper (0.67c). So it would take about 1/60th of a second over a direct connection to the US (5000km) over copper or fibre.

A satellite in geosynchronous orbit would be a minimum of 35,780km up and then 35,780km down. At 300,000km/sec (the majority of the transmission will be through a vacuum) you're looking at just under a 1/4 of a second minimum.

OK, so you might be able to beat a direct copper/fibre connection with a low earth orbit comms satellite if it's in the right place but it'd be pushing it.
"Yes please" said Squirrel "biscuits are our favourite things."

Regulator

  • That's Councillor Regulator to you...
Re: how long is a kilobyte?
« Reply #15 on: July 08, 2008, 07:13:56 pm »
About 0.3mm...

On a copper Gigabit (assuming 1000E6 bps) ethernet cable, 1kB is about 1569metres long.

Working:

1kB = 8192 bits
8192 bits / ( 1000 * 1024 * 1024 bits per second) = 1 / 128000 seconds.

Electrical signal propagation along copper is about 67% the speed of light.

So in a 128000th of a second the signal would have moved about 1569m along the wire.

The reason network cables have a maximum length is that with the smallest packet available (64 bytes) it's possible for the sending network card to have finished sending it before it even reaches the other end of the wire. If this happens it may not detect an collisions on the wire if something else starts to send a packet at the same time. It messes with your head when you start considering these details as most people assume that electrical transmission is instantaneous.


Gah...!  Spoil my attempt at humour. 

Bloody engineers......
Quote from: clarion
I completely agree with Reg.

Green Party Councillor

Thor

  • Super-sonnicus idioticus
Re: how long is a kilobyte?
« Reply #16 on: July 08, 2008, 08:58:28 pm »
Anyone who's tried to play Quake on a US server will tell you about latency.  And packetloss  :-\
I was once doing some stuff at Telehouse and working on a router in the next rack were a couple of Yank engineers. Their (non technical) boss was giving them hell over the phone regarding the latency on the link to New York they were commissioning. They just couldn't get through to him that a packet cannot travel faster than the speed of light which it would need to do in order for the latency to improve to the degree he was demanding.

I was involved in a rather daft project recently in which we were required to set up a hot standby database in Asia for a primary database in London. The primary generates 150GB of transactional data every 24 hours.  We discovered how much more significant latency was than bandwidth in this scenario... :'(
It was a day like any other in Ireland, only it wasn't raining

Re: how long is a kilobyte?
« Reply #17 on: July 08, 2008, 09:11:19 pm »
Ooo, I forgot to say - nice ditty mrcharly, good to see some creative writing. Keep up the good work... ;)

rae

Re: how long is a kilobyte?
« Reply #18 on: July 08, 2008, 09:42:30 pm »
Quote
The reason network cables have a maximum length is that with the smallest packet available (64 bytes) it's possible for the sending network card to have finished sending it before it even reaches the other end of the wire. If this happens it may not detect an collisions on the wire if something else starts to send a packet at the same time. It messes with your head when you start considering these details as most people assume that electrical transmission is instantaneous. 

Is this really true?  I was always lead to believe that it was about attenuation and interference in the cable rather than any speed issues.  Crap cables have always had problems at the 90m limit, good ones will generally go a bit futher and still work.   If it was a propagation issue, then there would be a hard limit.   Also, how does fibre go to vast distances with only a change in physical transport? 

Modern switches with cut-through forwarding start to transmit the packet before it is fully received, so the concept of packets being "on the wire" is pretty normal in networks. 

(Not a network expert in the slightest, but used them a lot.....)


Maladict

Re: how long is a kilobyte?
« Reply #19 on: July 08, 2008, 09:58:37 pm »
Never mind all that nonsense.  I had to explain to someone I used to work with (in a previous job) that sizing an array at 1000 entries, then doing:

i = (i+1) % 1000;

was not the most well-thought-out approach.  He flatly refused (despite the array size being an arbitrary choice) to resize it to 1024 bytes to make it a simple calculation of

i = (i+1) & 1023;

though he did accept that doing:

i = (i+1);

if (i==1000)
    i = 0;

was more efficient than his previous attempt, though it is still (marginally) less efficient than what I proposed.  This is someone who is experienced, and working on an embedded system with no hardware divide unit. 

Even worse was our boss trying to defend his approach because a "decent compiler" on a Pentium IV would realise that the divide (or remainder calculation) could be sent to the floating point unit and thus be done in parallel with the integer execution and thus be hidden.  How much other integer code we'd have to write such that the compiler could mask the latency of such a thing was left unspecified, though I did find out later it was rather a lot of cycles.

I think the appropriate response would have been "Look, you moron, this kind of inefficiency may have been tolerated at Microsoft (where they both worked previously) but we don't work there, we aren't targeting a 3GHz Pentium IV we are writing code that will be run on a 100MHz ARM7.  Stop being so fucking stupid."

Eventually I left, which I should have done a lot sooner.

Re: how long is a kilobyte?
« Reply #20 on: July 08, 2008, 10:00:53 pm »
No it's not true. You can basically wait as long as you like to detect a collision however it needs to be agreed how long this should be so that the transmitting station can decide that there hasn't been a collision and send the next packet. This is known as the slot time and is is approximately equal to twice the signal propagation time between the two most-distant stations on the network ie the time taken for a packet to traverse the cable and back again in corrupted form must be lower than the slot time. So max cable length was a trade off between setting ethernet up for quick collision detection (short max cables length) and  having nice long cable runs. That was for the original 10mb ethernet using half duplex transmission. Modern switches support full duplex where there are no collisions (transmit and receive use different pairs of wires) however the standard still supports half duplex mode so that will limit the cable length. I
Exhaustive detail for those who are interested can be found on Cisco's web site.
I think you'll find it's a bit more complicated than that.

Maladict

Re: how long is a kilobyte?
« Reply #21 on: July 08, 2008, 10:09:09 pm »
Quote
The reason network cables have a maximum length is that with the smallest packet available (64 bytes) it's possible for the sending network card to have finished sending it before it even reaches the other end of the wire. If this happens it may not detect an collisions on the wire if something else starts to send a packet at the same time. It messes with your head when you start considering these details as most people assume that electrical transmission is instantaneous. 

Is this really true?  I was always lead to believe that it was about attenuation and interference in the cable rather than any speed issues.  Crap cables have always had problems at the 90m limit, good ones will generally go a bit futher and still work.   If it was a propagation issue, then there would be a hard limit.   Also, how does fibre go to vast distances with only a change in physical transport? 

Modern switches with cut-through forwarding start to transmit the packet before it is fully received, so the concept of packets being "on the wire" is pretty normal in networks. 

(Not a network expert in the slightest, but used them a lot.....)



Fibre is a point-to-point link so collisions can't occur.  Alex is talking about Ethernet-type networks, which use CSMA/CD (Carrier Sense Multiple Access with Collision Detection).  Each client attached to the network starts shouting, and also listens for the other guy's shout at the same time.  There is a window between when you start shouting but haven't had the other guy's shout yet - like two people talking over a high latency phone connection can suffer from - so the collision detect allows you to stop shouting when you hear someone else's shout coming in.  Both guys then back off for a randomised length of time and then each tries again.

CSMA/CD

Quote
To ensure that all NICs start to receive a frame before the transmitting NIC has finished sending it, Ethernet defines a minimum frame size (i.e. no frame may have less than 46 bytes of payload). The minimum frame size is related to the distance which the network spans, the type of media being used and the number of repeaters which the signal may have to pass through to reach the furthest part of the LAN. Together these define a value known as the Ethernet Slot Time, corresponding to 512 bit times at 10 Mbps.



Re: how long is a kilobyte?
« Reply #22 on: July 08, 2008, 10:13:14 pm »
Even with the limitations imposed by CSMA/CD things will probably still work if the cable length is too long, it just won't detect collisions correctly, and at a guess a higher level protocol will probably have to request resends because of data corruption.  It'll probably work, but the throughput will become pants.

Oh, and well done Maladict(a), people that stupid are the reason that things like my Sagem PVR crashes as soon as you look at it.  I wish we had something as powerful as a 100MHz ARM, at the moment most of our code runs on an 8MHz MA31750.  Luckily the guy who does are programming for that, will listen to me, and believe me, when I hit him around the head and tell him that it's a really bad idea!
Actually, it is rocket science.
 

Re: how long is a kilobyte?
« Reply #23 on: July 08, 2008, 10:25:45 pm »
Even with the limitations imposed by CSMA/CD things will probably still work if the cable length is too long, it just won't detect collisions correctly, and at a guess a higher level protocol will probably have to request resends because of data corruption.  It'll probably work, but the throughput will become pants.

Yup you will get "late collisions" and indeed performance will be pants and you will end up talking to your switch supplier and they will tell you to take a running jump because you are outside the standard.
As I said before most people these days aren't using CSMA/CD as they are using full duplex Ethernet but the cable length restrictions are still there so you can use half duplex if you want or need to and because the signal starts to drop off as the cable gets longer.
I think you'll find it's a bit more complicated than that.

Maladict

Re: how long is a kilobyte?
« Reply #24 on: July 09, 2008, 01:34:29 am »
Oh, and well done Maladict(a), people that stupid are the reason that things like my Sagem PVR crashes as soon as you look at it.  I wish we had something as powerful as a 100MHz ARM, at the moment most of our code runs on an 8MHz MA31750.  Luckily the guy who does are programming for that, will listen to me, and believe me, when I hit him around the head and tell him that it's a really bad idea!

Quite.

Nowadays I get to spend days optimising the hell out of a single loop - it's great!  ;D