Linux Python可以';t启动新线程,但未达到线程限制

Linux Python可以';t启动新线程,但未达到线程限制,linux,multithreading,python-3.x,embedded-linux,python-multithreading,Linux,Multithreading,Python 3.x,Embedded Linux,Python Multithreading,我已经安装了一个嵌入式系统(armv5tejl AT91SAM9X25,带有128MB的RAM,运行基于buildroot的rootfs),并安装了Python 3。我已经让系统运行了很多天了,我来做一些python开发工作,但似乎在创建新线程时遇到了问题 如果我尝试运行以下程序: Type "help", "copyright", "credits" or "license" for more information. >>> import threading >>

我已经安装了一个嵌入式系统(armv5tejl AT91SAM9X25,带有128MB的RAM,运行基于buildroot的rootfs),并安装了Python 3。我已经让系统运行了很多天了,我来做一些python开发工作,但似乎在创建新线程时遇到了问题

如果我尝试运行以下程序:

Type "help", "copyright", "credits" or "license" for more information.
>>> import threading
>>> import time
>>> def func():
...     i = 0
...     while True:
...         i += 1
...         print(i)
...         time.sleep(1)
...
>>>
>>> func()
1
2
3
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 6, in func
KeyboardInterrupt
>>> t = threading.Thread(target=func)
>>> t.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/threading.py", line 850, in start
RuntimeError: can't start new thread
>>>
使用,我的系统上的线程总数是75,远低于961的限制。以下是我当前的内存状态:

# free -m
             total       used       free     shared    buffers     cached
Mem:           120        118          2         60          0         65
-/+ buffers/cache:         52         67
Swap:            0          0          0
我还通过运行
echo 1>/proc/sys/vm/compact\u memory
运行了内存压缩程序


我想,如果我重新启动设备,一切都会正常工作(因为代码是已知的工作代码),但由于我现在设备处于这种状态,我很想了解问题所在。

可能只是Python实现中没有启用线程。对于开发人员来说,这是一个更麻烦的领域。谁提供了Python,他们有任何关于线程实现的文档吗?

线程是绝对启用的,因为我已经在使用线程的单元上编写了Python软件。只是现在,运行该软件失败了,因为解释器无法创建线程。我曾经在线程工作良好的环境中遇到过同样的问题。这种情况时有发生。如果知道除了达到256个线程之外还有什么原因,那就太好了
# free -m
             total       used       free     shared    buffers     cached
Mem:           120        118          2         60          0         65
-/+ buffers/cache:         52         67
Swap:            0          0          0