Operating System: management process understanding, operating system management process understanding
I recently started to read the operating system book (which is not in this direction). I still cannot fully understand it when I read the book, so let's simply summarize it.
1.A process (Monitors, also known as a monitor) is a program structure. Multiple working threads in the structure form multiple subprograms (objects or modules) to access shared resources. These shared resources are generally hardware devices or a group of variables. At a time point, only one thread can execute a subprogram of a management process. Compared with the concurrent program design that implements mutex access by modifying the data structure, the management process greatly simplifies various hardware and software resources in the program design system, the data structure can be used to abstract the resource features, that is, to characterize the resource with a small amount of information and operations performed on the resource, ignoring their internal structure and implementation details. The shared data structure is used to abstract the shared resources in the system. operations performed on the shared data structure are defined as a set of processes.
Like an intermediary station, a program uses this subroutine to use shared resources (a process of operating a specific shared resource has abstracted a specific hardware and software resource into a data structure, operations on this process are equivalent to using resources). The execution of at most one thread ensures mutual exclusion.
2.Conditional variables of a management process: a condition variable is a data structure within the management process and can only be accessed within the management process. It is global for all processes within the management process and can only be accessed through wait (), signal.
Wait (): suspends the calling process and releases the management process until another process executes signal () on the condition variable (). Signal (): if another process is suspended because it executes wait () on the condition variable, it is released. If no process waits, the signal is ignored and not saved. Wait and signal use the internal statements of resources. The condition variables are equivalent to the resources to be used. If other resources have been called, wait changes the volume. Once other resources are used, signal is used, and then the program is reused.
3.The management process has a very important feature, that is, only one active process can be in the management process at any time. This feature enables the management process to effectively complete mutual exclusion. As a part of the programming language, the compiler knows their particularity. Therefore, different methods can be used to call other processes to process the calls to the program. A typical solution is that when a process calls a management process, the first few commands in the process will check whether there are other active processes in the process. If any, the calling process will be suspended until another process leaves the management process and wakes it up. If no active process is using a management process, the calling process can enter.
4.From the perspective of language, Guan Cheng has the following features:
(1) Modularization. A pipe program is a basic program unit that can be compiled separately;
(2) abstract data types. The management process involves not only data, but also operations on data;
(3) Information masking. Some functions defined in the internal management can be called outside the management process, but the specific implementation of the functions is invisible to the outside;
5.Simply put, the code can only be executed by a single thread. For example, if a pipe program is called an atm, there are two methods in it: withdrawal and withdrawal. Different people use different threads, however, an atm can only be operated by one person in a single time period, that is, a single thread. This atm requires a lock. When a single person is in use, other people can only wait. In addition, if a person is used for a long time, it cannot be used. Therefore, a conditional variable is required to constrain the person. Conditional variables allow another thread to enter the pipe when waiting, which effectively prevents deadlocks.
6After the wait primitive is called, the process waits for many reasons. to distinguish them, the conditional variable is introduced to arrange queues of different wait (the reason for waiting is different)