Tang ziyu computer operating system (West electric) answer-Chapter 5 (http://bbs.edw.com.cn/dispbbs.asp? Boardid = 3 & id = 22479)

Source: Internet
Author: User
Tags field table



-- Author: ltply
-- Release Date: 08:16:00

-- Tang ziyu computer operating system (xidian) answer-Chapter 5
1. Which of the following methods can be used to load a program into the memory? Where are they applicable?
A. First, the Compilation Program will compile the user source code into several target modules, and then the link program will compile the target modules and the required
--- Database functions are linked together to form a load module, and then the load module is loaded into memory by the load program;
B. modules can be loaded in absolute mode, relocated mode and dynamic running mode;
C. The absolute loading method is applicable to a single program environment;
D. The relocable method is applicable to multi-program environments;
E. The dynamic running Fashion import method is also applicable to multi-program environments.
2. What is static link and dynamic link during loading and runtime?
A. Static links refer to links that are first linked to form a complete loading module and will not be split later;
B. The dynamic link during loading refers to the link mode of the target module when loading the memory;
C. The dynamic link during running is to delay the link of some target modules until execution.

3. What should I do when linking programs?
A. Modify the relative address;
B. Change the external call symbol.

4. What partition allocation algorithms can be used in the dynamic partition allocation mode?
A. Adaptive Algorithm for the first time;
B. Adaptive Algorithm for the first time in a loop;
C. optimal adaptive algorithm.

5. In the dynamic partition allocation mode, how should I link all idle partitions into idle partition chains?
You should set information for controlling partition allocation and forward pointers for linking each partition in the starting address of each partition;
Set a backward pointer at the end of the partition, and link all the partitions into a bidirectional chain through the forward and backward pointers.

6. Why should dynamic relocation be introduced? How to implement it?
A. in order to convert the Logical Address of the program or data to a physical location during program execution
--- Address, introducing dynamic relocation.
B. You can add a relocation register in the system to load (store) the starting address of the program in the memory. When the program is executed
--- The memory address that is being accessed is formed by adding the relative address to the address in the relocation register to achieve dynamic relocation.

7. Use Pascal-like language to describe the process of first-time adaptive algorithm for memory allocation.
(Omitted)

8. Which of the following situations may occur when the first adaptive algorithm is used to reclaim memory? How should we deal with these situations?
A. the recycle zone is connected to the previous partition of the insertion point. In this case, the recycle zone and the previous partition of the insertion point can be merged and no longer used as the recycle partition.
--- Assign a new table item, and modify only the size of the adjacent partition;
B. The recycle partition is connected to the last partition of the insertion point. The two partitions are merged, and the first address of the recycle partition is used as the first address of the new idle partition.
--- Small is the sum of the two;
C. The recycle area is adjacent to the two partitions before and after the insertion point. At this time, the three partitions are merged and the first address of the former adjacent partition is used. The size is
--- The sum of the three zones. The list items of the adjacent partitions are canceled;
D. If there is no idle partition in the recycle area, a new table item should be created for the recycle area. Fill in the first address and size of the recycle area, and
--- Its first address, which is inserted to an appropriate location in the idle chain.

9. What are the benefits of introducing swap in the system?
You can change processes that are temporarily not running in the memory or programs and data that are temporarily not used to external storage to free up enough memory space.
The program and data required by processes or processes that have running conditions are swapped into the memory, which greatly improves the memory utilization.

10 what functions should the system provide to achieve swap?
A. Management of swap space;
B. process switching;
C. Process substitution.

11 during process switching, will the entire process be swapped out each time? Why?
A. The entire process is swapped out every time when the process is switched;
B. Objective To solve memory shortage and improve memory utilization.

12 what hardware support is required for paging Storage Management? In your opinion, Intel 8086, MC68000,
Is Intel 80286 a chip microcomputer suitable for paging management?
(To be discussed)

13 in more detail, the introduction of paging Storage Management (it is estimated that the printing is wrong, it is a segmented Storage Management) is to meet the needs of users?
A. Convenient programming;
B. Achieve segment sharing;
C. Implement segment protection;
D. implemented dynamic links;
E. achieve dynamic growth.

14 How do I implement address conversion in the segment-and-page storage management mode with a fast table?
First, you must configure a table register to store the beginning address and length of the field table TL. When performing address conversion, use the segment number S, and the length of the segment TL
For comparison, if S <TL, it indicates that the access is not out of the Boundary. (If S> = TL, it indicates that the field number is too large and the access is out of the boundary, resulting in an out-of-boundary interruption signal .)
The start address and the field number are used to locate the position of the field table item corresponding to the segment in the segment table, find the start address of the segment in the page table, and use the segment in the logical address
Page number P to obtain the location of the page table items on the corresponding page, read the physical block number B of the page, and then use block number B and the page address to form a physical address.

15. Why is information sharing and protection easier for a segmentation system than a paging system?
A. for paging systems, each page is stored discretely. To achieve information sharing and protection, pages must be matched one by one.
--- A large number of page table items need to be created;
B. For a segmentation system, each segment starts from 0 and uses a contiguous address space. In this way, you only need
--- Set a field table item for the program to be shared and protected, and match the base address with the memory address one by one.

What is the difference between 16 pages and segments?
A. pagination and segmentation both adopt discrete distribution, and address translation must be implemented through address ing mechanisms. This is what they have in common;
B. There are three differences between them. First, from the functional perspective, pages are the physical unit of information, and pages are used to achieve discrete distribution to reduce
--- The out-of-memory fraction improves the memory utilization to meet the needs of system management, rather than the user's needs. The segment is the logical unit of information,
--- It contains a set of relatively complete information to better meet user needs;
C. The page size is fixed and determined by the system, but the segment length is not fixed, which is determined by the program written by the user;
D. The paging job address space is one-dimensional, while the segmented job address space is two-dimensional.

17. comprehensive comparison of continuous allocation and discrete allocation methods.
A. Continuous Allocation refers to allocating a continuous address space to a user program, including a single continuous allocation mode and a partitioned allocation mode.
--- Memory is divided into the system zone and user zone. The system zone is used by the operating system and the user zone is used by users. It is the simplest storage method,
--- But it can only be used in an operating system with a single user and a single task. Partition-based allocation is divided into fixed partitions and dynamic partitions. Fixed partitions are the simplest.
--- Multi-program storage management, because each partition is fixed in size, will inevitably cause a waste of storage space; Dynamic partition is based on the process
--- The actual needs, dynamically allocate continuous memory space for it, commonly used three allocation algorithms: The first time to adapt to the algorithm FF, this method is easy to leave a lot
--- Small idle partitions that are difficult to use increase the search overhead. The loop is applied to the algorithm for the first time. This algorithm can evenly distribute the idle partitions in the memory,
--- This will lead to a lack of large idle partitions. The best adaptive algorithm also leaves many small idle areas that are difficult to use;
B. the discrete distribution method is based on the idea that a process is directly distributed to many non-adjacent partitions.
--- Storage Management and segment-page storage management-Paging Storage Management aims to improve memory utilization and meet the needs of system management.
--- It aims to meet the needs of users (programmers). It is superior to paging storage management in terms of sharing and protection, while segment-based storage management is
--- Combine the two to learn from each other, that is, it has the advantages of convenient implementation, sharing, easy protection, and dynamic link of the segmentation system.
--- The paging system can solve the problem of external fragments and allocate memory discretely for each segment, which is obviously effective.
--- Storage management method;
C. In summary, the continuous and discrete distribution methods have their own characteristics and should be improved and used according to the actual situation.

※Source: bbs. kaoyan.

-- Author: ltply
-- Release Date: 08:18:00

--
Tang ziyu computer operating system (xidian) answer-Chapter 6
1. In the request paging system, which data items are included in the page table items? What are their functions?
A. In the request paging system, the data items contained in the page table items include the page number, physical block number, status bit P, access field A, modification bit M and
--- External Store address;
B. The status P indicates whether the page is transferred to the memory for reference during program access;
C. Access Field A is used to record the number of visits to this page within A period of time, or how long it has not been accessed recently. It is provided to the replacement algorithm.
--- Reference when selecting to switch out the page;
D. Whether the page has been modified after being transferred to the memory;
E. The external address is used to indicate the external address of the page, which is usually a physical block number for calling the page.
2. What is the maximum and actual capacity of a computer system's virtual memory?
A. the maximum capacity is determined by the sum of memory and external memory;
B. The actual capacity is determined by the memory.

3. What are the features of the virtual storage device? What are the most essential features?
A. The virtual memory has the characteristics of discretization, multiple times, switching and virtualization;
B. The most essential feature is discretization. On the basis of this, it forms a multi-occurrence and exchange. The most important feature shown is
--- Virtualization.

4. What hardware is required to implement virtual memory?
A. for systems that manage Request paging storage, in addition to a computer with a certain amount of memory and external storage
--- A page table mechanism is required. The page interruption mechanism and address translation mechanism are missing;
B. In addition to a computer with a certain amount of memory and external memory
--- A field table mechanism is required. The segment interruption mechanism and address change mechanism are missing;

5. What are the key technologies used to implement virtual memory?
(To be discussed)

6. In the request paging system, which data items should be included in the page table? What is the role of each item?
(Same as the first question)

7. In the request paging system, where should I transfer the required page to the memory?
A. When performing address translation, first retrieve the table and try to find the page to be accessed. If yes, modify the access
--- Bit. For write commands, you must also modify location 1 and then use the physical block number and page address given in the page table to form a physical address;
B. If the page table item of the page is not found in the quick table, you should go to the memory to find the page table, and then find the page table item from the status bit.
--- Check whether the page has been transferred to memory. If the page has been transferred to memory, you should write the page table items on this page to the table. When the table is full, you should first
--- Call up the page table items of a page determined by an algorithm, and then write the page table items of the page;
C. If the page has not been transferred to the memory, a page disconnection occurs and the OS is requested to transfer the page from the memory;
D. The external storage is divided into file and swap areas. If the system has enough swap area space, you can copy the files related to the process before the process runs.
--- Copy to swap zone, and transfer from swap zone if necessary;
E. If the system lacks sufficient swap zone space, all files that will not be modified can be directly transferred from the swap zone.
--- Write to external storage, but for the parts that may be modified, when they are swapped out, they must be transferred to the swap area, and then from the swap area when necessary
--- Transfer.

8. Which page replacement algorithms are usually used in the request paging system?
A. Optimal Replacement algorithm;
B. first-in-first-out algorithm;
C. Least recently used LRU replacement algorithm;
D. Clock replacement algorithm;
E. In addition, the replacement algorithm and page buffer algorithm are used at least.

9. The user space of a virtual memory has 32 pages, with each page being 1 kb and the primary storage being 16 KB. Assume that at a certain time point
--- The physical block numbers allocated for page 0, 1, and 2 of the user are 5, 10, 4, and 7 respectively.
--- Convert 0A5C and 093C to physical addresses.
A. Convert 0A5C to 2 in hexadecimal format: Random, 1010, 0101,1100. Because the page size is 1KB and about 10th power of 2, the page number of 0A5C
--- 2, the corresponding physical block number is 4, so the physical address of the virtual address 0A5C is 125C;
B. Convert 093C to 2:, page number is 2, and the corresponding physical block number is 4.
--- The physical address of 093C is 113C.

10 In the request paging system, what page allocation method is usually used? Why?
A. In the request paging system, there are two allocation methods: fixed and variable allocation;
B. The fixed allocation method is based on the process type or assigned to each process according to the suggestions of programmers and system administrators.
--- Memory space with a fixed number of pages will not change during the entire operation;
C. There are two methods of Variable Allocation: Global replacement and local replacement. The former is easy to implement, and the latter is efficient.

11 In a request paging system, when the LRU page replacement algorithm is used, if the page direction of a job is
--- It is,. When the number of physical blocks assigned to the job is M
--- When the value is 3 and 4, how many pages are missing and the page missing rate during the access? Comparison result?
A. When the number of physical blocks assigned to the job is M, the page missing rate is 7 and the page missing rate is 7/12 = 0.583;
B. When the number of physical blocks allocated to the job is 4 MB, the page missing rate is 4 and the page missing rate is 4/12 = 0.333.

12 In the replacement algorithm, which of the LRU and LFU are more commonly used? Why?
A. The access graphs on the pages of the LRU and LFU replacement algorithms are identical, that is, the hardware used is the same;
B. But LFU does not actually reflect the page usage.

13. What hardware support is required to implement the LRU algorithm?
A. Register, used to record the usage of a process on each page in the memory;
B. Stack, used to save the page numbers of the currently used pages.

14. Explain the basic principles of the improved Clock replacement algorithm.
A. Because the overhead of a modified page is greater than that of an unmodified page when it is swapped out, the improved Clock
--- In the algorithm, a replacement cost must be added in addition to page usage;
B. When selecting the page as the elimination page, the elimination page is selected as the first choice when both unused and unmodified are met.

15 what is jitter? What causes jitter?
A. Thrashing refers to calling a program or
--- In the SWAp area where data is sent to the disk, if the algorithm is not appropriate, the page that has just been swapped out will soon be accessed and needs to be re-transferred. Therefore, you need to select another page.
--- Call up, and the page to be swapped out will soon be accessed again, so it needs to be transferred, so frequent page change, resulting in a large amount
--- Time, we call this phenomenon "jitter ";
B. The reason for the jitter is that the CPU usage is inconsistent with the multiple program degrees. To improve the CPU utilization,
--- It can increase the degree of multi-channel programs, but simply increasing the degree of multi-channel programs will lead to a sharp increase in the page-missing rate, leading to a decline in CPU utilization.
--- The scheduling program of the system will continue to improve the multi-program degree to improve the CPU utilization and form a vicious circle. We call this process
--- It is in the "jitter" status.

16. How does one handle page missing interruptions in the request segmentation system?
(See P185 Figure 6-12)

17. How to Achieve segment sharing?
A. You can use corresponding table items in the segment table of each process to point to the starting address of the shared segment in the memory;
B. Configure the corresponding data structure as the shared field table. You can set the shared process Count in the field table item. This shared segment is called every time,
--- Count refers to an increase of 1. When a process releases a shared segment, Count minus 1. If it is reduced to 0, the system recycles the share.
--- The physical memory of the segment, and cancel the table items corresponding to the segment in the shared segment table;
C. For a shared segment, different processes should be given different access permissions;
D. Different processes can use different segments to share the segment.

18 What storage management methods does Intel 80386 chip support?
A. Non-segmented and non-Paging storage management methods;
B. Non-Segmented paging storage management methods;
C. Non-Paging Storage Management for segments;
D. Manage the Segmented paging storage.

19. Explain the working principle of the segment address translation mechanism in 80386.
A. Use the segment register and virtual address structure;
B. In the segment part, the address transformation is to convert the logical address into a linear address, and then send it to the paging part. (For details, see P191)

20 try to explain the two-level paging address translation mechanism of 80386.
(See P193)

21. How can I improve the memory utilization?
(To be discussed, this question can be viewed as a comprehensive summary of the essential content of this chapter)

※Source: bbs.kaoyan.com

-- Author: ltply
-- Release Date: 08:20:00

--
Tang ziyu computer operating system (xidian) answer-Chapter 13th
1. What are the basic features of UNIX systems?
A. openness;
B. Multi-user, multi-task environment;
C. Powerful functions and efficient implementation;
D. provides a wide range of network functions.
2. What are the core components of a UNIX system? What functions are included?
A. The core of a UNIX system is a process control subsystem and a file subsystem;
B. The process control subsystem includes process control, Process Communication, memory management, and process scheduling functions;
--- The file subsystem includes file management, high-speed buffer mechanism, and device driver functions.

3. What are the PCB components in UNIX systems? Use graphs to illustrate the relationship between them.
A. PCB in UNIX systems includes four parts: entry table, U area, process area table, and system area table;
B. The figure is shown in Pinterest.

4. What components does a process image contain? What is the role of the dynamic part of the system-level context?
A. Process Image consists of three parts: user-level context, register context and system-level context;
B. The dynamic part of the system-level context includes the core stack and several layer register contexts. It is used to access
--- In the core state, the core pushes a register context to the core stack. When the system is called out, the core will bring up and down a register.
--- Text. During context switching, the core is pushed to the context layer of the old process, and the context layer of the new process is displayed.

5. In UNIX systems, what are the main system calls used for process control )? What are their main functions?
A. fork, used to create a new process;
B. exec: change the original code of the process;
C. exit to terminate the process;
D. wait: suspends the calling process and waits for the child process to terminate;
E. getpid, get the process identifier;
F. nice: change the process priority.

