是否可以使用 python 每 1us 激活一个线程?
Is it possible to activate a thread every 1us with python?
对于我的应用程序,需要一个每 1us 记录一个以太网帧的函数。可以用 python/threading 来做吗?
我用threading.Timer得到的最大延迟接近10ms。
没有
1µs 远低于常规操作系统提供的粒度,后者通常以 milliseconds(即数千 µs)为单位进行测量。参见 this answer for a discussion about Linux time slices as well as 。
不用说,如果操作系统不能提供这样的粒度,那么用户 space 中的任何东西 运行 都没有希望。
如果您确实需要 µs 级精度,则需要查看实时系统。并且由于您的问题中有 ethernet
标签,您可能还想查看 network processors.
对于我的应用程序,需要一个每 1us 记录一个以太网帧的函数。可以用 python/threading 来做吗?
我用threading.Timer得到的最大延迟接近10ms。
没有
1µs 远低于常规操作系统提供的粒度,后者通常以 milliseconds(即数千 µs)为单位进行测量。参见 this answer for a discussion about Linux time slices as well as
不用说,如果操作系统不能提供这样的粒度,那么用户 space 中的任何东西 运行 都没有希望。
如果您确实需要 µs 级精度,则需要查看实时系统。并且由于您的问题中有 ethernet
标签,您可能还想查看 network processors.