Linux - threads with a lower priority are not scheduled when a task with a higher priority is busy

Environment - embedded device with Linux kernel 2.6.18 Requirements - 3 threads (created from one process, say P1, created by T1, T2, T3)

T1 has linux 99 priority (highest), T2 is Linux 50 priority (middle), T3 is Linux 2 priority (lowest). No good values ​​are explicitly set for any of the threads.

Both T1 and T3 increment the variable once per second. T1 prints both variables once every 5 seconds. This is going smoothly. [Problem place] When T2 enters the endless loop "for (;;);", after the count of T1 grows correctly, but the count of T3 does not increase at all. The value that T3 never manages to run on the CPU.

All this time, I thought that CFS Linux ensures that all priorities get the right share (based on weight). But this proves that any thread that goes to the hog CPU without sleep stops all other downstream threads from starting.

Plz answer if anyone knows why the CFS scheduler behaves this way and if there is a way to fix this?

+4
source share
1 answer

. , SCHED_RR, , SCHED_OTHER. ( , ) , , (, ) (, ). , , , .

SCHED_RR , , , .

: , . , . .

( , 95% . .)

, , SCHED_OTHER nice(2) nice(2) setpriority(2).

nice(2) - CPU, .

+1

Source: https://habr.com/ru/post/1625127/


All Articles