Hi Rohit, Threads would be slightly slower than multiprocessing. You might have issues with sharing variables or GIL. Hence usually multiprocessing is preferred over threads in python.
So to answer your question, you can use the second method login_threadpool() shown in the code shared, which uses multiprocessing. (That being said the first method that uses threads could work just fine for most purposes) Regards, Yacko On Tue, 29 May 2018, 11:23 am Rohit Kottamasu, <rohit.topmas...@gmail.com> wrote: > Hey, > I have written a login script in python for logging into a remote SSH. > That is running successfully. I wrote the code in two ways using thread and > threadpool. But, I'm unable to understand the exact difference of these two > executions. I also want to know which function is more preferred. > (login_thread or login_threadpool). What are the advantages and the > drawbacks? > > Thanks > -- > Regards, > Rohit Kottamasu, > B.tech Computer Science, > Junior Year > Shiv Nadar University > Blog: https://inkmethoughts.blogspot.in/ > _______________________________________________ > Chennaipy mailing list > Chennaipy@python.org > https://mail.python.org/mailman/listinfo/chennaipy >
_______________________________________________ Chennaipy mailing list Chennaipy@python.org https://mail.python.org/mailman/listinfo/chennaipy