检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:崔政 段利国[1] CUI Zheng;DUAN Liguo(Taiyuan University of Technology,Taiyuan 030024,China;Pingshun County Power Supply Company,Shanxi Power Company,Changzhi 047400,China)
机构地区:[1]太原理工大学,山西太原030024 [2]山西省电力公司平顺县供电公司,山西长治047400
出 处:《软件工程》2018年第2期1-3,共3页Software Engineering
基 金:山西省重点资助教学改革项目(面向工程教育专业认证持续改进的课程设计实施方案研究;J2017017)
摘 要:Java多线程能够提高CPU利用效率,但也容易造成线程不安全、线程死锁等问题。本文详细介绍了Java线程各状态之间的关系及其切换,并用实例展示了使用同步锁synchronized保证同一时刻只有一个线程操作同一资源,使用wait()、notify()切换线程状态保证线程操作的前后顺序实现线程交互。理解Java线程各状态之间的关系及其切换,能帮助用户在使用Java多线程的场景有效避免多线程带来的不安全问题。Java multi-threading can improve CPU utilization,but it can also cause problems such as thread insecurity and thread deadlock.This paper introduces in detail the relationship between Java thread states and their transitions.Java synchronized ensures that only one thread operates the same resource at the same time,using wait()and notify()to switch the thread state to ensure that thread interactions are implemented in the context of thread operations.Understanding the relationship between the states of Java threads and their switching can help users avoid effectively the unsafe problems of multi-threading in Java multi-threaded scenarios.
关 键 词:多线程 synchronized 线程交互
分 类 号:TP312[自动化与计算机技术—计算机软件与理论]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.15