操作系統恐龍書第十版題庫 ch13

1. Why is open() call implemented?

大部分的檔案操作均涉及對檔案有關的目錄條目的搜尋。為避免這種經常性搜尋,許多系統當檔案第一次使用前,須將開啟一個open()系統呼叫。當需要一個檔案操作時,只需要搜尋這個open-file table,而不是整個目錄。

2. What are the differences between per-process open-file table and a system-wide open-file table?

The operating system uses two levels of internal tables: a per-process table and a system-wide table. The per-process table tracks all files that a process has open. Stored in this table is information regarding the process’s use of the file. Each entry in the per-process table in turn points to a systemwide open-file table. The system-wide table contains process-independent information, such as the location of the file on disk, access dates, and file size. Once a file has been opened by one process, the system-wide table includes an entry for the file

作業系統使用兩層內部表格:一個行程表和一個全系統表格。每一個行程都有一個行程表,以記錄該行程所開啟的所有檔案。儲存在這個表格中是有關此行程所使用檔案的資訊。行程表中的每一進入點則又指向一個全系統使用的開啟檔案表。這個全系統共用的表格包含的資料和各process無關,譬如:檔案在磁碟中的位置、存取日期和檔案大小。一旦一個檔案被一個行程開啟之後,全系統表格包含檔案進入點。

3. Why information about the location of the file is kept in memory?

: Most file operations require the system to modify data within the file, then to speed up this operation by avoiding reading this information from the directory structure for each operation – it is kept in memory

大多數檔案操作都要求系統修改檔案中的數據,然後加快速度此操作藉由避免從每個操作的目錄結構中讀取這些資訊-保存在記憶體中

4. What is the reason to design an operating system which recognizes the type of a file?

:Because it can then operate on the file in reasonable ways, i.e., the system uses the type of the file and the type of operations that can be done on that file

因為他能以合理的方式操作檔案,例如系統使用延伸部分來辨識檔案的型態,並判斷可對檔案做的操作。

5. What is the main disadvantage of having the operating system support multiple file structures?

作業系統的體積非常大,他就必須包含程式碼以支援這些檔案結構,除此之外,每一個檔案可能都必須定義作業系統所支援的檔案類型之一。如果新的應用需要的資訊結構不是作業系統所支援,則會產生嚴重的問題。

6. What does it mean internal fragmentation associated with the internal file structure?

因為磁碟空間都是以區間來配置,所以每個檔案中最後一個區塊的部分空間被浪費。以區塊來配置會造成浪費,這就是internal fragmentation。

7. Is it possible that read_next() operation is used in direct access method?

Yes,it is.一種方法是保留住read_next()並加入另一項操作,position_file(n),其中n是區塊號碼。這樣就可以用position_file(n)和read_next()來達到和read(n)同樣的效果

8. Describe the main drawback of single-level directory structure

即使在單層目錄中只有一個使用者,當檔案數目增加的時候,也會變得很難記住所有檔案的名稱。使用者在一個電腦系統上擁有幾百個檔案,同時在另一系統上擁有相等數目的額外檔案是很普通的事。追蹤這麼多檔案是一項艱鉅的任務。對於許多用戶在單層目錄中的情况,此任務要複雜得多,他們應該就如何命名文件以避免衝突達成協議,並確保唯一的名稱。

9. What is the internal representation of a directory in tree-structured directory?

一個目錄(或子目錄)存有一組檔案或子目錄。在許多實作中,目錄只是另一種檔案,但以特殊的方式處理。所有目錄的內部隔事都一樣。在每一個目錄項目中都用一位原來表示這項目事個檔案(0)還是一個子目錄(1)。一些特殊的系統呼叫被用來建立和刪除目錄。

10. Describe the file protection method use by the UNIX system.

在UNIX系統中,與每個檔案漢子目錄相關的是三個欄—擁有者、群組和其他人—每個欄由3個位元rwx所組成,其中r控制讀取存取,w控制寫入存取,x控制執行。

11. What are the main disadvantages of associating a password with each file?

(1)使用者必須記住的密碼非常多,使得此方法變得相當不實際

(2)如果所有檔案只使用一個密碼的話,那麼當此密碼被查知時,所有的檔案又將全部變成可存取檔案。

12. How does MS Windows API implement shared memory using memory-mapped files?

The general outline for creating a region of shared memory using memory-mapped files involves first creating a file mapping for the file to be mapped and then establishing a view of the mapped file in a process’s virtual address space. A second process can then open and create a view of the mapped file in its virtual address space. The mapped file represents the shared-memory object that will enable communication to take place between the processes.

使用記憶體映射檔案建立共用記憶體區域的一班概述,包括優先替映射的檔案建立檔案映射(file mapping),然後在形成的虛擬位址空間中建立映射檔案的視圖(view)。然後在第二個行程可以在其虛擬位址空間中,開啟並建立映射檔案的視圖。映射的檔案表示共用記憶體物件,該共用記憶體物件將使行程之間能夠通信。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值