0
点赞
收藏
分享

微信扫一扫

java多线程读书笔记1 多线程中的基本概念词

最后的执着 2022-04-02 阅读 57
java

以上内容均来自于本书和我的自己理解的总结

Java Threads, 3rd Edition [Book] (oreilly.com)

Atomic variables

A set of classes that provide threadsafe operations without synchronization

原子变量

提供线程安全操作而无需同步的一组类

我的理解:利用这种原子变量起到定义线程安全的变量,而且不用额外编写同步代码

Minimal synchronization utilities

Java's new atomic classes provide a means by which developers can, when necessary, write applications that avoid synchronization. This can lead to programs that are highly concurrent.

 

———————————————————————— 

Explicit locks

Synchronization locks that can be acquired and released programmatically

显式锁(精确锁)

可以通过编程方式获取和释放的同步锁

 ———————————————————————— 

Condition variables

Variables that can be the subject of a targeted notification when certain conditions exist

条件变量

存在特定条件时,可能成为目标通知主题的变量

 

 The Java language has always had the capability to perform data synchronization and thread notification. However, implementation of these features was somewhat limited; you could, for example, synchronize blocks of code or entire methods but synchronizing across methods and classes required extra programming. In J2SE 5.0, explicit locks and condition variables allow you more flexibility when using these features.

Java语言一直能够执行数据同步和线程通知。然而,这些功能的实现有些有限;例如,可以同步代码块或同步整个方法,但跨整个方法和类同步需要额外编程。在J2SE 5.0中,显式锁(精确锁)和条件变量允许您在使用这些特性时具有更大的灵活性。 

————————————————————————

Queues

Collection classes that are thread-aware

队列

线程能够感知并使用的一种集合类

————————————————————————————

Synchronization primitives

New classes that perform complex types of synchronization

同步关键字:

 

同步原语

执行复杂类型同步的新功能类

 ————————————————————————————

Thread pools

Classes that can manage a pool of threads to run certain tasks

 

线程池

可以管理一池子线程去执行特定任务们的一种类

  ————————————————————————————

 

Thread schedulers

Classes that can execute tasks at a particular point in time

 

线程调度程序

可以在特定时间点执行任务的类

Important thread utilities

At some point in time, virtually all developers who write threaded programs will need to use basic thread utilities such as a pool or a scheduler; many of them will also need to use advanced synchronization primitives. A recognition of this fact is one thing that drove JSR-166—it was certainly possible in previous versions of Java to develop your own thread pools and schedulers. But given the importance of threading in the Java platform, adding these basic utilities greatly increases programmer productivity.

重要的线程实用程序(线程池和时间调度器没有必要自己编写,因为已经有现成的实用程序了)

在某个时候,几乎所有编写线程程序的开发人员都需要使用基本的线程实用程序,比如线程池或调度器;他们中的许多人还需要使用高级同步原语。认识到这一事实是促使JSR-166的原因之一——在Java的早期版本中,开发自己的线程池和调度程序当然是可能的。但是考虑到线程在Java平台中的重要性,添加这些基本实用程序可以极大地提高程序员的工作效率(已经有现成的了,别自己开发,找现成类库即可搞定)。

 

 

举报

相关推荐

0 条评论