Nodejs os.cpu return not allowed cpu
2017-03-10 15-24-55 by KamushinThe os.cpus()
API added in Nodejs v0.3.3 shows all processors in /proc/cpuinfo
.
This API is often used to give a suggestion of how many worker processes created by cluster. However, in a docker/lxc environment, some
of the cpus are not allowed to be used by a container.
For more accurate information, we should cat /proc/self/status
. This file will show the specific allowed cpus. Or use the command nproc
.
Python subprocess 线程不安全的解决方案
2017-03-02 18-02-57
by Kamushin
1.升级至 Python3.2 2.使用多进程替代多线程 3.在 Python2.7 下使用 subprocess32 包
read more从一次失效的文件锁看看 Python 的垃圾回收机制
2017-02-17 17-54-39
by Kamushin
不同的调用方式导致了文件锁的成功与失效, 原因是触发了 Python 的垃圾回收机制. Python的垃圾回收机制还是比较原始的, 基本上就是引用计数, 标记清除和分代.没有什么黑魔法.
read moreKernelRestarter: restart failed in Jupyter
2017-02-03 17-43-26
by Kamushin
Kernel start failed in case of running Jupyter as pid 1.
read more