Multiple threads and CPU cache

前端 未结 4 2103
清歌不尽
清歌不尽 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:22

    I might be mistaking, but whether the core's cache is shared or not depends on the implementation of the CPU. You'd have to look up the technical sheets on the manufacturer's page to check whether each core in your CPU has their own cache or whether the cache was shared.

    I was working on image manipulation as well for a security company and sometimes we got corrupted images after running batch operations on threads. After long investigations we came to the conclusion that the cache was shared between CPU Core's and that in rare cases the data was beeing overwritten or replaced with incorrect data.

    Whether this is something to keep into account or is rather a rare event I cannot anwser.

提交回复
热议问题