文件名称:Thread-Communications
- 所属分类:
- JSP源码/Java
- 资源属性:
- [Java] [源码]
- 上传时间:
- 2013-12-30
- 文件大小:
- 173kb
- 下载次数:
- 0次
- 提 供 者:
- che****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
1、 点“创建线程” 按钮,创建两个线程,一个线程不断对一个变量加1,结果显示在第一个文本框中。另一个线程不断对另一个变量减1,结果显示在第二个文本框中。这两个线程之间没有交互,仅用于演示线程的创建。
2、 演示线程互斥,点“线程互斥” 按钮,创建两个线程,一个线程不断循环,每次循环对共享变量x做100次加1操作(这100次加1操作作为一个临界区CSa),另一个线程不断循环,每次循环对共享变量x做100次减1操作(这100次减1操作作为一个临界区CSb),结果显示在第三个文本框中。可以看到结果是从0到100,然后又从100回到0。可见CSa和CSb两个临界区是互斥的。
3、 除了没有互斥,其它同2,结果显示在第四个文本框中。可见CSa和CSb两个临界区的执行是有交叉的,CSa的执行可能被CSb打断,CSb的执行也可能被CSa打断。
-1, point " create thread" button to create two threads, one thread plus a continuously variable showed that in the first text box. Another thread continuously variable minus one another, the results are displayed in the second text box. There is no interaction between the two threads, the thread is only for creating presentations. 2, demo thread mutex point " thread mutex" button to create two threads, one thread continuous cycle, each cycle of the shared variable x to do 100 plus an operation (this 100 plus an operation as a critical area CSa ), the cycle of another thread, the shared variables of each cycle do x 100 decremented (100 Save this as an operation of a critical section CSb), the results shown in the third text box. You can see the results from 0-100, and then from 100 back to 0. Visible CSa and CSb two critical areas are exclusive. 3, in addition to not mutually exclusive, the other with two, the results are displayed in the fourth text box. Visible execu
2、 演示线程互斥,点“线程互斥” 按钮,创建两个线程,一个线程不断循环,每次循环对共享变量x做100次加1操作(这100次加1操作作为一个临界区CSa),另一个线程不断循环,每次循环对共享变量x做100次减1操作(这100次减1操作作为一个临界区CSb),结果显示在第三个文本框中。可以看到结果是从0到100,然后又从100回到0。可见CSa和CSb两个临界区是互斥的。
3、 除了没有互斥,其它同2,结果显示在第四个文本框中。可见CSa和CSb两个临界区的执行是有交叉的,CSa的执行可能被CSb打断,CSb的执行也可能被CSa打断。
-1, point " create thread" button to create two threads, one thread plus a continuously variable showed that in the first text box. Another thread continuously variable minus one another, the results are displayed in the second text box. There is no interaction between the two threads, the thread is only for creating presentations. 2, demo thread mutex point " thread mutex" button to create two threads, one thread continuous cycle, each cycle of the shared variable x to do 100 plus an operation (this 100 plus an operation as a critical area CSa ), the cycle of another thread, the shared variables of each cycle do x 100 decremented (100 Save this as an operation of a critical section CSb), the results shown in the third text box. You can see the results from 0-100, and then from 100 back to 0. Visible CSa and CSb two critical areas are exclusive. 3, in addition to not mutually exclusive, the other with two, the results are displayed in the fourth text box. Visible execu
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Thread Communications\.classpath
.....................\.fatjar
.....................\.project
.....................\.settings\org.eclipse.jdt.core.prefs
.....................\bin\Thread\8.jpg
.....................\...\......\TestThread$1.class
.....................\...\......\TestThread$AddThread1.class
.....................\...\......\TestThread$AddThread2.class
.....................\...\......\TestThread$AddThread3.class
.....................\...\......\TestThread$ButtonListener.class
.....................\...\......\TestThread$ReduceThread1.class
.....................\...\......\TestThread$ReduceThread2.class
.....................\...\......\TestThread$ReduceThread3.class
.....................\...\......\TestThread.class
.....................\src\Thread\8.jpg
.....................\...\......\TestThread.java
.....................\bin\Thread
.....................\src\Thread
.....................\.settings
.....................\bin
.....................\src
Thread Communications