In C#, what does the async and await keyword pair actually do, and why is awaiting an I/O operation different from just blocking the thread?

technical-conceptual · Intern level · software-engineering

What the interviewer is really asking

Probes whether the candidate understands async/await as compiler-generated continuations that free the thread during I/O, rather than believing await spins up a new thread or runs code in parallel.

What to say

What to avoid

Example answers

Strong: async and await let the compiler turn the method into a state machine. When I await an I/O call, the method sets up the rest of itself as a continuation and hands the thread back, so the thread isn't stuck waiting on the network or disk. When the operation finishes, the method picks up where it left off. Blocking would keep that thread parked the whole time, so under load you'd run out of threads, whereas async keeps them free to handle other work.

Weak: async and await run your method on a background thread so it doesn't freeze the program. The await keyword waits for that thread to finish in parallel, which is why async code is faster than normal code.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.