[Blitz Linux Series P9] The logic that programmers must understand——[The secret of operating system management]

insert image description here

foreword

Hello everyone, welcome to the YY drop Linux series, a warm welcome! The main content of this chapter is aimed at veterans who have been in touch with Linux, and introduces the process from the operating system level:
the main content includes:
insert image description here

Welcome to subscribe to the YY drop Linux column! More dry goods are continuously updated! The following is the portal!

Subscribe to the column reading: YY 's "Linux" series❀❀❀❀❀
【Linux Series-P1】Building a Linux Environment
[Linux Series-P2] Basic knowledge and instructions of Linux
【Linux Series-P3】Linux Permissions
[Linux series-P4] Linux basic tools [yum] [vim]

![Insert picture description here](https://img-blog.csdnimg.cn/e10cdffafe204b80a0ff651d9e3ea7a5.png

1. The core concept of operating system management: "Describe first and then organize"

  • The process of management is a process of "describing first and then organizing".

1. The application of "describe first and then organize" in daily life

  • The principal needs to manage students and the principal has limited energy and will not contact each student one by one, so a middleman (executor)-counselor is needed to manage;
  • According to the attributes, the counselor first describes "students" as a collection of attributes, such as: a collection of colleges, majors, and classes, that is, a structure;
  • Finally, connect the information of each student through a data structure such as a linked list to complete the organization ;
  • Since then, the principal's management of students has been successfully transformed into adding, deleting, checking and modifying linked lists ;
    insert image description here

2. The application of "describe first and then organize" in the operating system

  • Similarly, in the computer ecology, the [operating system] needs to manage the [object] and does not meet with it. The medium between them is the [drive system];
  • In the same way, in the operating system, managing any object can eventually be transformed into adding, deleting, checking and modifying a certain data structure ;
  • It is also doomed that there are a large number of data structures in the operating system, and the entity of this description is PCB;

2.PCB articles

1.PCB

  • Process information is placed in a data structure called a process control block, which can be understood as a collection of process attributes .
  • It is called PCB (process control block) in the textbook, and the PCB under the Linux operating system is: task_struct (detailed in the PCB detailed explanation below)

2. Detailed explanation of "task struct" in "Description process-PCB"

PCB:

  • Process information is placed in a data structure called a process control block, which can be understood as a collection of process attributes .
  • It is called PCB (process control block) in the textbook, and the PCB under the Linux operating system is: task_struct.

A type of task_struct-PCB:

  • The structure describing the process in Linux is called task_struct.
  • task_struct is a data structure of the Linux kernel that is loaded into RAM (memory) and contains process information

task_ struct content classification:

  • Identifier: Describe the unique identifier of this process, which is used to distinguish other processes.
  • Status: Task status, exit code, exit signal, etc.
  • Priority: Priority relative to other processes.
  • Program Counter: The address of the next instruction in the program to be executed.
  • Memory pointers: including pointers to program code and process-related data, as well as pointers to memory blocks shared with other processes
  • Context data: The data in the registers of the processor when the process is executed [example of suspension of studies, to add pictures of CPU, registers].
  • I/O status information: including displayed I/O requests, I/O devices assigned to the process and a list of files used by the process.
  • Billing information: May include sum of processor time, sum of clocks used, time limits, billing account number, etc.
  • other information

3. Process articles

1. Process

  • Textbook concept: an execution instance of a program, a program that is being executed, etc. / a program that has been loaded into memory .
  • Kernel point of view: Acts as the entity that allocates system resources (CPU time, memory).

2. The basic structure of the process

  • The process includes: [PCB] + [code, data]
    insert image description here

Guess you like

Origin blog.csdn.net/YYDsis/article/details/131986218