[Chennaipy] Doubt on creating threads in python

Rohit Kottamasu rohit.topmaster at gmail.com
Tue May 29 02:07:11 EDT 2018


Thanks for replying. Are there any issues with using multiprocessing? And
do we need to give the argument for the number of threads in
multiprocessing.pool() function?



On Tue, May 29, 2018 at 11:32 AM, Yacko Abrams <yackoa at gmail.com> wrote:

> 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.topmaster at 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 at python.org
>> https://mail.python.org/mailman/listinfo/chennaipy
>>
>
> _______________________________________________
> Chennaipy mailing list
> Chennaipy at python.org
> https://mail.python.org/mailman/listinfo/chennaipy
>
>


-- 
Regards,
Rohit Kottamasu,
B.tech Computer Science,
Junior Year
Shiv Nadar University
Blog: https://inkmethoughts.blogspot.in/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chennaipy/attachments/20180529/065cb54f/attachment-0001.html>


More information about the Chennaipy mailing list