Reproduced:
Linux has increased support for SMP systems starting with 2.0. In the 2.2 kernel, the SMP implementation at the user level, the Linux kernel itself can not be accelerated because of multiple processors, after the 2.4 kernel, SMP implementation at the core level, the use of multiprocessor can speed up the processing speed of the kernel.
1. System Guidance in SMP
At the same time, a "context" can only be handled by one CPU. In the system boot and initialization phase, there is only one "context" that can be handled by only one processor. BP completes the system's boot and initialization, and creates multiple processes, allowing multiple processors to participate simultaneously, to start all the AP, so that they are ready to run after the initialization of their own.
In Linux, SMP system boot is a phased process, which requires the main CPU and secondary CPU in several places to synchronize, has achieved the same synchronization and coordination, and ultimately at the same time into the SMP process scheduling. The boot process for SMP systems in Linux on Intel's Pentium is as follows:
2, the process scheduling in SMP
in SMP-structured systems, there are multiple processes running simultaneously, requiring Linux to add two fields to the process's task_struct data structure, one is has_cpu, whether the table process is running on the CPU, and the other is processor, which CPU the table process runs on.