問題描述
我在多處理設(shè)置中使用 Redis 作為生產(chǎn)者/消費(fèi)者關(guān)系的隊(duì)列.
I am using Redis as my queue for a producer/consumer relationship in a multiprocessing setup.
我的問題是我的生產(chǎn)者超載了我的消費(fèi)者,然后竊取了它的 CPU.
My problem is that my producers are overloading my consumer then stealing it's CPU.
我的問題是,我能否在此設(shè)置中將整個(gè)處理器分配給特定的功能/進(jìn)程(即消費(fèi)者).
My question, can I allocate an entire processor to specific function/process (IE: the consumer) in this setup.
推薦答案
這不是 Python 開箱即用的東西.也有點(diǎn)特定于操作系統(tǒng).在 Linux 下查看此答案:https://stackoverflow.com/a/9079117/4822566
It's not something Python does out of the box. Is also somewhat OS-specific. See this answer on doing under Linux: https://stackoverflow.com/a/9079117/4822566
這篇關(guān)于為進(jìn)程指定特定的 CPU - python 多處理的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!