Linux operating system process knowledge

  
 

Q1. What are the concepts of procedures and processes? Why introduce the concept of "process”?

A:

1) A program is a plain file, a collection of machine code instructions and data stored in an executable image on disk, an executable image ( Executable image) is the content of an executable file;

2) The process represents the execution of the program, it is a dynamic entity, constantly changing with the execution of instructions in the program, at some point in the process The content is called process image;

3) The execution process of the program can be said to be the sum of an execution environment. In addition to various instructions and data in the program, the execution environment has some Additional data; and the dynamic changes in the execution environment reflect the operation of the program. In order to describe the dynamic process, the concept of “process” was introduced.


Q2. What is a process control block? What basic information does it contain?

A:

1) In Linux, the description structure of the process is called task_struct, and such a data structure is called a process control block (PCB);

2) PCB It is a fairly large data structure with more than 80 fields in its domain. According to its function, all domains are divided into: state information, link information, various identifiers, interprocess communication information, time and timer information, scheduling information, File system information, virtual memory information, and processor environment information.


Q3. What are the statuses of the Linux kernel?

A:

1) There are three basic process states for Linux: run state, ready state, and block state (or wait state); there are four possible states between these three states. Conversion relationship: running state -> blocking state, running state -> ready state, ready state -> running state and blocking state -> ready state;

2) For management convenience, The ready state and the running state are combined into one state — the runnable state, and then some other changes, the process state is divided into: runnable state, sleep (or wait) state (divided into deep sleep state and shallow sleep state ), pause state and zombie state.


Q4. What are the ways to organize PCBs?

A: PCBs are organized in the following ways: process linked lists, hash tables, runnable queues, and wait queues.


Q5. What are the main scheduling algorithms? What aspects should a good scheduling algorithm consider?

A:

1) The main scheduling algorithms include: time slice round-robin scheduling algorithm, priority scheduling algorithm (non-preemptive priority algorithm and preemptive priority algorithm), multi-level feedback Queue scheduling algorithms and real-time scheduling algorithms;

2) A good scheduling algorithm should consider five aspects: fairness, efficiency, response time, turnaround time, and throughput.

Copyright © Windows knowledge All Rights Reserved