Skip to Content
深入理解運算原理|從簡單的機器到無所不能的程式
book

深入理解運算原理|從簡單的機器到無所不能的程式

by Tom Stuart
November 2017
Beginner to intermediate
344 pages
7h 2m
Chinese
GoTop Information, Inc.
Content preview from 深入理解運算原理|從簡單的機器到無所不能的程式
終極機器
|
161
多維磁帶
最後,試著給圖靈機更寬廣的儲存設備的確讓人難以抗拒。我們可以提供無限大的二維
方格方塊來取代線性磁帶,並允許磁帶頭能夠上、下、左、右移動。這將有助於我們不
需移回磁帶頭就能讓機器快速存取其外部儲存空間的特定部分,而這也允許我們在眾多
字串周圍留下無限數量的空白空間,讓它們每一個皆可輕易擴充,而不必想要插入字元
就得沿著整個磁帶手動重新排列資訊來產生儲存空間不可。
方格一定可以用一維磁帶模擬,最簡單的作法就是使用
兩個
一維磁帶:主磁帶用於實
際儲存資料,次磁帶當作臨時空間。模擬方格的每一列
4
都存到主磁帶,頂端列優先儲
存,它們都以特殊字元標示了每列的結尾。
主磁帶頭一如往常位於目前字元,所以機器只要左右移動磁帶頭,就可以在模擬方格左
右移動。如果磁帶頭命中了列尾標記,則會使用副常式沿著磁帶混合所有一切,讓方格
能有一個空間的寬度。
要在模擬的方格上、下移動,磁帶頭必須分別向左或向右移動一整列。機器若要完成這
樣的工作,首先要將磁帶頭移到目前該列的起始或結束之處,接著使用次磁帶記錄經過
的距離,然後在前一列或下一列將磁帶頭移動相同的偏移量。如果磁帶頭移開了模擬方
格的頂端或底部,可以使用副常式替磁帶頭分配新的一空列,以便移入。
這個模擬物的確需要附帶雙磁帶的機器,但我們也知道如何模擬這樣的機器,所以我們
最後得到儲存在兩個模擬磁帶的模擬方格,而這些模擬磁帶本身其實只是儲存在單一原
生磁帶。雙層級的模擬引入了許多額外的規則和狀態,並且需要底層機器採取許多步驟
才能執行模擬物的單一步驟,但是增加的大小和緩慢(最終)不會妨礙它完成它該做的 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JSON實務手冊

JSON實務手冊

Tom Marrs

Publisher Resources

ISBN: 9789864766000