您是否期望未来的CPU代不会在缓存方面保持一致? [英] Do you expect that future CPU generations are not cache coherent?

查看:86
本文介绍了您是否期望未来的CPU代不会在缓存方面保持一致?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个程序,我发现假定隐式缓存一致性可以使设计容易得多.例如,我的单个编写器(总是同一线程),多个读取器(总是其他线程)方案没有使用任何互斥体.

对于当前的Intel CPU而言这不是问题.但是我希望该程序至少在未来十年内(对于软件来说是很短的时间)产生收入,所以我想知道您是否认为这对于将来的CPU架构可能是个问题.

解决方案

我怀疑将来的CPU世代仍会为您处理缓存一致性.没有这一点,大多数主流编程方法将失败.我怀疑在未来十年内将广泛使用的任何CPU体系结构都将使当前的编程模型无效-可以扩展它,但是很难删除如此广泛假设的东西.

话虽这么说,以隐式缓存一致性为前提的编程并不总是一个好主意.如果您有意尝试隔离数据,则虚假共享可以解决很多问题.正确处理此问题可能会导致当代CPU的性能大幅提升(而不会造成巨大的性能损失).当然,这是设计中的更多工作,但这通常是必需的.

I'm designing a program and i found that assuming implicit cache coherency make the design much much easier. For example my single writer (always the same thread) multiple reader (always other threads) scenarios are not using any mutexes.

It's not a problem for current Intel CPU's. But i want this program to generate income for at least the next ten years (a short time for software) so i wonder if you think this could be a problem for future cpu architectures.

解决方案

I suspect that future CPU generations will still handle cache coherence for you. Without this, most mainstream programming methodologies would fail. I doubt any CPU architecture that will be used widely in the next ten years will invalidate the current programming model - it may extend it, but it's difficult to drop something so widely assumed.

That being said, programming with the assumption of implicit cache coherency is not always a good idea. There are many issues with false sharing that can easily be avoided if you purposefully try to isolate your data. Handling this properly can lead to huge performance boosts (rather, a lack of huge performance losses) on current generation CPUs. Granted, it's more work in the design, but it is often required.

这篇关于您是否期望未来的CPU代不会在缓存方面保持一致?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