Home  >  Article  >  Java  >  What types of java memory barriers are there?

What types of java memory barriers are there?

WBOY
WBOYforward
2023-05-11 23:19:04925browse

Modern operating systems are multi-processors, each processor has its own cache, and these caches do not exchange information with memory in real time. Therefore, a CPU's cached data may be inconsistent with another CPU's cached data. In this way, in multi-threaded development, abnormal behavior may occur. The bottom layer of the operating system provides some memory barriers to solve these problems.

1. LoadLoad barrier

For such a language Load1, LoadLoad2, Load1 is guaranteed to be read before the data read in Load2 and subsequent read operations is accessed. of data is read.

2. StoreStore Barrier

Regarding such language Store1, StoreStore, Store2, before Store2 and subsequent writing are executed, it is guaranteed that the writing operation of Store1 can see other processor.

3. LoadStore Barrier

For such a language Load1, LoadStore, Store2, before Store2 and subsequent writing operations are executed, it is guaranteed that the data read by Load1 is read. .

4. StoreLoad barrier

For such a language Store1, StoreLoad; Load2, before Load2 and all subsequent reading operations are implemented, ensure that the input of Store1 can be seen All processors. The cost is among the four barriers (flush buffer, clear invalidation queue). In most processor implementations, this barrier is a universal barrier that also functions as the other three memory barriers.

What are the basic data types of java

The basic data types of Java are divided into:

1. Integer type, used to represent the data type of integer.

2. Floating point type, a data type used to represent decimals.

3. Character type. The keyword of character type is "char".

4. Boolean type is the basic data type that represents logical values.

The above is the detailed content of What types of java memory barriers are there?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete