<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>深蓝的blog &#187; volatile</title>
	<atom:link href="http://www.lanxinbase.com/?feed=rss2&#038;tag=volatile" rel="self" type="application/rss+xml" />
	<link>http://www.lanxinbase.com</link>
	<description>记录日常生活</description>
	<lastBuildDate>Sat, 07 Feb 2026 10:59:52 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.3</generator>
	<item>
		<title>Java语言Volatile原理</title>
		<link>http://www.lanxinbase.com/?p=2146</link>
		<comments>http://www.lanxinbase.com/?p=2146#comments</comments>
		<pubDate>Thu, 28 Mar 2019 02:24:57 +0000</pubDate>
		<dc:creator><![CDATA[Alan]]></dc:creator>
				<category><![CDATA[1.服务端语言]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[volatile]]></category>

		<guid isPermaLink="false">http://www.lanxinbase.com/?p=2146</guid>
		<description><![CDATA[Java语言提供了一种稍弱的同步机制，即volatile变量，用来确保将变量的更新操作通知到其他线程。当把变量 [&#8230;]]]></description>
		<wfw:commentRss>http://www.lanxinbase.com/?feed=rss2&#038;p=2146</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java并发编程：volatile关键字解析</title>
		<link>http://www.lanxinbase.com/?p=1899</link>
		<comments>http://www.lanxinbase.com/?p=1899#comments</comments>
		<pubDate>Wed, 11 Jul 2018 07:40:55 +0000</pubDate>
		<dc:creator><![CDATA[Alan]]></dc:creator>
				<category><![CDATA[1.服务端语言]]></category>
		<category><![CDATA[volatile]]></category>

		<guid isPermaLink="false">http://www.lanxinbase.com/?p=1899</guid>
		<description><![CDATA[volatile这个关键字可能很多朋友都听说过，或许也都用过。在Java 5之前，它是一个备受争议的关键字，因为在程序中使用它往往会导致出人意料的结果。在Java 5之后，volatile关键字才得以重获生机。

volatile关键字虽然从字面上理解起来比较简单，但是要用好不是一件容易的事情。由于volatile关键字是与Java的内存模型有关的，因此在讲述volatile关键之前，我们先来了解一下与内存模型相关的概念和知识，然后分析了volatile关键字的实现原理，最后给出了几个使用volatile关键字的场景。

以下是本文的目录大纲：

内存模型的相关概念
并发编程中的三个概念
Java内存模型
深入剖析volatile关键字
使用volatile关键字的场景
一.内存模型的相关概念

大家都知道，计算机在执行程序时，每条指令都是在CPU中执行的，而执行指令过程中，势必涉及到数据的读取和写入。由于程序运行过程中的临时数据是存放在主存（物理内存）当中的，这时就存在一个问题，由于CPU执行速度很快，而从内存读取数据和向内存写入数据的过程跟CPU执行指令的速度比起来要慢的多，因此如果任何时候对数据的操作都要通过和内存的交互来进行，会大大降低指令执行的速度。因此在CPU里面就有了高速缓存。]]></description>
		<wfw:commentRss>http://www.lanxinbase.com/?feed=rss2&#038;p=1899</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
