1 leep()方法,我们首先要知道该方法是属于Thread类中的。而wait()方法,则是属于Object类中的。 2 sleep()方法导致了程序暂停执行指定的时间,让出cpu该其他线程,但是他的监控状态依然保持者,当指定的时间到了又会自动恢复运行状态。 在调用sleep()方法的过程中,线程不 ...
分类:
其他好文 时间:
2017-07-26 00:15:19
阅读次数:
136
刚才在看CSDN的问答时。发现这个问题。原问题的作者是在观察jstack的输出时提出的疑问。那么BLOCKED和WAITING有什么差别呢? 答复在JDK源代码中能够找到,例如以下是java.lang.Thread.State类的一部分凝视。 /** * Thread state for a thr ...
分类:
编程语言 时间:
2017-07-25 10:33:52
阅读次数:
776
线程一般有6个状态: 新建状态:NEW 可运行状态:RUNNABLE 休眠状态:TIMED_WAITING 等待状态:WAITING 阻塞状态:BLOCKED 终止状态“TERMINATED 当我们使用new创建线程之后,线程处于新建状态,当调用start方法之后,线程出于可运行状态,当线程需要获得 ...
分类:
编程语言 时间:
2017-07-23 10:01:19
阅读次数:
209
等待数据准备 (Waiting for the data to be ready) 将数据从内核拷贝到进程中 (Copying the data from the kernel to the process) Stevens在文章中一共比较了五种IO Model: blocking IO nonbl ...
分类:
编程语言 时间:
2017-07-21 17:18:55
阅读次数:
248
Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the c ...
分类:
其他好文 时间:
2017-07-21 15:52:21
阅读次数:
244
本文介绍了如何使用python构建一个小型的区块链技术,使用Python2实现,代码不到50行。 ...
分类:
编程语言 时间:
2017-07-20 12:11:26
阅读次数:
286
运行centos7中yum命令时提示: Existing lock /var/run/yum.pid: another copy is running as pid 3936.Another app is currently holding the yum lock; waiting for it ...
分类:
系统相关 时间:
2017-07-20 00:52:51
阅读次数:
218
1 #!/usr/bin/python 2 #coding=utf-8 3 #server 4 import socket 5 import sys 6 import os 7 8 server_address = './test' 9 10 #首先确保这个文件不能存在,只是用于本地套接字的通信,如... ...
分类:
编程语言 时间:
2017-07-17 17:15:47
阅读次数:
233
php7的安装 wget http://am1.php.net/get/php-7.0.4.tar.gz/from/this/mirror tar zvxf php-7.0.4.tar.gz cd php-7.0.4 ./configure --prefix=/data/php7 --with-co ...
分类:
Web程序 时间:
2017-07-13 21:52:58
阅读次数:
201