6. What should I do to create a new process?
A. assign a process entry and a process identifier to the new process;
B. Check the number of processes that run simultaneously;
C. copy the data in the table entry;
D. The child process inherits all files of the parent process;
E. Create a process context for the sub-process;
F. sub-process execution.

7. Why should we adopt the process self-termination method? How to Implement exit?
A. In order to timely recycle the resources occupied by the process and reduce the intervention of the parent process, the UNIX system uses exit to terminate the process itself;
B. To implement exit, the core work should be:
--- Disable Soft Interrupt;
--- Reclaim resources;
--- Write accounting information;
--- Set the process to "Frozen ".

8. What kind of process scheduling algorithm does the UNIX system use? How is the priority calculated?
A. UNIX systems use multi-level feedback queue rotation scheduling algorithms;
B. Every 1 second, the core recalculates the user priority based on the following formula:
--- Priority = (CPU usage time recently/2) + basic user priority.

9. What are the differences between the signal and interrupt mechanisms?
A. Similarities:
--- Both signals and interruptions adopt the same asynchronous communication mode;
--- When a signal or interrupt request is detected, the program being executed is paused and transferred to execute the corresponding processing program;
--- Both are returned to the original breakpoint after processing is completed;
--- Shielding signals or interruptions;
B. Differences:
--- The interrupt has a priority, but the signal has no priority, that is, all signals are equal;
--- The signal processing program runs in the user State, while the interrupt processing program runs in the core state;
--- The interrupt response is timely, and the signal response usually has a large time delay.

