Skills101
← All practice quizzes

Quiz: Threads, Processes and the GIL

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Run tasks at the same time with threading, ThreadPoolExecutor, multiprocessing and asyncio. Learn what the GIL is, why threads help with waiting but not with heavy calculation, and how a Lock prevents race conditions.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does the GIL do in CPython?

  2. Question 2

    A program downloads 100 web pages. Which tool gives the easiest big speed-up?

  3. Question 3

    A program does heavy maths on large lists in pure Python. Which tool can use all CPU cores?

  4. Question 4

    What is a race condition?

  5. Question 5

    What does this print?

    from concurrent.futures import ThreadPoolExecutor
    import time
    
    def work(n):
        time.sleep(0.05 * (3 - n))
        return n * 10
    
    with ThreadPoolExecutor() as pool:
        print(list(pool.map(work, [0, 1, 2])))
    
🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →