# Thread-per-Core Architecture: How Context Switching and Cache Thrashing Can Reduce Throughput

DevFeed: [Thread-per-Core Architecture: How Context Switching and Cache Thrashing Can Reduce Throughput](<https://devfeed.tech/articles/thread-per-core-architecture-why-extra-threads-eventually-destroy-throughput-39572.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/20-thread-per-core-architecture/>)

Author: hello@ankit-rana.com

Published: 2026-03-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [cpu](<https://devfeed.tech/topics/cpu.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [Hardware](<https://devfeed.tech/topics/hardware.md>), [Latency](<https://devfeed.tech/topics/latency.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [cache](<https://devfeed.tech/tags/cache.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [context-switch](<https://devfeed.tech/tags/context-switch.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [cpu-affinity](<https://devfeed.tech/tags/cpu-affinity.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [latency](<https://devfeed.tech/tags/latency.md>), [performance](<https://devfeed.tech/tags/performance.md>), [systems](<https://devfeed.tech/tags/systems.md>), [threading](<https://devfeed.tech/tags/threading.md>), [threads](<https://devfeed.tech/tags/threads.md>)

## AI overview

The article explains why adding threads beyond the number of physical CPU cores can reduce throughput and increase latency. It attributes the decline to scheduler context switching and cache thrashing, and recommends sizing worker pools to physical cores, using CPU affinity, and relying on non-blocking I/O.

## Source excerpt

A machine with 16 cores runs 16 streams of execution regardless of how many threads the runtime creates. Past that point the scheduler timeslices, and each context switch costs roughly 1 to 2 microseconds of bookkeeping plus the far larger hidden cost of cache thrashing as each thread evicts the previous one's working set. Size worker pools to physical cores, pin them, and use non-blocking I/O so a thread never parks a core waiting on the network.