10 what are the signal sending and processing functions of the signal in the signal mechanism?
A. sending a signal refers to sending a signal to a certain position in the signal domain of the specified process by the sending process;
B. Signal Processing functions:
First,
--- Use the system call signal (sig, func) to preset the signal processing method. When func is set to 1, such signals are blocked;
--- When func = 0, the process terminates itself after receiving the signal;
--- When func is not 0 and is not a class 1 integer, the value of func is used as the pointer of the signal processing program.
Then,
--- If the Soft Interrupt received by the process is a signal (func = 1) that has been determined to be ignored, the process will not return any processing results;
--- The process exits after receiving the Soft Interrupt (func = 0 );
--- Execute the Soft Interrupt Processing Program for setting.

11. What is an MTS queue? What is the main difference between an unnamed pipeline and a famous Pipeline?
A. Pipeline refers to a write process and a read process that can be connected and allow them to communicate in the form of producer-consumer.
--- Shared files, also known as pipe files;
B. An unknown pipeline is a temporary file. It is an unknown File Created by calling pipe () by the system. It has no path name and only
--- The Pipe process and its Child processes can identify the file descriptor and use the file (pipeline) for communication;
--- Famous pipelines are created by calling the mknod system and can exist in the file system for a long time. They have files with both path names,
--- Other processes can know its existence and use the path name to access the file.

