diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2024-03-06 14:29:42 -0500 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2024-03-06 14:29:42 -0500 |
| commit | 1ed6bfae3e2687845bb28205f2ffb6fba0a2afb9 (patch) | |
| tree | 1423530877d67881a2f5ec2688f9a8c3c49d66df /docs/dev/batch.md | |
| parent | e093c21ed880ac3eb72119be15093ee04f8ce299 (diff) | |
update batch processing docs with different set_worker_thread_count
Diffstat (limited to 'docs/dev/batch.md')
| -rw-r--r-- | docs/dev/batch.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/dev/batch.md b/docs/dev/batch.md index 2e6b18cf..9795e5e8 100644 --- a/docs/dev/batch.md +++ b/docs/dev/batch.md @@ -134,7 +134,7 @@ Another option is to use a tool like GNU parallel to simply launch multiple sepa As mentioned above, Python's [Multiprocessing](https://docs.python.org/3/library/multiprocessing.html) library is NOT safe for use with multithreaded libraries. That said, you can use it with the following conditions: - Make sure [to enable](https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods) `spawn` or `forkserver` mode as the default `fork` method **WILL CRASH OR HANG**. -- Make sure to [set the thread-count](https://api.binary.ninja/binaryninja.mainthread-module.html#binaryninja.mainthread.set_worker_thread_count) appropriately. If you're going to spin up multiple processes, you don't want each process also spinning up CORE_COUNT - 1 threads (which is the default BN behavior) +- Make sure to [set the thread-count](https://api.binary.ninja/binaryninja.mainthread-module.html#binaryninja.mainthread.set_worker_thread_count) appropriately. If you're going to spin up multiple processes, you don't want each process also spinning up CORE_COUNT - 1 threads (which is the default BN behavior). We recommend using a value of at least two. Here's a short example showing how that might work: @@ -145,7 +145,7 @@ import glob from multiprocessing import Pool, cpu_count, set_start_method def spawn(filename): - binaryninja.set_worker_thread_count(1) + binaryninja.set_worker_thread_count(2) with binaryninja.load(filename, update_analysis=False) as bv: print(f"Binary {bv.file.filename} has {len(list(bv.functions))} functions.") |
