摘要
在一个程序中代码段从单独的并发的线程当中访问了同一个对象,这个代码段是临界区。对"临界区"要进行保护,Java语言采用管程机制,提供同步语法对临界区进行保护。只要了解了同步内部的实现机制,编写出安全高效的多线程程序会更加灵活。利用Java多线程同步机制,可以协调管理由访问冲突所产生的一系列问题。将这种机制运用到售票系统中来解决具体的实际问题,得到了令人满意的结果。
The code segments within a program that access the same object fi'om separate, concurrent threads are called "critical sec- tions". To protect the "critical sections", the Java language uses the tube process mechanisms to provide synchronization syntax. Under- standing of the implementation of synchronous internal mechanism, the preparation of a safe and efficient multi-threaded program will be more flexible. Java multi-thread synchronization mechanism could coordinate and manage a series of questions generated by the access vio- lation. Using this mechanism to the ticketing system, specific practical problems is solved in the paper, and the satisfied results are achieved.
出处
《智能计算机与应用》
2012年第3期86-88,F0003,共4页
Intelligent Computer and Applications
基金
湖北教育厅人文社会科学研究重点项目(2010d025)
关键词
临界区
多线程
同步
协调管理
Critical Sections
Multi-threaded
Synchronization
Coordination and Management