12 what rules should I follow when I read and write pipelines?
A. Restrictions on the pipe file size;
B. processes are mutually exclusive;
C. When a process writes a pipeline, check whether there is sufficient space to store the data to be written. If yes, the data is written. If not, the core performs this index on the data.
--- The node makes a sign, and then let the write process sleep and wait until the read process reads data and then wakes up the write wait process;
D. check whether there is enough data to be read when the process reads the pipeline. If so, the process reads data from the initial value of the read pointer.
--- After one piece, the size of the address item is increased. After reading, the core modifies the read pointer in the index node and wakes up all the waiting write processes,
--- If no data exists, after reading the data, the process temporarily enters sleep and waits until the write process writes data to the MPs queue and then wakes up the read process.

13 what systems are called in the message mechanism? And describe their usage.
In UNIX, the message mechanism provides users with four system calls:
A. msgget () is used to establish a message queue or obtain the descriptor of a message queue;
B. msgsnd () is used to send a message to the specified message queue and link the message to the end of the message queue;
C. msgrcv (), used to receive a specified type of message from a specified message queue;
D. msgctl () is used to read and modify the status information of the message queue.

14. What systems are called in the shared storage zone mechanism? And briefly describe their usage.
A. shmget () is used to create a shared storage zone;
B. shmat (): attach the shared storage area to the virtual address space of the process;
C. shmdt (), disconnect the shared storage zone from the new process;
D. shmct (): Read and modify the status information of the shared storage area, or disconnect the process from the shared storage area.

