2005年10月26日 星期三

What Is 64-bit Computing?

What Is 64-bit Computing?

When reading about PCs and servers, you'll often see the CPU described by the
number of bits (e.g., 32-bit or 64-bit), here's a little info about what that
means.

32-bit refers to the number of bits (the smallest unit of information on a
machine) that can be processed or transmitted in parallel, or the number of
bits used for single element in a data format. The term when used in
conjunction with a microprocessor indicates the width of the registers; a
special high-speed storage area within the CPU. A 32-bit microprocessor can
process data and memory addresses that are represented by 32 bits.

64-bit therefore refers to a processor with registers that store 64-bit
numbers. A generalization would be to suggest that 64-bit architecture would
double the amount of data a CPU can process per clock cycle. Users would note
a performance increase because a 64-bit CPU can handle more memory and larger
files. One of the most attractive features of 64-bit processors is the
amount of memory the system can support. 64-bit architecture will allow
systems to address up to 1 terabyte (1000GB) of memory. In today's 32-bit
desktop systems, you can have up to 4GB of RAM (provided your motherboard
that can handle that much RAM) which is split between the applications and
the operating system (OS).

The majority of desktop computers today don't even have 4GB of memory
installed, and most small business and home desktop computer software do not
require that much memory either. As more complex software and 3D games become
available however, we could actually see this become a limitation, but for
the average home user that is very far down the road indeed.

Unfortunately, most benefits of a 64-bit CPU will go unnoticed without the
key components of a 64-bit operating system and 64-bit software and drivers
which are able to take advantage of 64-bit processor features. Additionally
for the average home computer user, 32-bits is more than adequate computing
power.

When making the transition from 32-bit to 64-bit desktop PCs, users won't
actually see Web browsers and word processing programs run faster. Benefits
of 64-bit processors would be seen with more demanding applications such as
video encoding, scientific research, searching massive databases; tasks where
being able to load massive amounts of data into the system's memory is
required.

While talk of 64-bit architecture may make one think this is a new
technology, 64-bit computing has been used over the past ten years in
supercomputing and database management systems. Many companies and
organizations with the need to access huge amounts of data have already made
the transition to using 64-bit servers, since a 64-bit server can support a
greater number of larger files and could effectively load large enterprise
databases to into memory allowing for faster searches and data retrieval.
Additionally, using a 64-bit server means organizations can support more
simultaneous users on each server potentially removing the need for extra
hardware as one 64-bit server could replace the use of several 32-bit servers
on a network.

It is in scientific and data management industries where the limitations of
the 4GB memory of a 32-bit system have been reached and the need for 64-bit
processing becomes apparent. Some of the major software developers in the
database management systems business, such as Oracle and SQL Server, to name
just two, offer 64-bit versions of their database management systems.

While 64-bit servers were once used only by those organizations with massive
amounts of data and big budgets, we do see in the near future 64-bit enabled
systems hitting the mainstream market. It is only a matter of time until
64-bit software and retail OS packages become available thereby making 64-bit
computing an attractive solution for business and home computing needs.

底下不是翻譯
所謂的位元,指的是“bit“,在一般的電腦架構,換算如下:

1 Byte = 8 bits
1 KB (Kilo Bytes) = 1024 Bytes
1 MB (Mega Bytes) = 1024 KB

餘此類推。

什麼是64位元的電腦?這要先談到什麼是64位元?簡單說來,CPU內部有所謂的暫存器(
Register),一個CPU大致上能夠做的事情大致上是:

1)從暫存器搬資料到記憶體(RAM)
2)從記憶體搬資料到暫存器
3)把放在暫存器內部的資料作加減乘除等運算

而所謂的64位元指的就是暫存器的寬度。32位元的電腦每個暫存器是32位元寬,64位元則
是64位元寬。暫存器寬度變寬有什麼好處呢?在一般應用上,有兩個好處:

1)記憶體定址的能力能夠延伸到64位元,也就是16384 PetaBytes(嗯,我知道,有點
不可思議的大小)。
2)可以在一個週期(clock cycle)以一個指令處理超過32位元長度的資料,例如:
49000120300 + 87135120300,或者double precision的浮點數。

而這就衍生了幾個謬誤:

1)64位元電腦一次可以處理32位元電腦兩倍的資料?

技術上來說,是的,實際上來說,不對。

有很多資料不能合併處理,也有很多資料的數值範圍就是沒有超過32
位元(要超過32位元,必須是大於 4,294,967,295的自然數,或者超過正負
2,147,483,647的整數,諸如此類),64位元電腦只有在處理超過這些範圍的數值時才有
意義,並且其速度不會是32位元的兩倍(通常會超過,因為32位元的電腦往往需要三個以
上的指令才能完成同樣的運算)。

2)64位元電腦一次可以定址超過xxTB

技術上來說,不算對,實際上來說,看狀況。

如前面所說,64位元的定址可以定址到遠遠超過1TB(正確的說法是16,777,216 TB),但
是CPU的外部界面是否有這麼多的針腳就不一定,而南北橋晶片的配合也是一個重點(有
人在研發使用序列界面的RAM希望解決這些問題,不過還不成熟)。

