首页 \ 问答 \ Java并发可见性(Java concurrency visibility)

Java并发可见性(Java concurrency visibility)

我对java中的可见性有疑问。 只有当我们至少有两个线程运行时,才能显示可见性,这些线程至少运行2个cpu核心。 那对吗? 每个核心都可以在其重排器和缓存内存中缓存变量,因为可见性问题可能会出现。 但是,如果我们有n个线程并且它们都运行在一个cpu核心(我们不能确定它们只能在1个核心上运行,但假设有可能实现这一点),那么比没有办法有内存可见性吗? 或者这不对? 提前致谢。


I have a question about visibility in java. The visibility can only appear if we have at least two threads, which run on at least 2 cpu cores . It that right ? Every core can cache variables in its regiresters and cache memory and because of that visibility problems can appear. But what if we have n threads and they all run in one cpu core (of couse, we can not be sure that they will run on only 1 core, but assume that it is possible to achieve that), than there is no way to have memory visibility ? Or this is not right ? Thanks in advance.


原文:https://stackoverflow.com/questions/31709637
更新时间:2023-08-20 08:08

最满意答案

简答:

是 - XML区分大小写。

更长的答案:

它被广泛接受为区分大小写,但是如果您想更灵活地接受,请查看下面的问题,其中讨论了不区分大小写的枚举:

简单类型字符串的XML模式大小写不敏感枚举


Short Answer:

Yes - XML is case sensitive.

Longer Answer:

It is widely accepted as case sensitive, however if you want to accept more flexibly, take a look at the question below, which discusses having case-insensitive enumerations:

XML Schema Case Insensitive Enumeration of Simple Type String

相关问答

更多