2003 Advanced Programmer Morning Test Analysis - Operating System

zhaozj2021-02-16  56

The operating system is the content of the soft test in the morning, although this part is not much, but the content of the review is still more. Mainly involved in the type of operating system, the hierarchy of the operating system and the principles and methods of management, operation, processor, storage, file, and equipment. Each part is likely to come out. If the candidate is not familiar with the operating system knowledge, it is not enough to see Wang Chunsen's elevation tutorial. It is recommended that candidates refer to the "computer operating system" of the soup when reviewing.

1. In UNIX operating systems, when the user performs the following command:

1Ink ("/ user / include / myfile.sh", "usr / userwang / youfile.sh")

The file name "/usr/Userwang/youfile.sh" is stored in ____.

A. User Directory files in the B. Include Directory file

C. UserWang Directory files Document D. Youfile.sh

Answer: c

Analysis: 1INK command belongs to the file system call, mainly to implement file sharing, there are two parameters: Path1 and Path2, Path1 is the source file name, Path2 is the newly established directory file name. The essence of the 1INK command is to establish a new directory entry for files, add a new path name for the file. The above 1Ink command allows the user userwang to access myFile.sh on the / user / include path using the "/usr/Userwang/youfile.sh" path name. If the user does not want to share a file, you can also execute the unnire command.

Review Tip: Candidates should clearly manage file systems in UNIX.

2. Suppose it is in the system - a file has two names, it is - the difference between the file saves two copies is ____.

A. The former is greater than the storage space occupied by the latter.

B. The former needs two directory items, the latter only needs a directory entry

C. The former has a fast speed, and the latter has slowed down.

D. When the former changes the file associated with a name, the files connected to another change; the other copy of the latter does not change

Answer: D

Analysis: There are two names in the system - a file, then the file has two directory items, and the actual stored file has only one. And for two copies, files are saved, the file requires directory items, and the copy also requires directory items, and actually stores three files: files and two copies. This answer A is obviously wrong, it should be that the latter is greater than the storage space occupied by the former. The answer b is not right, because the latter needs three directory items. The answer C is not right, because the access speed of the file is related to the storage method of the file, the former in the topic is the same as the latter storage, only the number of directory items is different. A file has multiple names, which can be seen as a plurality of names shared a file, so when you change the file associated with a name, the file connected to another change, but the latter file and copy can be seen It is independent, so another copy does not change.

3. There is a cashier in a supermarket, and at the same time, there are N free shopping, we can regard customers and cashiers as two different processes, and the workflow is shown below. In order to use the PV operation to properly coordinate the work between the two types of processes, three semaphors S1, S2, and SN are set, and the initial values ​​are 0, 0 and N, respectively. In this way, A should be filled in __ (1) __, B1, B2 should be filled in __ (2) __, C1 in the __ (2) __, and C2 should be filled in __ (3) __.

(1) A. P (S1) B. P (S2) C. P (sn) D. P (SN), P (S1)

(2) A. P (SN), V (S2) B. P (SN), V (S1) C. P (S2), V (S1) D.V (S1), P (S2) (3) A. P (S1), V (S2) B. P (SN), V (S1) C. P (S2), V (S1) D. V (S1), P (S2)

Answer: (1) C (2) D (3) a

Analysis: This is a question for examining PV operations, so we must first understand that those places need to be mutually exclusive, and those places need to be synchronized. Two types of processes are given in the topic: the customer process and the cash register process, because the supermarket is the public resource between the customer's process, and the supermarket is allowed to have N kinds of customers to shop, so set a public signal amount SN, initial value Yes N, the customer process is to perform P (Sn) when entering the supermarket, and execute the V (Sn) operation when leaving the supermarket. After customers shopping, they should pay for the cashier, so the customer process and the cashier process are synchronous relationships, only one customer process payment is allowed, and the entire supermarket has only one cashier process, so you need to set a private signal for the customer process. The amount S2 sets a private semaphore S1 for the cashier process. Due to the start of the customer to pay, the cashier has not charged, so the initial value of S1 and S2 is 0. When there is a customer to buy something to pay, execute V (S1), inform the cashier's process has a customer payment, at which point the courier process can enter the charge after executing P (S1) operation, the payment is completed after the payment is completed, V (S2 To inform the customer, the customer can leave the gamstand at this time, the customer can leave the silver table, and the V (SN) is required to release resources when leaving the supermarket.

Review Tip: The PV operation is in an important position in the operating system. To use the PV operation, it is necessary to use the PV operation. It must be a good understanding of the mutual exclusion and synchronization of the process, that is, the processes are mutually exclusive, those processes It is synchronized.

转载请注明原文地址:https://www.9cbs.com/read-23939.html

New Post(0)