英文:
High CPU consumption
问题
我最近在处理一个多线程应用程序,其 CPU 消耗比正常情况高出一倍还多。
有 4 个变量应保持一致,因此我为它们使用了 'volatile' 关键字。
它们仅用于监控,不干扰应用程序流程。
最近我在我的应用程序上遇到了 CPU 消耗翻倍的情况,想知道是否可能是这种情况。
为了澄清,所有线程都是这些变量的读写者。
英文:
I’m dealing lately with more than doubled cpu consumption than normal in my multi-threaded app.
There are 4 variables that should be consistent and therefore i use ‘volatile’ key word for them.
They are just for monitoring and don’t interfere the app flow.
lately I encountered the doubled CPU consumption on my app and wondered if it’s may be the case.
for clarification all the threads are readers and writers of those variables.
专注分享java语言的经验与见解,让所有开发者获益!
评论