Summarize some of the algorithms for the Linux kernel
Transferred from
Http://www.eechina.com/thread-159896-1-1.html
1.Linux dispatch
i/ o Consumption-and processor-consuming processes (ensuring timely IO response and efficient CPU utilization) load balancing: Each CPU has a process queue that runs the load-balancing program when the CPU's load difference is greater than 25%. (from the busiest CPU, take the next highest priority and CPU affinity to the lowest-load CPU process queue).
Why take the highest-priority process?
because the high priority process is distributed evenly across CPUs, the system can achieve the highest performance. CPU affinity: Primarily for caching or other reasons, such as a process that can only run on one CPU.
2. The difference between an interrupt handler and a thread.
1, no sleep in interrupt.
2, the interrupt context has a tighter time limit because it interrupts the running thread.
3, interrupt handler does not have its own stack, it shares the stack of interrupted threads, so in allocating a task stack to pay attention to a larger than the actual requirements, in case the interruption occurs, interrupt the application stack overflow.
3. Spin Lock: The main feature, unlike waiting for a semaphore, is that the process does not sleep when it is not getting the resources it wants.
4. Introduction of Read-write spin lock. The read-write spin lock reduces the size of the lock.
5.slab layer: Optimizes dynamic memory allocation (putting dynamic memory allocation and deallocation of the same size into a contiguous memory area so that no memory fragmentation is generated because each allocation happens to be one unit, and each release is just one unit, For example, in dynamic allocation and release of process Control blocks.
6. Disk Block I/O operations: Using the Linux elevator algorithm, the disk block IO request is sorted by track during the underlying operation of the disk to reduce the head tracing time and optimize disk IO operations.
7. Use page caching and page writeback to optimize the file system.