Linux Operating System Notes

 

 

Within the Linux operating system kernel, the process is through a linked list, and a doubly linked list is managed.

The process descriptor: each process has its descriptor, each descriptor has a correlation between each other.

 

Doubly linked list:

 

Inside a process can contain multiple threads.

 

 

Context switching (Context swtch)

 

 

A process if that is removed from the current CPU, switch to the process B, process A has its own descriptor (task_struct), and is suspended. It is Suspend (stack pointer), inside the CPU, and the like including instruction counter preserved.

In the process descriptor file saved them. The process descriptor is maintained by the kernel. Therefore, this information is stored in the kernel.

When A process is switched out, it means that the process is scheduled B up. This process is called restoration thread (Resume)

The overall process is called a context switch.

 

Process B Process A ------ CPU ------

 

Context switching by whom? ---- by the kernel.

this means:

      Each switching process should start with the user space to kernel mode, and then to user mode.

Note: It is impossible by one process to another, the command must be completed by the kernel.

 

So the overall time of the CPU to be divided into two parts:

Part time basis of user-space processes all add up

The other part is the kernel space occupied by the time

 

Whether that process, CPU is always assigned to the space part of the user, and assigned to the kernel space part.

 

Linux support for the process preemption.

 A higher priority can preempt lower priority.

 But not always be able to seize, ------- system clock.

System clock:

   The frequency of the internal time.

   Tick: Tick ---- temporal resolution

   The operating system is how recording time?

   Every tick (tick), will produce a rush of clock interrupts.

Tick ​​comes, you can grab.

 

Linux process categories:

1, an interactive process (IO-intensive): Wait IO, particularly small amount of CPU requirements.

2, batch processes (CPU intensive): can also be understood as a daemon.

3, real-time processes (Real-time): run at any time, a very high priority process

 

For PC (Desktop): an interactive process priority should be a high priority, IO ,,,,,

For servers: general batch-oriented (CPU)

 

Now many scheduler can be achieved this way:

     Let batch process a little more time slices. ---- time slice is relatively large, but low priority.

     And less interactive process time slice, but a high priority.

   Scheduling is done according to priority.

 

Top command is used to display the process of system operation information.

 

Linux Priority:

1, real-time process priority: 1-99 smaller the number, the lower the priority. Usually associated with the kernel.

2, static priority: often used to describe the user process priority.

100-139 The smaller the number, the higher the priority.

So the priority range is 1-139

Real-time higher priority than static priority.

 

Obviously, the real-time kernel processes are usually a priority.

TOP

 

 

 

 

RT is displayed as a real-time process.

 

Guess you like

Origin www.cnblogs.com/dongxu2019/p/11520469.html