nextRound
TechnologiesCoding ProblemsBookmarksLearning PathsLogin
nextRound
TechnologiesCoding ProblemsBookmarksLearning PathsLogin
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Mock Interviews
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

Questions
6 of 9
1How does Python's asyncio event loop achieve concurrency without using multiple threads?
2What is the difference between threading, multiprocessing, and asyncio, and when would you choose each?
3What causes a deadlock in multithreaded code, and how can it be avoided?
4Why does multiprocessing avoid the GIL problem, and what overhead does it introduce instead?
5Given the GIL, why can multithreading still improve performance for I/O-bound tasks but not CPU-bound tasks?
6What is the difference between async def and a regular function, and what does await actually do?
7How would you run CPU-bound work alongside an asyncio application without blocking the event loop?
8What is a race condition, and how would you prevent one using threading.Lock?
9What is the Global Interpreter Lock (GIL), and why does it exist in CPython?
PythonPython
Basics
Control Flow and Functions
Data Structures
Comprehensions & Functional Programming
Iterators, Generators & Decorators
Object-Oriented Programming
Exception Handling & Debugging
Concurrency & Parallelism
Performance & Optimization
Testing
Security
Modules, Packaging & Environment
Type Hinting & Modern Python
System Design & Architecture with Python
Best Practices & Design Patterns
Edge Cases & Tricky Interview Questions
06 / 09

What is the difference between async def and a regular function, and what does await actually do?

Difficulty: 6/10
Async Def, Await, Coroutines

async def returns a coroutine; await suspends it until the awaited future completes

Calling an async def function does not run the body; it returns a coroutine object. The body runs when the coroutine is awaited or scheduled on an event loop. await takes an awaitable, such as a coroutine, a Task, or a Future, and suspends the current coroutine until that awaitable completes, then resumes it with the result or raises its exception. Suspension only happens if the awaited object is not already done; if it is done, await returns immediately without yielding to the loop. This is why await is a suspension point, not a thread switch: control returns to the event loop, which then runs other ready tasks. You can only use await inside async def, and async generators use async for and async with instead.

  1. 1

    Regular def: runs immediately and returns the result. async def: returns a coroutine, runs when awaited or scheduled.

  2. 2

    await obj: suspend until obj completes. Works with coroutines, Futures, and any object implementing await.

  3. 3

    asyncio.create_task schedules a coroutine concurrently; await runs it as part of the current flow.

  4. 4

    asyncio.gather runs awaitables concurrently and returns results in order.

  5. 5

    Trade-off: async functions compose only with async callers. Mixing sync code requires explicit offloading via to_thread or executors.

  6. 6

    Common mistake: calling an async function without await and getting a coroutine object that never runs, plus a RuntimeWarning.

  7. 7

    Common mistake: assuming await creates concurrency. Awaiting sequentially runs tasks one at a time; you need create_task or gather.

  8. 8

    Version note: the RuntimeWarning for never-awaited coroutines has been in 3.x for years. asyncio.to_thread was added in 3.9.

Scenario Questions

0-2 years experience

  1. 1You call an async function and print the result. Why do you see a coroutine object instead of the value?
  2. 2Where can you use await?

2-5 years experience

  1. 1You await three coroutines in a row and see no concurrency. What do you change?
  2. 2You need to run a coroutine in the background and not block the current flow. What do you use?

5-8 years experience

  1. 1You need to cancel a long-running coroutine when the client disconnects. How do you structure this with tasks and cancellation?
  2. 2You have a coroutine that returns a value and one that raises. How do you handle both with gather and return_exceptions?

8+ years experience

  1. 1Design a coroutine-based pipeline that supports back-pressure, cancellation, and per-task timeouts with predictable resource usage.
  2. 2Explain how Task, Future, and coroutine differ internally, and how exceptions propagate through await, gather, and TaskGroup.

Follow-up Questions

  • What is the difference between awaiting two coroutines sequentially versus gathering them?
  • How does an async generator differ from a regular generator?
Sharethis question

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.