JAVA多线程同步机制及其应用.doc

  1. 1、本文档共21页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
JAVA多线程同步机制及其应用

目 录 JAVA多线程同步机制及其应用 1 1 前言 2 1.1 线程 2 1.2 同步机制 2 2 JAVA多线程 3 2.1 线程的创建 3 2.1.1 继承Thread类实现多线程 3 2.1.2 实现Runnable接口实现多线程 3 2.2 线程管理 4 2.2.1 线程周期 4 2.2.2 线程控制 4 2.2.3 线程的调度 5 3 多线程同步机制 6 3.1 多线程的问题 6 3.2 JAVA同步机制 8 3.2.1 synchronized关键字 8 3.2.2 synchronized方法 10 3.2.3 同步机制的问题 11 3.2.4 wait()/notify()方法 13 4 交通灯管理系统 14 4.1 设计方法 14 4.2 具体实现 15 4.3 主要功能及类介绍 15 5 结束语 16 致 谢 16 参考文献 17 附 录 18 JAVA多线程同步机制及其应用 摘要 介绍了JAVA线程的概念,分析了多线程和同步机制。给出了创建线程的两种方法:继承Thread类和实现runnable接口及其基本格式。详细分析了线程周期中的五种状态;线程的控制的几种基本的方法start(),stop(),sleep()等;线程的调度、优先级。结合具体实例指出了多线程存在的一些问题,探讨了实现JAVA同步机制的两种方法:synchronized关键字和synchronzied方法。给出了解决假同步和死锁的方法。介绍了多线程间通信的一种方法:wait()/notify()方法,以及该方法的主要格式,应用范围,和应用要注意的事项。通过一个具体的综合应用的实例,说明多线程在实际中的应用。 关键词 多线程;同步机制;线程;线程控制;死锁 JAVA multithreading synchronized mechanism and applications Abstract Introduced the concept of the JAVA Thread, analyze a multi-threading and the synchronized mechanism. Give establish the Thread of two kinds of methods inherit Thread and realize runnable interface and its basic format. To five kinds of state in the Thread, a few basic method of the control of the Thread, start(), stop() sleep() etc., the Thread attemper, PRI,make concrete introduction. With a concrete example to explain a little bit existent problems of multi-threadings, give the concrete contents of synchronized mechanism, two kinds of basic realizations are synchronized method and the basic format of the synchronized key word and the synchronzied method. Discussed two kinds of problems of JAVA synchronized mechanism: False synchronized and deadlock, and give understand the suggestion of these two kinds of problems definitely. Introduced a kind of method for multi-threading communications: Wait()/notify() method, and the main format of that method, the application, and notice with application of item. Application passed a solid example of concrete comprehensive application, explained a multi-threading Application in physically. Keyword multi-threading;synchronized mechanis

您可能关注的文档

文档评论(0)

yurixiang1314 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档