Roadmap › How Computers Work — CPU, Memory, OS, Processes and Threads › Module: From Code to Execution
Lessons in this course (11)
11. Putting it together — what happens when your .NET API handles a request
IntermediateMediumLesson 11 of 11
- The network card receives packets → OS TCP/IP stack reassembles them → data lands in a socket buffer (kernel memory).
- Kestrel (ASP.NET Core server), waiting asynchronously on that socket, is woken by an I/O completion; a thread-pool thread picks up the work.
- Bytes are parsed into an
HttpContext(objects allocated on the heap); middleware and your controller run — CPU executes JIT-compiled code, using stack frames for each method call. - Your code awaits a SQL query → the thread returns to the pool (no thread blocked); the request is sent through another socket to SQL Server.
- SQL Server (its own process) checks its buffer pool in RAM; if the pages aren't cached it reads them from disk (slow), executes the plan, returns rows.
- The continuation runs on a pool thread, serialises JSON, writes to the socket; the OS sends packets back.
- Objects of the request become unreachable → collected later by the GC (most die in generation 0, very cheaply).
Every performance topic on DevLadder maps to one of these steps: CPU (algorithms), memory (allocations, GC), I/O (disk, database), network (latency, payload size), and threads (async, locking).