区分内核级别对延迟敏感和批处理过程

发布于 2025-01-29 20:15:06 字数 158 浏览 6 评论 0原文

我正在寻找一种可靠的方式,以区分批处理处理过程(例如垃圾收集器)和对延迟敏感的过程(例如,在内核级别)。

我正在考虑使用硬件性能计数器,但我需要知道PMU计数器级别的这两种类型之间的行为差​​异。

有什么可靠的方法可以在内核级别实现这一目标吗?考虑到CFS调度程序都在运行。

I'm looking for a reliable way to distinguish between batch-processing processes (e.g. garbage collectors) and latency-sensitive processes (e.g. key-value stores such as Redis) at the kernel level.

I was thinking of using hardware performance counters but I need to know the behavioral difference between these two types at the PMU counters level.

Is there any reliable way to achieve this at the kernel level? Considering all are running on the CFS scheduler.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

城歌 2025-02-05 20:15:06

您可能应该检查由CFS计算的线程的负载。负载对应于线程的时间相对于CFS分配的时间(不运行,仅能运行)。批处理处理过程将倾向于使用所有CPU时间,而对延迟敏感的任务通常会承受较低的负载,因为它们通常会频繁阻止/UNBLOCK。

请注意,这不是100%准确的,并且某些对延迟敏感的应用程序可能使用其所有CPU时间具有线程,因此具有高负载。但是负载可能是一个很好的第一个近似值,不必使用硬件计数器和实现复杂的东西。

您可以阅读有关CFS如何跟踪线程负载的精彩文章: https://lwn.net/articles/ 531853/

You should probably check the load of the threads, as computed by CFS. The load corresponds to how much time a thread was runnable (not running, just able to run) relative to the time it was allocated by CFS. Batch processing processes would tend to have a high load as they use all the CPU time they can, while latency-sensitive tasks would tend to have a lower load as they usually frequently block/unblock.

Note that this is not 100% accurate, and some latency-sensitive applications may have threads using all their CPU time, therefore having a high load. But the load might be a good first approximation that does not necessitate using hardware counters and implementing complicated stuff.

You can read this great article about how CFS tracks the load of threads: https://lwn.net/Articles/531853/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文