码迷,mamicode.com
首页 >  
搜索关键字:atomic    ( 968个结果
为线程绑定CPU
// learn gcc atomic variable #define _GNU_SOURCE #include #include #include #include #include #include #include #include #define INC_TO 1000000 // every thread adds 1 million times int glob...
分类:编程语言   时间:2014-08-24 12:58:52    阅读次数:224
原子访问
线程同步一大部分与原子访问(atomic access)有关, 所谓原子访问, 指的是一个线程在访问某个资源的同时能够保证没有其他线程会在同一时刻访问同一资源.假设编译器将g_x递增的那行代码时,生成了下面的汇编代码:MOV EAX, [g_x] ; Move the value in g_x i....
分类:其他好文   时间:2014-08-20 16:15:12    阅读次数:164
Java线程(十):CAS
在Java并发包中有这样一个包,java.util.concurrent.atomic,该包是对Java部分数据类型的原子封装,在原有数据类型的基础上,提供了原子性的操作方法,保证了线程安全。下面以AtomicInteger来分析一下其实现过程。/** * Atomically increments by one the current value. * * @return the upda...
分类:编程语言   时间:2014-08-18 22:04:52    阅读次数:309
2.原子--深入浅出java原子操作
从相对简单的Atomic入手(java.util.concurrent是基于Queue的并发包,而Queue,很多情况下使用到了Atomic操作,因此首先从这里开始)。很多情况下我们只是需要一个简单的、高效的、线程安全的递增递减方案。注意,这里有三个条件:简单,意味着程序员尽可能少的操作底层或者实现起来要比较容易;高效意味着耗用资源要少,程序处理速度要快;线程安全也非常重要,这个在多线程下能保证数...
分类:编程语言   时间:2014-08-13 13:12:56    阅读次数:429
AtomicReference 和 volatile 的区别
首先volatile是java中关键字用于修饰变量,AtomicReference是并发包java.util.concurrent.atomic下的类。首先volatile作用,当一个变量被定义为volatile之后,看做“程度较轻的 synchronized”,具备两个特性:1.保证此变量对所有线...
分类:其他好文   时间:2014-08-13 10:11:35    阅读次数:255
JAVA对多线程的两个有用的辅助类(CountDownLatch和AtomicBoolean)
AtomicBoolean可以让一个线程等待另一个线程完成任务后再执行: A boolean value that may be updated atomically. See the java.util.concurrent.atomic package specification for description of the properties of atomic variables. A...
分类:编程语言   时间:2014-08-07 15:41:40    阅读次数:232
基于CAS线程安全的计算方法 java并发编程的艺术上的一个案例
package?thread; import?java.util.ArrayList; import?java.util.List; import?java.util.concurrent.atomic.AtomicInteger; /** ?*?@author??changxiangxiang ?*?@date?2014年8月6日?下午3:25:12 ?...
分类:编程语言   时间:2014-08-06 19:35:52    阅读次数:260
Storm中的LocalState 代码解析
官方的解释这个类为:/** * A simple, durable, atomic K/V database. *Very inefficient*, should only be * used for occasional reads/writes. Every read/write hits d...
分类:其他好文   时间:2014-08-05 22:23:00    阅读次数:321
A trip through the Graphics Pipeline 2011_13 Compute Shaders, UAV, atomic, structured buffer
Welcome back to what’s going to be the last “official” part of this series – I’ll do more GPU-related posts in the future, but this series is long eno...
分类:其他好文   时间:2014-08-05 02:56:18    阅读次数:427
IOS ARC 与 JAVA 垃圾回收,
相同:1,最后结果都是 释放不需要的空间,不同:assign(weak):直接赋值retain(strong):+1,引用一次 调用一次 retainrelease:-1copy:两个变量不共享内存,各有各的内存atomic:原子操作(多线程时使用)nonatomic:非原子操作@autorelea...
分类:移动开发   时间:2014-07-30 00:32:32    阅读次数:397
968条   上一页 1 ... 92 93 94 95 96 97 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!