[Reviewing the old and learning the new] Shorthand of the operating system of computer 408

Knowledge is learned and forgotten, and knowledge is forgotten and learned, so I made a shorthand version, using my own understanding to record the knowledge points I think are more important in various disciplines, so as to facilitate review and memory.

Operating System Overview

OS function?

A: The computer system is roughly divided into four parts from top to bottom: users, applications, operating systems, and hardware. The operating system is between users and hardware, and its functions have three points: control and manage the hardware and software resources of the entire computer system (processor management, memory management, file management, device management); provide convenient interfaces for users and other software. A collection of programs for the environment (command interface, graphical interface, program interface (system calls)); extensions to the hardware.

Four characteristics of the operating system?

Answer: Concurrency (two or more programs occur at the same time interval), sharing (resources in the system can be used by multiple concurrent programs in memory), virtual (turning a physical entity into several logical counterparts), asynchronous (execution of multiple concurrent programs stop-and-go advancing at an unpredictable rate).

system call?

Answer: Usually, the CPU state is divided into two types: one is the kernel state, which mainly executes the operating system kernel program; the other is the user state, which mainly executes the user application program. System calls are used if the user wants to service it by requesting the operating system in the program. For example, applying for allocation and reclamation of memory.

Interrupts and exceptions?

A: The introduction of interrupts - to support parallel operations between the CPU and the device. Interrupts are also called external interrupts, which refer to the occurrence of events other than the execution of instructions by the CPU, such as I/O end interrupts issued by the device, clock interrupts, etc. This type of interrupt is usually an event unrelated to the currently executing instruction. The introduction of exceptions - indicates the problems that occur when the CPU executes the instructions itself. Exceptions are also called internal interrupts, exceptions or traps, which refer to events that originate from the CPU executing instructions, such as illegal opcodes of programs, address out-of-bounds, arithmetic overflow, and page faults. exception, etc.

Big Kernel vs Micro Kernel?

A: The big kernel is the placement of operating system functions into the kernel as a cohesive whole. Because the modules share information, there is a high performance. A microkernel is an operating system divided into small, well-defined modules. Only the microkernel runs in kernel mode, and the rest run in user mode. Because it needs to switch between user mode and kernel mode frequently, there will be a certain performance loss.

Process management

Process and thread difference?

Answer: (Scheduling) Process is the basic unit of resource allocation and scheduling in the system, and thread is the basic unit of CPU scheduling and allocation; (Relationship) Thread exists depending on the process, and a process has at least one thread; (Address) Process has its own Threads share the address space of their own processes; (resource) processes are an independent unit that owns system resources, while threads themselves basically do not own system resources, but only have a few resources that are essential in operation, and other Threads share related resources of the process, such as memory; (switching) process switching overhead is much greater than thread switching overhead; (communication) communication between threads is more convenient, threads under the same process share data such as global variables, and processes The communication needs to be carried out in the way of inter-process communication; (concurrent) multi-threaded program as long as one thread crashes, the entire program crashes, but the crash of one process in a multi-process program will not affect other processes, because the process has its own separate address spaces, so multiprocessing is more robust.

Process states and transitions? (five states/seven states)

insert image description here

Process communication?

Answer: shared storage (bag); messaging (sending email); piped communication (half duplex);

Multithreaded model?

Answer: Threads are divided into user-level threads and kernel-level threads. Many-to-one model (excellent: thread management is performed in user space, which is more efficient; lack: one thread is blocked, the entire process is blocked, and concurrency is poor); one-to-one model (excellent: one thread is blocked, allowing another A thread continues to execute, and concurrency is better; lack: every time a user-level thread is created, a kernel-level thread needs to be created to correspond to it, and the overhead is high); many-to-many model (synthesis).

Process scheduling hierarchy?

Answer: The scheduling level is divided into job scheduling (choose one of the jobs whose external memory is in the backup state to allocate memory to it), intermediate scheduling (transfer to the external memory to wait (suspend) if the external memory cannot be run temporarily); into memory (ready)), process scheduling (choose one from the ready queue to assign a processor to it).

Process scheduling method?

A: First come first serve, short job priority, priority scheduling, high response ratio, time slice rotation, multi-level feedback queue, etc.

Synchronization and Mutex?

Answer: Synchronization means that the execution of multiple processes has a certain order because of cooperation. Mutual exclusion means that only one of multiple processes can enter the critical section at the same time. There are four principles of synchronization mechanism: space let in, busy wait, limited wait, and right wait (when the process cannot enter its own critical section, the processor should be released).

signal?

