共 1,395 篇文章
共 6,621 篇文章及评论
博客分类
Blog Roll
- Association for Computing Machinery TechNews (ACM)
- Go Parallel! (Dr. Dobbs)
- HPCwire (Tabor Communications, Inc.)
- insideHPC (John West)
- Joe Duffy's Weblog (Microsoft)
- Microsoft Parallel Programming Development Center (Microsoft Germany)
- MultiCoreInfo.com
- scalability.org (Scalable Informatics)
- Software Dev Blog (Intel Germany)
- Soft Talk Blog (Intel United Kingdom)
- The Moth (Microsoft)
Archives
帖子来自 zolovegd 
Java 线程同步示例
作者: zolovegd (1 篇文章) 日期: 六月 7, 2010 在 8:08 下午
评论 (6)
文章用实例代码展示了Java中多线程访问共享资源 时线程同步 的重要性。 分别通过在两个线程中同时访问(调用get_id*方法)经过同步处理(lock及Synchronized)的共享资源(tmp)及未经过同步处理的共享资源(tmp)来说明同步处理的的作用。 main中分两部分: 1)前半部分,non-synchronization部分用来测试没有做同步处理的代码段,运行结果应该是 After thread #1 call get_id(), id=1 After thread ...
