Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
netikras1142273dProcesses? Why not pthreads?
netikras1142273d@SoulSkrix it is usually a better choice to use threads over subprocesses in general. Only use subprocesses where you are sure you need subprocesses and you know why threads dont work for your case. In threads:
- you are very lightweight on memory: you are reusing parent processes' heap and only spawn your own stack;
- you reuse libs, configs, etc loaded in memory
- you can spawn *much* faster
- impossible to lose control of threads; subprocesses can be detached from parent, they can block parebt from exitting, they can remain running after parent's death, etc
- *much* easier to synchronize actions, distribute jobs, reuse children inf. amount of times; this is much harder w/ subprocesses
imo threads should always be considered first and only in cases they do not fit your bill subprocesses could be used
SoulSkrix518773d@netikras Thanks for all the info, I haven't really ever had to write performant code outside of using appropriate algorithms and data structures (just at University). I wrote some threaded code in C for a robotics project but that's about it; I hope when I'm not trying to finish my exam/course work period to educate myself more on threading/multiprocessing.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job