I plan to make a long background process with Python, but I'm still not sure whether to use os.spawnleor thread. I just read about it, so I do not have much experience with either generation or flow. Is there any rule of thumb when to use which?
os.spawnle
Thanks heaps
Make sure you take Global Interpreter Lock . If a lengthy workflow has processor intensity, you should probably make it an independent process. If, on the other hand, it is going to spend a lot of time locking, then the GIL is actually not that big, and you should be fine to make it a thread.
In addition, if you do not need something special that os.spawnleprovides, consider using the multiprocessing package from the standard library. It provides an interface similar to the threading interface and is generally easier to use than spoofing with spawning and tracking processes manually.
, os.spawnle , , , . , - - , , - os.spawnle ( ); .
, , v., , , . , , /, , - , , , .
Source: https://habr.com/ru/post/1764784/More articles:Problem of choosing YUI3 in ie8 - css-selectorsScheme / Racket: Make an Evaluation Cycle - order-of-evaluationdoto and setting the property conditionally - clojureAttempting to perform a hierarchical update results in the error "Foreign key value cannot be inserted" - c #The problem of positioning a banner on top of my UITableView - objective-cFacebook fql case insensitive strpos - apiColor on VideoView - androidHow can I resize my view? - objective-cUsing mysql_insert_id to insert a lot of data - phpJQuery UI: button on dynamically created elements - javascriptAll Articles