Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Web Developer Interviews:BootstrapFront End Web DeveloperHTML DeveloperHybrid Application DeveloperInternee PHP DeveloperJnr PHP/Codeigniter DeveloperJunior Developer PHPLaravel PHP DeveloperPython DeveloperRuby DeveloperTypographyWeb Developer & DesignerWeb Developer Cum SEO AnalystWeb Development NinjasWebsite DeveloperWordPress Themes Developer
Copyright © 2018. All Rights Reserved
Python Developer Interview Question:
Do you know how is Multithreading achieved in Python?
Submitted by: Muhammad☛ Python has a multi-threading package but if you want to multi-thread to speed your code up.
☛ Python has a construct called the Global Interpreter Lock (GIL). The GIL makes sure that only one of your ‘threads' can execute at any one time. A thread acquires the GIL, does a little work, then passes the GIL onto the next thread.
☛ This happens very quickly so to the human eye it may seem like your threads are executing in parallel, but they are really just taking turns using the same CPU core.
☛ All this GIL passing adds overhead to execution. This means that if you want to make your code run faster then using the threading package often isn't a good idea.
Submitted by: Muhammad
☛ Python has a construct called the Global Interpreter Lock (GIL). The GIL makes sure that only one of your ‘threads' can execute at any one time. A thread acquires the GIL, does a little work, then passes the GIL onto the next thread.
☛ This happens very quickly so to the human eye it may seem like your threads are executing in parallel, but they are really just taking turns using the same CPU core.
☛ All this GIL passing adds overhead to execution. This means that if you want to make your code run faster then using the threading package often isn't a good idea.
Submitted by: Muhammad
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.