Java Concurrency (1)
Memory that can be shared betweenthreads is called shared memory or heap memory. The term variable as used inthis technical report refers to both fields and array elements. Variables thatare shared between threads are referred to as shared variables. All instance fields,static fields, and array elements are shared variables allocated in heapmemory. Local variables, formal method parameters, and exception-handlerparameters are never shared between threads and are not affected by the memorymodel.
The visibility of writes toshared variables can be problematic because the value of a shared variable maybe cached and not written to main memory immediately. Consequently, anotherthread may read a stale value of the variable.
A further concern is thatconcurrent executions of code are typically interleaved, and statements may bereordered b the compiler or runtime system to optimize performance. Thisresults in execution orders that are not immediately obvious when the sourcecode is examined. Failure to account for possible reordering is a common sourceof data races.
Volatile accesses do notguarantee the atomicity of composite operations such incrementing a variable.Consequently, volatile is not applicable in cases where the atomicity ofcomposite operations must be guaranteed.
A correctly synchronized programis one whose sequentially consistent executions do not have any data races.
Correct visibility guaranteesthat multiple threads accessing shared data can view each others’ results, butdoes not establish the order of when each thread reads or writes the data.Correct synchronization guarantees that threads access data in a proper order.
Java Concurrency (1)的更多相关文章
- Java Concurrency in Practice 读书笔记 第十章
		
粗略看完<Java Concurrency in Practice>这部书,确实是多线程/并发编程的一本好书.里面对各种并发的技术解释得比较透彻,虽然是面向Java的,但很多概念在其他语言 ...
 - Java Concurrency - 浅析 CountDownLatch 的用法
		
The Java concurrency API provides a class that allows one or more threads to wait until a set of ope ...
 - Java Concurrency - 浅析 CyclicBarrier 的用法
		
The Java concurrency API provides a synchronizing utility that allows the synchronization of two or ...
 - Java Concurrency - 浅析 Phaser 的用法
		
One of the most complex and powerful functionalities offered by the Java concurrency API is the abil ...
 - Java Concurrency - 线程执行器
		
Usually, when you develop a simple, concurrent-programming application in Java, you create some Runn ...
 - Java Concurrency - Callable & Future
		
One of the advantages of the Executor framework is that you can run concurrent tasks that return a r ...
 - 深入浅出 Java Concurrency (4): 原子操作 part 3 指令重排序与happens-before法则
		
转: http://www.blogjava.net/xylz/archive/2010/07/03/325168.html 在这个小结里面重点讨论原子操作的原理和设计思想. 由于在下一个章节中会谈到 ...
 - 《Java Concurrency》读书笔记,使用JDK并发包构建程序
		
1. java.util.concurrent概述 JDK5.0以后的版本都引入了高级并发特性,大多数的特性在java.util.concurrent包中,是专门用于多线并发编程的,充分利用了现代多处 ...
 - 深入浅出 Java Concurrency (15): 锁机制 part 10 锁的一些其它问题
		
主要谈谈锁的性能以及其它一些理论知识,内容主要的出处是<Java Concurrency in Practice>,结合自己的理解和实际应用对锁机制进行一个小小的总结. 首先需要强调的 ...
 - 《深入浅出 Java Concurrency》——原子操作
		
part1 从AtomicInteger開始 从相对简单的Atomic入手(java.util.concurrent是基于Queue的并发包.而Queue.非常多情况下使用到了Atomic操作.因此首 ...
 
随机推荐
- 使用JavaScriptSerializer进行序列化日期类型应该注意的问题
			
原文:使用JavaScriptSerializer进行序列化日期类型应该注意的问题 JavaScriptSerializer在序列化DateTime时,是用刻度来表示的,具体在Json体现为:\/Da ...
 - python学习笔记(五岁以下儿童)深深浅浅的副本复印件,文件和文件夹
			
python学习笔记(五岁以下儿童) 深拷贝-浅拷贝 浅拷贝就是对引用的拷贝(仅仅拷贝父对象) 深拷贝就是对对象的资源拷贝 普通的复制,仅仅是添加了一个指向同一个地址空间的"标签" ...
 - Codeforces 474A Keyboard (水
			
题目链接:点击打开链接 键盘移位了,问输出相应的字母 #include <cstdio> #include <cstring> char a[105]; char b[3][1 ...
 - JS实现倒计时网页自动跳转(如404页面经常使用到的)
			
在web前端设计中,我们经常会遇到需要实现页面倒计时跳转的功能,例如在404页面中也会经常使用到此功能,那么如何实现呢,其实实现方法很简单,实现代码如下:<title>JS倒计时网页自动跳 ...
 - 分布式消息系统kafka
			
kafka:一个分布式消息系统 1.背景 最近因为工作需要,调研了追求高吞吐的轻量级消息系统Kafka,打算替换掉线上运行的ActiveMQ,主要是因为明年的预算日流量有十亿,而ActiveMQ的分布 ...
 - Spring IOC 之ApplicationContext的其他功能
			
正如上面章节所介绍的那样, org.springframework.beans.factory 包提供了管理和操作beans的 基本功能. org.springframework.context包增加 ...
 - Huffman 压缩和解压缩java实现
			
附上完整的代码 http://download.csdn.net/download/u010485034/7847447 Huffman编码原理这里就不说了,是.这里来讲讲利用Huffman编码来进行 ...
 - 安装Windows2003操作系统 - 初学者系列 - 学习者系列文章
			
Windows 2003是一款经典的服务器操作系统.以前笔者工作的时候就是用的这款操作系统来进行编程的.下面就对该操作系统的安装进行介绍(部分步骤参见XP的安装http://www.cnblogs.c ...
 - javascript 正则介绍
			
1.正则直接量字符 \o NUL字符(\u000)\t 制表符\n 换行符(\u000A)\v 垂直制表符\f 换页符\xnn 由16进制nn指定的拉丁字符\uXXXX 由16进制XXXX指定的unc ...
 - phpcms 模板常用标签指南
			
1.关于SEO <meta name="keywords" content="{$SEO[keyword]}"/> <meta name=&q ...