Multiple threads and CPU cache

前端 未结 4 2076
清歌不尽
清歌不尽 2020-12-02 18:05

I am implementing an image filtering operation in C using multiple threads and making it as optimized as possible. I have one question though: If a memory is accessed by thr

4条回答
  •  醉梦人生
    2020-12-02 18:30

    Intel documentation

    Intel publishes per-generation datasheets which may contain this kind of information.

    For example, for the processor i5-3210M which I had on my older computer, I look up the 3rd generation - Datasheet Volume 1 3.3 "Intel Hyper-Threading Technology (Intel HT Technology)" says:

    The processor supports Intel Hyper-Threading Technology (Intel HT Technology) that allows an execution core to function as two logical processors. While some execution resources such as caches, execution units, and buses are shared, each logical processor has its own architectural state with its own set of general-purpose registers and control registers.

    which confirms that caches are shared in a given hyperthread for that generation of CPUs.

    See also:

    • similar question for cache sharing across cores: How are cache memories shared in multicore Intel CPUs?
    • further analysis of threads vs cores: https://superuser.com/questions/133082/what-is-the-difference-between-hyper-threading-and-multiple-cores/995858#995858
    • the architecture spec itself also has a section about the sharing of certain resources that must be valid across all implementations, although it does not mention caches: What does multicore assembly language look like?

提交回复
热议问题