Python Developer Interview Question

When would you reach for threads, processes, or asyncio?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Use asyncio for high volume I/O where you want thousands of concurrent waits in one thread, threads for I/O work that only has blocking libraries available, and processes for CPU bound work that needs real cores. The deciding questions are whether the work waits or computes, and whether the libraries you depend on offer an async interface.

Why interviewers ask this

Concurrency choices are where junior engineers burn weeks. The interviewer wants a decision rule rather than a preference, plus awareness of the costs each model carries: process memory and serialization overhead, thread safety and context switching, and the fact that one careless blocking call stalls an entire event loop. Mentioning that these compose, such as a thread pool executor inside asyncio, shows practical experience.

How to structure your answer

  • Split the problem into waiting versus computing first.
  • Match each category to a concurrency model.
  • Name one cost of each choice.
  • Give a concrete example from your own work.

Example answer

Spoken example, first person

My first question is always whether the work waits or whether it computes, because that answer picks the tool. Waiting on network or disk means asyncio if the client libraries support it, since an event loop will happily hold ten thousand open sockets on one core and the memory per task is tiny. If the only driver available is blocking, I use a thread pool, because a thread parked in a socket read releases the lock and costs almost nothing. Computing means processes, or dropping into a native library that releases the lock itself. On a service I worked on we had both in one request path: an async handler fanning out to six internal APIs with gather, and a run_in_executor call wrapping an old blocking SDK we could not replace. That combination is worth naming in an interview because most real systems are mixed. The mistake I watch for is someone putting a heavy pandas transform inside a coroutine, because the loop then stops serving everything else while it runs.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What breaks first when you scale a thread pool?
  • How do you share state between processes?
  • Where does a task group fit into that picture?

Related python developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot