千字节和千字节有什么区别?


回答 1:

这种混淆来自Windows的命名。但是,让我们稍后再说。

 

一千字节使用千字节S.I.前缀,这意味着1000倍。也就是说,1 KB是1000字节。千字节使用前缀kibi-我不确定它是否为S.I.。 kibi-表示1024倍,因此1 KiB为1024字节。

 

Windows将kibibyte命名为千字节,以防止用户使用kibi-前缀。但是,为什么他们选择了这种规模而不是采用Linux的方式,我当然不知道!我的意思是,我的320 GB硬盘(商业编号)在Windows上是298 GB(实际上是GiB),在Linux上是319.something。我的意思是,wtf与Microsoft是错的吗?


回答 2:

简短的答案:“ kibi-”始终表示1024。 “ kilo-”在大多数情况下表示“ 1000”,但是当您到达存储/网络/主内存的交集时,可能会造成混乱,而“ kilo-”有时表示为“ 1024”,并且主要是由于历史语言的使用。 RAM通常用二进制用法来描述:“千字节RAM”为1024 B,但千字节HD通常为1000 B,但是某些(大多数?)操作系统在引用文件大小和可用空间之类的内容时使用二进制用法。空间。

Historically,thecomputerscientistsbuildinghardwareandmemoryfounditeasiestandmostconvenienttocountthingsinbinarysincetheywereactuallyusingbinaryatalowlevel.Since210=1024isprettycloseto[math]103[/math],thefolkscreatingthehardware/memoryaddressingadoptedthekiloprefixtomean1024bytesandmegatobe[math]220[/math]=1,048,576isstillprettycloseto[math]103[/math].Historically, the computer scientists building hardware and memory found it easiest and most convenient to count things in binary since they were actually using binary at a low level. Since 2^{10} =1024 is pretty close to [math]10^{3}[/math], the folks creating the hardware/memory addressing adopted the “kilo-” prefix to mean 1024 bytes and “mega” to be [math]2^{20}[/math] =1,048,576 is still pretty close to [math]10^{3}[/math].

在该领域其他领域(例如,网络和存储)工作的其他计算机科学家在很大程度上使用了最初的SI定义,其中“ kilo-”表示1,000,“ mega-”表示1,000,000。标为“ 1GB”的硬盘存储了1,000,000,000字节。

Inthelate1990s,thebinomenclaturewasformallyintroducedbytheInternationalElectrotechnicalCommissiontoprovideawaytogetaroundtheambiguity.Usingkibibyte/KiB,mebibyte/MiB,gibibyte/GiB,etc.wouldunambiguouslyrefertothe210,[math]220[/math],[math]230[/math],etc.TheseprefixesareapartofofficialSIdefinitionsnow,butIdontthinkanyoneusesthebinaryprefixesoutsideofcomputerrelatedcontexts(Mycaruses38Lper100kibimetersjusthasprobablyneverbeensaid.)In the late 1990’s, the “-bi-” nomenclature was formally introduced by the International Electrotechnical Commission to provide a way to get around the ambiguity. Using kibibyte/KiB, mebibyte/MiB, gibibyte/GiB, etc. would unambiguously refer to the 2^{10}, [math]2^{20}[/math] ,[math]2^{30}[/math], etc. These prefixes are a part of official SI definitions now, but I don’t think anyone uses the binary prefixes outside of computer-related contexts (“My car uses 38 L per 100 kibimeters” just has probably never been said.)

讨论网络时,还会出现其他问题。传统上,人们在谈论“位”(b)而不是您在大多数其他域中看到的“字节”(“ B”)时使用以10为基数。而且,大多数联网协议包括填充(开始和停止位)和纠错/检测码(例如奇偶校验位)。也就是说,要传输单个字节(8位)的数据,沿导线发送的数据可能为11位或更多。因此,例如1 Gb / s的网络连接每秒可能会沿电线发送1,000,000,000位,但这即使在最佳环境下也无法完全转化为125,000,000 GB / s的有效数据传输。

Whenthemarketingpeoplegetinvolved,itgetsconfusingtoo.Thebase10unitssoundbetterthanthebinaryunits.Ievenrememberseeingadvertisementsinthe1980sand90swheretheycombinedtheunitsinwaysthatwereespeciallyconfusing:e.g.amegabytebeing1,024,000bytes(i.e210103.)Fortunately,thatkindofusagewasrare.When the marketing people get involved, it gets confusing too. The base-10 units sound better than the binary units. I even remember seeing advertisements in the 1980′s and 90’s where they combined the units in ways that were especially confusing: e.g. a “megabyte” being 1,024,000 bytes (i.e 2^{10}*10^{3}.) Fortunately, that kind of usage was rare.

一些Unix工具可让您选择输出格式。例如。引用“ df”(报告文件系统磁盘空间使用情况)工具的手册页:

-h,-人类可读格式的人类可读打印尺寸(例如1K 234M 2G)-H,-同样,但使用1000的幂而不是1024