Code Monkey home page Code Monkey logo

javamultithreadspractice's Introduction

JavaMultiThreadsPractice

1. thread.usage.ThreadBasis

介绍 Thread.currentThread() 和 this(这个this等价于ThreadBasis的实例类,且其继承了Thread类) 的区别

2. thread.usage.ThreadSuspend

线程暂停与恢复的方法学习,以及其缺陷了解

3. Thread.yield() 方法

该方法使得当前线程放弃当前 CPU 资源,让给其他的任务去使用CPU。但有可能刚刚放弃,又获得 CPU 时间片了。

4. 线程优先级

线程优先级的继承性:在Java中,如在A线程中创建B线程,则B线程和A线程的优先级是一样的。

5. 守护线程(Daemon)

"守护"具有陪伴的含义。因此,当进程中的非守护线程都消失时,守护线程将会自动销毁。垃圾回收线程就是典型的守护线程

6. syn/usage/ClassLock1.java

该示例说明了:实例对象的锁和Class锁不是同一个。因此,不会得到同步的结果。

7. syn/usage/ClassLock2.java

该示例说明了:Class锁可以对该类的所有实例对象起作用

8. 对象不变,但是对象的属性被改变了,运行的结果还是同步的,这是因为 锁 是表示在一个实例对象的头字节中。

9. syn/usage/VolatileUse.java

验证 volatile 关键字在多线程中对可见性的影响

javamultithreadspractice's People

Contributors

rhmangmang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.