3)實體記憶體的能力限制了64位元電腦的記憶體能力

技術上來說,不算對,實際上來說,也不算對。

雖然現在的電腦沒有人做到讓記憶體可以插到64位元的極限(16,777,216 TB),不過這
並不代表應用程式的能力就被限制住了,事實上而言,許多應用上我們不會【同時】用到
那麼大的資料,但是我們需要暫時存放很大的資料過一陣子再來用,這時候虛擬記憶體就
派上用場,而64位元相對於32位元仍然有一定的優勢。

4)所有的應用程式都要改寫才會發揮64位元的能力

技術上來說,不算對,實際上來說,也不算對。

有些動作並不是有程式本身完成的,例如I/O的動作,檔案系統存取,諸如此類,這些動
作都會讓系統切換到另一個執行模式(Kernel Mode),在某些狀況下,事實上是有可能
讓原始32位元的程式得到加速的系統服務,只是這些加速對程式有多少影響很難預估。

5)所有的程式都需要64位元

技術上來說,不對,實際上來說,也不對。

很多程式不需要64位元的定址能力(比如,能夠使用超過4GB記憶體的NotePad?!?!)
,而64位元的定址能力有其代價(更高的記憶體頻寬需求,一般程式會佔用更多一點的記
憶體,諸如此類),因此盲目的把程式移植到64位元是無意義的。

6)Tiger是(不是)一個64位元的作業系統

技術上來說,不是。

Tiger在很多部份仍然是32位元的,尤其是UI的Framework(Cocoa, Carbon, etc.),但
是Tiger也有相當部份已經能夠支援64位元,例如mathlib的數學運算,並且也可以執行以
64位元模式運行的程式。

7)64位元的應用目前還在觀望

技術上來說,不是,事實上來說,看你說的【應用】是什麼應用。

對大型資料庫、科學軟體、數學軟體、圖學軟體等等來說,64位元版本幾乎一定有其好處
,因為這類型的應用本來就是要處理大量資料或者高精密度的浮點數, 4GB的限制已經讓
許多軟體捉襟見肘。然而,如果所謂的【應用】指的是上網、MSN、Email、即時通,那麼
就算三年後我想仍然不會需要64位元的系統。

----------------------------------------------------------------------

【64位元的定址可以定址到遠遠超過1TB(正確的說法是16,777,216 TB)】這裡打錯了
....

順便雞婆一下.... 4GB 的極限是來自這裡:

http://www.cpu-world.com/CPUs/68020/

第一代的 32-bit CPU 是 68000, 不過 68020 說明比較清楚,另外還有 68010, 68030
Intel 是 80386:

http://www.cpu-world.com/CPUs/80386/

2^32 次方,再除 1024 = KB, 除 1024 = MB, 除 1024 = MB
除 3 次 1024 就等於 GB,所以等於 4GB

80386 Virtual memory of up to 64 TeraBytes

不幸的是,在IBM電腦的標準配備只有4-16MB的年代,80386終其一生同樣沒機會用到更多
的記憶體。
即使是搭載40 MHz 68030最頂級的Mac Iifx (售價美金 $9,900),當年電腦標準的記憶體
也只有4MB,最多16x4 = 64MB,可憐的68030終其一生都沒機會用到超過1GB的記憶體。

64 位元太大了.... 說 Apple 的 6502 (8bit)又太小, 16-bit 的 80286 好了...
2^16 = 65536 (請用計算機,科學,Y^x,按 2, [Y^x], 16 ﹦)
65536 / 1024 = 64KB

那 8bit CPU 不就 ... 2^8 = 256 Bytes... 錯!6502 最多可用到 64KB,因為
Address 有 16bit!

所以 80286 CPU 最多只能用到 64KB 的記憶體.... 蝦米啊??對,我沒寫錯!
當年的 Intel 想了一個 Good Ideal 把一個 64KB 區塊當一個 6502 8-bit CPU 來看,
把 Address 延長了 8bit,256 倍,所以 2^24 = 16MB,相當能同時跑 256 台 Apple
II....

不會吧.... 一部電腦最多只能用 16MB 的 RAM,哈哈哈.... 相信歷史吧...
現在起碼都是 256MB, 512MB onboard 的 PB, ibook, PowerMac...
-----------------------------------------------------------

寫的方式可能有點混淆,64位元系統的理論定址上限是16,777,216 TB是沒錯的:

2^64 / 1024 (KB) / 1024 (MB) / 1024 (GB) / 1024 (TB) = 16,777,216

問題是CPU的外部界面不會允許這麼多的定址腳位,所以會有各種限制(例如最常見的
1TB限制就是因為一般定址腳位設定在40 pin,也就是1 TB的定址能力)。

另外,所謂的16,777,216 TB定址能力是以per process來說,也就是每個應用程式能夠看
到的定址空間,透過Bank Switch的方式即使32位元CPU也有人讓系統可用定址擴充到64GB
,但是對於單一應用程式來說,仍然是4GB(在應用程式運行時不能隨意切換 Bank,否則
Stack和Heap都會不曉得跑到哪裡去)。


--
Reference:
http://www.webopedia.com/DidYouKnow/Computer_Science/2004/64_bit.asp

沒有留言: