gpt4 book ai didi

c - "CPU dies"(与硬件无关)是什么意思?

转载 作者:太空狗 更新时间:2023-10-29 11:11:45 25 4
gpt4 key购买 nike

最近在使用 Linux 内核的工作队列时,我发现了一些我不确定它是什么的东西(“CPU 死机”),甚至用谷歌搜索也不确定。

这是否意味着特定的 CPU 内核当前不可用或类似的东西?

以下是我要问的问题的上下文(full-version):

/**
* queue_work - queue work on a workqueue
* @wq: workqueue to use
* @work: work to queue
*
* Returns %false if @work was already on a queue, %true otherwise.
*
* We queue the work to the CPU on which it was submitted, but if the CPU dies
* it can be processed by another CPU.
*/
static inline bool queue_work(struct workqueue_struct *wq,
struct work_struct *work)
{
return queue_work_on(WORK_CPU_UNBOUND, wq, work);
}

最佳答案

Per-cpu 工作队列通常是首选,因为它们往往表现出更好的性能。

工作队列在一个 CPU 上提交,但如果此 CPU 进入 IDLE,则工作队列将移动到另一个 CPU。

如果工作队列(每个工作人员一个工作队列)为空,工作人员将进入空闲状态。

Each worker-pool bound to an actual CPU implements concurrency management by hooking into the scheduler. The worker-pool is notified whenever an active worker wakes up or sleeps and keeps track of the number of the currently runnable workers. Generally, work items are not expected to hog a CPU and consume many cycles. That means maintaining just enough concurrency to prevent work processing from stalling should be optimal. As long as there are one or more runnable workers on the CPU, the worker-pool doesn’t start execution of a new work, but, when the last running worker goes to sleep, it immediately schedules a new worker so that the CPU doesn’t sit idle while there are pending work items. This allows using a minimal number of workers without losing execution bandwidth.

参见 here

关于c - "CPU dies"(与硬件无关)是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57112155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com