Answer: Semaphore is a powerful mechanism that can be used to solve mutual exclusion and synchronization problems. It can only be accessed by two standard primitives, namely wait(P) and signal(S). Semaphore is divided into integer semaphore (integer representing the number of resources) and record semaphore (containing an integer variable of the number of resources and a process linked list (used to link all processes waiting for the resource)).

Pipeline?

Answer: A monitor is a data structure that represents a shared resource, and a resource management program consisting of a set of procedures that perform operations on the shared data structure. The monitor is like a class: the monitor encapsulates the operations on shared resources, and the shared data structure in the monitor can only be accessed by the processes in the monitor; only one process is allowed to enter the monitor at a time, so as to realize process interaction. reprimand. Condition variables are the cause of blocking, and each condition variable holds a waiting queue that records all processes blocked by that condition variable.

Four basic conditions of deadlock?

Answer: Mutual exclusion condition, no preemption condition, ask-and-hold condition, circular wait condition.

Cause of deadlock?

A: The possible causes of system deadlock are mainly time and space. In terms of time, it is due to the improper order of advancement in the process of running, that is, the timing of scheduling is inappropriate; in terms of space, the allocation of exclusive resources is improper, and the partial allocation of mutually exclusive resources is inalienable.

Deadlock handling strategy?

Answer: Deadlock prevention (destroying one of the four necessary conditions: static allocation, sequential resource allocation), deadlock avoidance (safe state: banker's algorithm), deadlock detection and release (resource allocation graph, deadlock management, resource deprivation) law and revocation process law).

The difference between infinite loop, starvation and deadlock?

Answer: An infinite loop is that the processor has been obtained; starvation is a long-term unserviced; deadlock is a deadlock caused by multiple processes competing for resources.

memory management

Memory management function?

Answer: allocation and recycling of memory space; address translation (logical address and physical address); expansion of memory space (virtual memory); storage protection (upper and lower limit, base + limit length);

User source program becomes a program executed in memory?

Answer: Compile (source program-object module), link (object module-load module), load (load module-memory).

three links? (forming a logical address)

Answer: static linking (linking after compilation and then loading), dynamic linking at load time (relinking at loading time), and dynamic linking at runtime (relinking at runtime).

Three loaded? (form physical address)

Answer: Absolute loading (compile time), relocatable loading (load time: when a job is loaded into memory, it must be allocated all the required memory space; once a job enters memory, it cannot be moved in memory during the entire runtime. , and can no longer apply for memory space), dynamic runtime loading (runtime: the program can be allocated to a discontinuous storage area; during the program running, dynamically apply for and allocate memory as needed).

How memory is allocated?

Answer: The memory allocation methods mainly include continuous allocation management and non-continuous allocation management. Continuous allocation management methods include single continuous allocation, fixed partition allocation and dynamic partition allocation. The dynamic partition allocation method has the first adaptation algorithm (address increment), the best adaptation algorithm (capacity increment), the worst adaptation algorithm (capacity decrease), and the adjacent adaptation algorithm (starting from the place where the last search ended). Discontinuous allocation management methods include paging storage management, segmented storage management, and segmented page storage management.

locality principle?

Answer: Temporal locality and spatial locality. Temporal locality means that after a piece of data is accessed, the data may be accessed again soon after. Spatial locality refers to addresses accessed by a program over a period of time, and memory locations near it may also be accessed shortly thereafter.

What are the characteristics of virtual memory?

Answer: multiple times (can be loaded into the memory multiple times), interchangeability (allowing the job to be swapped in and out during operation), virtuality (logically expanding the memory capacity).

Page replacement algorithm?

Answer: The best replacement algorithm (the ones that are eliminated are those that will never be used in the future), the first-in-first-out replacement algorithm (the ones that are eliminated are the first to enter, Belady), and the algorithm that has not been used for the longest time recently (the ones that have been eliminated are those that have not been used for the longest time). access), clock replacement algorithm.

Page tables and fast tables? what's the effect?

Answer: The page table indicates the correspondence between the page number in the logical address and the occupied main memory block number. Role: do address translation work. A fast table is a portion of a page table that is stored in cache memory. The page table does address translation, and the CPU needs to access the main memory twice when reading and writing memory data. With the fast table, sometimes only one access to the cache memory, one main memory, which can speed up the lookup and increase the speed of instruction execution.

file management

Disk scheduling algorithm?

A: First-come, first-served algorithm, shortest search time algorithm, elevator scheduling algorithm.

Device management

I/O control method?

A: Program direct control, interrupt-driven mode, DMA mode, channel.

SPOOLING technology?

Answer: Three major components: input and output wells (disk), buffers (memory), and processes.

Finished, sprinkle flowers.

Guess you like

Origin blog.csdn.net/qq_43779149/article/details/123933576