易截截图软件、单文件、免安装、纯绿色、仅160KB

Java theory and practice

1. Multiply-Thread
Locks offer two primary features: mutual exclusion and visibility. Mutual exclusion means only one thread at a time may hold a given lock, so only one thread at a time will be using the shared data. Visibility is to ensure that changes made to shared data prior to releasing a lock are made visible to another thread that subsequently acquires that lock
you must ensure that your threads spend most of their time actually doing work, rather than waiting for more work to do, or waiting for locks on shared data structures
An algorithm is said to be wait-free if every thread will continue to make progress in the face of 
arbitrary delay (or even failure) of other threads. By contrast, a lock-free algorithm requires only that some thread always make progress. (Another way of defining wait-free is that each thread is guaranteed to correctly compute its operations in a bounded number of its own steps, regardless of the actions, timing, interleaving, or speed of the other threads. This bound may be a function of the number of threads in the system; for example, if ten threads each execute the CasCounter.increment() operation once, in the worst case each thread will have to retry at most nine times before the increment is complete.)
A common technique for tuning the scalability of a concurrent application that is experiencing contention is to reduce the granularity of the lock objects used, in the hopes that more lock acquisitions will go from contended to un-contended. The conversion from locking to atomic variables achieves the same end -- by switching to a finer-grained coordination mechanism, fewer operations become contended, improving throughput. 
1.0 Thread
1.1 synchronized/wait.notify
1.2 volatile
Due to the semantics of some programming languages, the code generated by the compiler is allowed to update the shared variable to point to a partially constructed object before A has fini


相关文档:

java 解决约瑟夫问题

package Pack;
import java.text.*;
import java.util.*;
import java.text.DecimalFormat;
import java.util.*;
public class Test {
/**
* @param args
*/
public static void main(String args[]) {

yuesef(50,3);
}
public static void yuesef(int n, int m) {
ArrayList<Integer ......

JAVA编程规范

命名规范
 
定义这个规范的目的是让项目中所有的文档都看起来像一个人写的,增加可读性,减少项目组中因为换人而带来的损失。(这些规范并不是一定要绝对遵守,但是一定要让程序有良好的可读性)
 
Package 的命名
Package 的名字应该都是由一个小写单词组成。
 
Class 的命名
Class 的名字必须 ......

传智播客java培训 java基础之JDBC

昨天睡得太晚,严重影响了今天的学习,实在是得不偿失!
关于java的基础知识还有二十天就要结束了,现在我们已经开始做一些小的练习,发现自己的思路有时候跟不上,
真上火!
学而实习之,不能丢了西瓜捡芝麻,上课要紧跟老师节奏,不能自己做自己的,老师讲老师的!
调整心态,用好的学习方法方能事半功倍;
JDBC(Ja ......

Java 中的IO






<!--
@page { margin: 0.79in }
P { margin-bottom: 0.08in }
-->

Java中的
io

我对流的理解是:源到目的地的轨迹,所以流的一端是数据源(输入流)或者接收器(输出流),另一端是
io中的某个类;这里说明下,
Scanne ......

Java编程实践应用:J2EE架构的6个最佳实践


2008-04-26 09:25 作者:superman 来源:赛迪网
[摘要] 首先,本文的目标读者是正在从事技术工作的架构师。避免讲述一些陈腐的最佳实践,例如"日常构建(build daily)"、"测试一切(test everything)"和"经常集成( integrate often)。 任何具有称职架构师的项目都有分工明确的、定义良好的团队结构。他们还为进行编 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号