Process Management:
What is a file?
is actually the storage space on the disk (a stream of data)
Storage methods are:
binary storage or text storage (byte storage and 2 binary are very different, 2-binary is more compact)
Shell Script
is plain text and cannot be executed alone, using the Bash interpreter (#!/bin/bash)
Both executable files (like Ls,cat, these binary execution files) and shell scripts (plain text, executed by the Bash interpreter) are eventually turned into a stream of data, which are handed over to the CPU for processing.
Shell scripts are handed to/bin/bash to run, and ls,cat these executables are also dependent on common library files
As long as the program reads data and output data, it is actually the I/O data stream
A process is an instance of a program, and processes do not interfere and identify with each other.
The role of the kernel:
The kernel is the resource scheduling tool, the arrows, in fact, are managed by the kernel, the allocation of management processes and CPU processing mechanism related things.
Linux itself is a preemptive multitasking (based on clock-driven preemption)
Program and kernel request resources, the kernel can be dispatched to the CPU to run
CPU Computing Power:
It's going to be time-lapse.
What about the computational power of memory? Is the space, mostly paging memory space, also known as Memory page (page frame: Pages box), and this page box is a fixed size
Running the program is not all of the loader, it may be a part of loading, using a fixed-size page box to store
This is similar to the disk block on disk.
What is the mechanism of the process when using memory space?
The process does not know that the memory is discontinuous, and the kernel is known, so the kernel is a virtual space to the process, let the process think that their memory in the space is continuous, and each process is assumed to have a fixed-size memory use, if it is a 32-bit system, the process will assume that he has 4G of memory available
The process thinks that its page boxes in memory are contiguous
Linux的Swap分区就是Window的虚拟内存(Window的这样说法是不太合适的)因为Swap分区它只是存储一些最近最少使用的,腾出内存空间给新的进程使用,而硬盘保存的只是临时存储的,需要交给CPU再次处理的话,还是需要交还给内存再传送的。
Memory mapping (generating: Shared memory space) such as:
In Linux, the parent process (daemon) for all processes is init, and the centos7.0+
The stepfather process (daemon) is SYSTEMD
Init--
The parent process terminates the child process and needs to be executed with the kernel, so each process has a certain record of the information, so that the parent process or our users themselves to find the process, usually we are using the process ID to manage the process
Fork ()
C-language tracking process: Two-way loop linked list
所谓查看进程数据,就是通过数据结构的标示去访问的不然我们去访问/proc的话,根本是看不懂的,这就需要进程管理工具帮我们去查看并显示成我们能够接受清晰的数据父进程调度子进程,相当于领导分派任务,你给我返回一个结果就行了,返回结果之后,父进程在继续往下执行
Shared libraries can be shared between processes, but cannot share data.
For example, two processes cannot open one file at a time
A thread is multiple instances of a process
CPU is a protective mechanism, said before the ring 0,1,2,3 (normal in the ring 3, the core of the ring 0;23 useless first)
CPU Clock driver:
is based on the CPU used to get the CPU to perform
Process priority:
Process scheduling: Process scheduling is one of the core functions of the kernel
Fair:
Fair results:
Starting point Fair:
Each process is created at the same priority level, when a process takes up CPU time too long, it is necessary to reduce the priority, and some useless need to increase the priority, and this is the kernel to complete
As follows:
is the linear address space Organization chart
The stack is a local variable
Heap general put the data in the file Ah, and so on
Can see
4GB of memory, where 1GB gives the kernel, 3G gives the other
Linux has a total of 140 queues, which means there are 140 priority levels
0-99 implementation priority is the priority of kernel management. The higher the priority is, the higher the priority of the 99 is the highest
and 100-140 belongs to the user can be set, that is, the so-called nice value, corresponding to 19 to +20, the smaller the value of the higher priority
With these concepts, you can learn some of the commands of process management.
6, Process knowledge (participating kernel scheduling knowledge)