本文介紹了為進程指定特定的 CPU - python 多處理的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我在多處理設置中使用 Redis 作為生產者/消費者關系的隊列.
I am using Redis as my queue for a producer/consumer relationship in a multiprocessing setup.
我的問題是我的生產者超載了我的消費者,然后竊取了它的 CPU.
My problem is that my producers are overloading my consumer then stealing it's CPU.
我的問題是,我能否在此設置中將整個處理器分配給特定的功能/進程(即消費者).
My question, can I allocate an entire processor to specific function/process (IE: the consumer) in this setup.
推薦答案
這不是 Python 開箱即用的東西.也有點特定于操作系統.在 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
這篇關于為進程指定特定的 CPU - python 多處理的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!