Home  >  Article  >  System Tutorial  >  Operating system FAQ~

Operating system FAQ~

WBOY
WBOYforward
2024-02-18 08:15:33809browse

Operating system FAQ~

1: Explain the typical reasons why the process transitions between the three basic states

(1) For a process in the ready state, when the process scheduler allocates a processor to it, the process changes from the ready state to the execution state.

(2) If a process being executed is deprived of the processor to suspend execution because the time slice allocated to it is used up, its state will change from the execution state to the ready state.

(3) If something happens that blocks the execution of the current process and makes it impossible to continue execution, the process state changes from execution to blocking.

2: Why should threads be introduced into OS? What are the benefits of introducing threads?

(1) Since the process is the owner of the resource, a large time and space overhead is required in the creation, cancellation, and switching operations, which limits the further improvement of the degree of concurrency. In order to reduce the cost of process switching, the two attributes of the process as a resource allocation unit and a scheduling unit are treated separately, that is, the process is still used as the basic unit of resource allocation, but it is not used as the basic unit of scheduling (rarely scheduled or switched), and the scheduling is The responsibility for execution and switching is given to "threads".

(2) Introducing threads into OS and using threads as the basic unit of scheduling and dispatching can effectively improve the performance of multi-processor systems, reduce the time and space overhead incurred when programs are executed concurrently, and make the OS more efficient. Better concurrency

Three: (1) What is deadlock? (2) What is the reason for deadlock?

(1) A group of processes is deadlocked if each process in the group is waiting for an event that can only be raised by other processes in the group.

(2) ①Competition for non-preemptible resources causes deadlock. (Non-preemptible resources mean that once the system allocates a resource to the process, it cannot be forcibly taken back and can only be released after the process is used up.)

② Competition for consumable resources causes deadlock. (Consumable resources are dynamically created and consumed by the process during the running of the process)

③ Improper process advancement sequence causes deadlock (when the process is running, is the order of resource application and release legal?)

Four: Several ways to load the program

(1) Absolute loading method: After the user program is compiled, the target code with absolute address will be generated, which is only suitable for single-programming environment.

(2) Relocatable loading method: The loading module can be loaded into any allowed location in the memory, suitable for multi-programming environment.

(3) Loading method during dynamic runtime: When loading the load module into the memory, all the addresses are still logical addresses, and the logical addresses are converted to physical addresses only when the program is actually executed.

5: Several ways to link programs

(1) Static linking method: Before running the program, connect each target module and their required library functions into a complete assembly module, which will not be disassembled in the future.

(2) Dynamic linking during loading: A set of target modules obtained after compiling the user source program are loaded into memory using a linking method of loading and linking at the same time.

(3) Runtime dynamic linking: Linking to certain target modules, linking the target module only when the target module is needed during program execution

Six: (1) What is virtual storage, (2) What are its characteristics?

(1) A memory system with request transfer function and replacement function that can logically expand the memory capacity. Its logical capacity is determined by the sum of memory capacity and external storage capacity. Its running speed is close to that of memory, and its cost is close to that of external storage.

(2) ①Multiple times: The program and data in the job can be divided into multiple times and loaded into the memory for execution.

② (base) Commutability: Programs and data in a job are allowed to be swapped in and out while the job is running.

③Virtuality: logically expands the memory capacity.

Seven: (1) What is jitter? (2) What is the cause of jitter?

(1) If the multi-programming is too high, pages are frequently scheduled between the memory and the outside world, so that the time required to fish the page is more than the actual running time of the process. At this time, the system efficiency drops sharply, and even causes The system crashes, a phenomenon called jitter.

(2) The reason is that there are too many processes running in the system at the same time, so the physical blocks allocated to each process are too few, which cannot meet the basic requirements for the normal operation of the process, causing each process to frequently When a page is missing, the system must be requested to transfer the missing page into the memory. Therefore, the number of processes in the system waiting in line for page transfer in and out increases, resulting in jitter.

Eight: (1) What is a buffer? (2)What is the main reason for introducing buffer management?

(1) The buffer is a storage area, which can be composed of special hardware registers or memory.

The main function of buffer management is to organize these buffers and provide means to obtain and release buffers.

(2) The main reasons for introducing buffer management are:

① Ease the speed mismatch between CPU and I/O devices.

②Reduce the frequency of CPU interrupts and relax the limit on the corresponding time of CPU interrupts.

③Solve the problem of data particle number mismatch.

④Improve the parallelism between CPU and I/O devices.

The above is the detailed content of Operating system FAQ~. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:linuxprobe.com. If there is any infringement, please contact admin@php.cn delete