📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

377 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Threads

Thread, lifecycle, foreground and background threads, the ThreadPool, worker and I/O completion threads, thread-local storage.

  1. What is a Thread in .NET, and when would you still create one directly instead of using Task.Run or the ThreadPool?

    System.Threading.Thread: what it maps to, its cost, its API surface in .NET 10 and the narrow cases where a dedicated thread is the right choice.

    Mid-Level Theory Threads Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  2. Walk me through the lifecycle of a .NET thread. What states can it be in, and what happens on each transition?

    ThreadState values, legal transitions, Join, Sleep, Interrupt and how a thread ends, including unhandled exceptions.

    Mid-Level Theory Threads Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  3. What is the difference between a foreground thread and a background thread in .NET, and why does it matter at shutdown?

    IsBackground, which threads are background by default, process exit rules and graceful shutdown in hosted apps.

    Junior Theory Threads Β· πŸ”— 2 follow-ups
  4. How does the .NET ThreadPool work, and how does it decide how many threads to run?

    Global and local queues, work stealing, minimum threads, hill climbing, starvation injection and the metrics to watch in .NET 10.

    Senior Theory Threads Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. What is the difference between ThreadPool worker threads and I/O completion threads, and does it matter on Linux?

    Worker versus completion-port threads, IOCP on Windows, epoll on Linux, how async I/O completes without a thread waiting, and what GetAvailableThreads really reports.

    Senior Theory Threads Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  6. How does thread-local storage work in .NET? Compare [ThreadStatic], ThreadLocal of T and AsyncLocal of T.

    Per-thread state with ThreadStatic and ThreadLocal, why it breaks across await, and how AsyncLocal flows with ExecutionContext.

    Senior Theory Threads Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me