嵌入式系统中线程池的优点
我正在研究嵌入式系统中线程池设计模式的优点。 我列出了一些优点,请仔细阅读它们,发表评论并提出我所缺少的任何其他可能的优点。
- ucos-2 等线程数量有限的系统中的可扩展性。
- 必要时增加任何任务的能力,例如垃圾收集(例如,在正常系统中,如果垃圾收集在一个任务下运行,则不可能加速它,但在线程池中我们可以轻松加速它)。
- 可以设置最大系统负载的限制。
如果我遗漏了什么,请提出建议。
I am looking at the advantages of threadpooling design pattern in Embedded systems.
I have listed few advantages, please go through them, comment and please suggest any other possible advantages that I am missing.
- Scalability in systems like ucos-2 where there is limit on number of threads.
- Increasing capability of any task when necessary like Garbage collection (say in normal systems if garbage collection is running under one task, its not possible to speed it up, but in threadpooling we can easily speed it up).
- Can set limit on the max system load.
Please suggest if I am missing anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
池化还有助于避免创建和销毁线程时可能发生的令人讨厌的较低级别泄漏。某个未命名的嵌入式操作系统喜欢在每次线程死亡时丢失 4K(即使在进程被销毁之后)。在这个特定的操作系统上,不可能有一个长时间运行的系统频繁地创建线程,除非您使用线程池。
Pooling also helps avoid nasty lower level leaks that can happen when you create and destroy threads. A certain unamed embedded OS likes to lose 4K everytime a thread dies(even after the process is destroyed). On this particular OS, it is impossible to have a long running system that makes threads frequently, that is unless you use thread pooling.
线程创建/销毁可能会带来很大的开销并且是不确定的。一次性创建线程池可以将所有这些开销放在前面,并且可以通过让线程随时准备运行来提高性能。
Thread creation/destruction may carry a large overhead and be non-deterministic. One time creation of a thread pool puts all this overhead up-front, and can improve performance by having threads ready to run at any time.