« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 1159 ms

GitHub - hellojavaio/java-concurrent-programming-explain

Source: https://github.com/hellojavaio/java-concurrent-programming-explain

Repository navigation

java-concurrent-programming-explain
Public

About

No description or website provided.

Topics

concurrent concurrent-programming explain java

Resources

Readme License Activity Custom properties

Stars

0 stars

Watchers

1 watching

Forks

0 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


11 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.idea .idea    
module1 module1    
.gitignore .gitignore    
AQS_doc.md AQS_doc.md    
LICENSE.png LICENSE.png    
README.md README.md    
java-concurrent-programming-explain.iml java-concurrent-programming-explain.iml    

Repository files navigation

java-concurrent-programming-explain

Demo

Thread.join()

CountDownLatch

  • 所有子线程完成了阻塞 count 计数之后就开始调用主线程的 latch.await() 之后的方法
  • CountDownLatchTest

CyclicBarrier

  • 子线程完成等待之后,调用指定的线程执行,示例 ,一个类完成上述功能,相关示例 .

CountDownLatch & CyclicBarrier

  • CountDownLatch 和 CyclicBarrier 都能够实现线程之间的等待,只不过它们侧重点不同:

  • CountDownLatch 一般用于某个线程A等待若干个其他线程执行完任务之后,它才执行;

  • 而 CyclicBarrier 一般用于一组线程互相等待至某个状态,然后这一组线程再同时执行;

  • 另外,CountDownLatch 是不能够重用的,而 CyclicBarrier 是可以重用的。

Semaphore

  • Semaphore 其实和锁有点类似,它一般用于控制对某组资源的访问权限。
  • 初始化时设置大小, 线程每次获取和存放回去都有数量可选。

ForkJoin

  • 讲任务分割最后汇集结果,类似排序中的归并

資料

LICENSE

CC-BY-SA-3.0

About

No description or website provided.

Topics

concurrent concurrent-programming explain java

Resources

Readme License Activity Custom properties

Stars

0 stars

Watchers

1 watching

Forks

0 forks Report repository

Releases

Packages

Contributors

Languages