15 what does the core need to do when executing the shmget system call?
A. first check the shared storage area table. If the table item of the specified key is found, it indicates that the shared area has been created and the descriptor of the table item is returned.
--- Shmid;
B. If the specified key table item is not found, and the flag is IPC_CREAT, and the parameter size value is within the system limit value, a system is allocated.
--- As the page table area of the shared area, the idle area allocates the response memory blocks and then fills in these block numbers in the page table;
C. The core is in the shared storage area and system area table. An empty table is allocated for the newly created shared area, and the shared storage area table is filled with
--- Keyword and its size, the starting address of the shared partition page table, pointer to the table item in the system partition, and so on. Finally, return the shared storage area descriptor --- shmid.

16. Which systems are called in the semaphore collection mechanism? And describe their usage.
A. semget () to create a semaphore set;
B. semop () to operate the semaphore.

17. How does the core manipulate semaphores?
A. The core changes the semaphore Value Based on sem_op, which can be divided into three situations;
B. If the value of sem_op is positive, the value is added to the semaphore value, which is equivalent to the usual V operation;
C. The sem_op value is negative, which is equivalent to the P operation. If the semaphore value is greater than the absolute value of the operation value, the core adds a negative integer to the signal.
--- Value. Otherwise, the core restores the operated semaphore to the value at the beginning of the system call;
D. If (sem_flg & IPC_NOWAIT) is true, return immediately. Otherwise, wait for the process to sleep.

