Skip to content

Instantly share code, notes, and snippets.

@simonwoo
Last active February 10, 2016 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonwoo/ca67eacd3e3445476892 to your computer and use it in GitHub Desktop.
Save simonwoo/ca67eacd3e3445476892 to your computer and use it in GitHub Desktop.

Java线程与操作系统中轻量级进程是一一对应的关系。 为了实现并发,可以创建多个线程,如何管理这些线程,可使用线程池的方式。 当多个线程对同一资源进行访问时,可能会出现不一致的情况, 为了防止这种情况的发生可以使用锁的方式,或者当该资源是原子类时,也能保证同一时刻只有一个线程访问该资源。

Java内存模型是围绕着并发过程中如何处理原子性、可见性、有序性这三个特征来建立的:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment