久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='RU6ne'></tfoot>
  • <legend id='RU6ne'><style id='RU6ne'><dir id='RU6ne'><q id='RU6ne'></q></dir></style></legend>
    <i id='RU6ne'><tr id='RU6ne'><dt id='RU6ne'><q id='RU6ne'><span id='RU6ne'><b id='RU6ne'><form id='RU6ne'><ins id='RU6ne'></ins><ul id='RU6ne'></ul><sub id='RU6ne'></sub></form><legend id='RU6ne'></legend><bdo id='RU6ne'><pre id='RU6ne'><center id='RU6ne'></center></pre></bdo></b><th id='RU6ne'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RU6ne'><tfoot id='RU6ne'></tfoot><dl id='RU6ne'><fieldset id='RU6ne'></fieldset></dl></div>

  • <small id='RU6ne'></small><noframes id='RU6ne'>

    • <bdo id='RU6ne'></bdo><ul id='RU6ne'></ul>

        multiprocessing.Queue 項目的最大大小?

        Maximum size for multiprocessing.Queue item?(multiprocessing.Queue 項目的最大大小?)
          <bdo id='grba7'></bdo><ul id='grba7'></ul>
            <tbody id='grba7'></tbody>

                <legend id='grba7'><style id='grba7'><dir id='grba7'><q id='grba7'></q></dir></style></legend>

              1. <i id='grba7'><tr id='grba7'><dt id='grba7'><q id='grba7'><span id='grba7'><b id='grba7'><form id='grba7'><ins id='grba7'></ins><ul id='grba7'></ul><sub id='grba7'></sub></form><legend id='grba7'></legend><bdo id='grba7'><pre id='grba7'><center id='grba7'></center></pre></bdo></b><th id='grba7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='grba7'><tfoot id='grba7'></tfoot><dl id='grba7'><fieldset id='grba7'></fieldset></dl></div>

                  <tfoot id='grba7'></tfoot>

                  <small id='grba7'></small><noframes id='grba7'>

                  本文介紹了multiprocessing.Queue 項目的最大大小?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用 Python 處理一個相當大的項目,該項目需要將計算密集型后臺任務之一卸載到另一個核心,以便不會降低主要服務的速度.在使用 multiprocessing.Queue 來傳達工作進程的結果時,我遇到了一些明顯奇怪的行為.為 threading.Threadmultiprocessing.Process 使用相同的隊列以進行比較,線程工作得很好,但在放入大項目后進程無法加入隊列.觀察:

                  I'm working on a fairly large project in Python that requires one of the compute-intensive background tasks to be offloaded to another core, so that the main service isn't slowed down. I've come across some apparently strange behaviour when using multiprocessing.Queue to communicate results from the worker process. Using the same queue for both a threading.Thread and a multiprocessing.Process for comparison purposes, the thread works just fine but the process fails to join after putting a large item in the queue. Observe:

                  import threading
                  import multiprocessing
                  
                  class WorkerThread(threading.Thread):
                      def __init__(self, queue, size):
                          threading.Thread.__init__(self)
                          self.queue = queue
                          self.size = size
                  
                      def run(self):
                          self.queue.put(range(size))
                  
                  
                  class WorkerProcess(multiprocessing.Process):
                      def __init__(self, queue, size):
                          multiprocessing.Process.__init__(self)
                          self.queue = queue
                          self.size = size
                  
                      def run(self):
                          self.queue.put(range(size))
                  
                  
                  if __name__ == "__main__":
                      size = 100000
                      queue = multiprocessing.Queue()
                  
                      worker_t = WorkerThread(queue, size)
                      worker_p = WorkerProcess(queue, size)
                  
                      worker_t.start()
                      worker_t.join()
                      print 'thread results length:', len(queue.get())
                  
                      worker_p.start()
                      worker_p.join()
                      print 'process results length:', len(queue.get())
                  

                  我發現這對于 size = 10000 工作正常,但對于 size = 100000 會掛在 worker_p.join().multiprocessing.Process 實例可以放入 multiprocessing.Queue 的內容是否存在一些固有的大小限制?還是我在這里犯了一些明顯的根本性錯誤?

                  I've seen that this works fine for size = 10000, but hangs at worker_p.join() for size = 100000. Is there some inherent size limit to what multiprocessing.Process instances can put in a multiprocessing.Queue? Or am I making some obvious, fundamental mistake here?

                  作為參考,我在 Ubuntu 10.04 上使用 Python 2.6.5.

                  For reference, I am using Python 2.6.5 on Ubuntu 10.04.

                  推薦答案

                  似乎底層管道已滿,因此在寫入管道時,饋線線程阻塞(實際上是在嘗試獲取保護管道免受并發訪問的鎖時).

                  Seems the underlying pipe is full, so the feeder thread blocks on the write to the pipe (actually when trying to acquire the lock protecting the pipe from concurrent access).

                  檢查這個問題http://bugs.python.org/issue8237

                  這篇關于multiprocessing.Queue 項目的最大大小?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                  <legend id='uFqGd'><style id='uFqGd'><dir id='uFqGd'><q id='uFqGd'></q></dir></style></legend>
                  • <bdo id='uFqGd'></bdo><ul id='uFqGd'></ul>

                        <tfoot id='uFqGd'></tfoot>
                            <tbody id='uFqGd'></tbody>
                          • <small id='uFqGd'></small><noframes id='uFqGd'>

                            <i id='uFqGd'><tr id='uFqGd'><dt id='uFqGd'><q id='uFqGd'><span id='uFqGd'><b id='uFqGd'><form id='uFqGd'><ins id='uFqGd'></ins><ul id='uFqGd'></ul><sub id='uFqGd'></sub></form><legend id='uFqGd'></legend><bdo id='uFqGd'><pre id='uFqGd'><center id='uFqGd'></center></pre></bdo></b><th id='uFqGd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='uFqGd'><tfoot id='uFqGd'></tfoot><dl id='uFqGd'><fieldset id='uFqGd'></fieldset></dl></div>
                            主站蜘蛛池模板: 91在线导航 | 欧美久久久久久久久 | 97日韩精品 | 成人av电影天堂 | 久久成人精品视频 | 色婷婷一区二区三区四区 | 欧美视频三区 | 9191在线观看 | 国产丝袜人妖cd露出 | 欧美亚洲另类在线 | 日韩国产欧美视频 | 91午夜在线 | 日韩激情一区 | 久久综合九色综合欧美狠狠 | 91在线精品视频 | 黑人巨大精品 | 久久久久久久香蕉 | 毛片在线视频 | 亚洲精品电影 | 日韩精品视频在线 | 日韩精品一区中文字幕 | 精品国产一区二区在线 | 视频一区二区在线观看 | 久久的色 | 国产成人免费在线观看 | 99re视频在线| 成人三级在线播放 | 完全免费在线视频 | 久久精品一区二区 | 伊人色综合久久天天五月婷 | 中文字幕成人av | 日韩一级二级片 | 欧美成人a∨高清免费观看 色999日韩 | 欧美 中文字幕 | 日本一区二区三区精品视频 | 欧美freesex黑人又粗又大 | 国产精品久久国产精品 | 亚洲成人国产精品 | 亚洲444eee在线观看 | 欧美一级黄色片在线观看 | 婷婷久久综合 |