18 what data structures are configured in UNIX systems for page management?
A. page table;
B. Disk block description table;
C. Page box data table;
D. Change the Usage Table.

19 in UNIX systems, how does one change the age of a valid page? And use the instance description.
A. the maximum age of a page that can be counted depends on its hardware facilities;
B. When only two digits are set as the age range, the valid page age can only be 0, 1, 2, and 3. When the age of the page is 0, 1, 2,
--- The page cannot be swapped out. When the age reaches 3, the page can be switched out. When the number of idle pages in the memory is lower
--- For a specified low time limit, the core will wake up the page-changing process, and the page-changing process will check every active, non-locked area in the memory.
--- Add 1 to the age field of all valid areas. For those pages whose ages have increased to 3, do not add 1, but replace them.
--- After being accessed by the process, the age in the age field is reduced to 0.

20 how should I transfer a missing page to the memory when it is on an executable file or on a swap device?
The core first allocates a memory page for the missing pages, modifies the table items on the page, points them to the Memory Page, and places the table items on the page into the corresponding hash queue.
And then transfer the page from the swap device to the memory. When the I/O operation is complete, the core calls the process to the page to wake up.

21. What are the situations when I switch out a page? How should we deal with these situations?
A. if a copy of the page has been swapped out on the swap device and the content of the page has not been modified, the core will not re-write the page
--- Switch to the device. You only need to clear the valid bits in the page table items of the page, and subtract 1 from the reference count in the data table items of the page box.
--- Put this page table item into the idle page linked list;
B. If there is no exchanged copy on the swap device, the SWAp process should write the page to the swap device, and the page chain can be used for centralized writing;
C. There is a copy of the switch-out page on the switch device, but the page content has been modified. At this time, the core switches the page to the original space on the switch device.
--- Release, and copy the page to the swap device again, so that the copy content on the swap device is always the latest.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.