zoukankan      html  css  js  c++  java
  • 关于线程的两篇文章

    1.Extended Threading: Do More with the Same Thread
    让一个线程完成更多的任务。作者自己写了一个类,拦截System.Threading.Thread,试图让你在不同的线程执行同一个方法成为可能,如果你想执行多次,你不必每次都创建一个新线程来执行该方法,优势在于提高性能并且易于使用,毕竟创建线程的代价还是比较昂贵的。
    作者完成了一个Demo,用自己实现的方案分别对普通线程,线程池实现方式的性能作了比较。

  • Download demo project - 8.3 KB
  • Download source - 16 KB

    2.Smart Thread Pool
    智能线程池。该线程池不同于.net framework提供的线程池,这个线程池完全重新实现,并增加了很多有用的特性。
    The number of threads dynamically changes according to the workload on the threads in the pool.

  • Work items can return a value.
  • A work item can be cancelled if it hasn't been executed yet.
  • The caller thread's context is used when the work item is executed (limited).
  • Usage of minimum number of Win32 event handles, so the handle count of the application won't explode.
  • The caller can wait for multiple or all the work items to complete.
  • Work item can have a PostExecute callback, which is called as soon the work item is completed.
  • The state object, that accompanies the work item, can be disposed automatically.
  • Work item exceptions are sent back to the caller.
  • Work items have priority.
  • Work items group.
  • The caller can suspend the start of a thread pool and work items group.
  • Threads have priority.
查看全文
  • 相关阅读:
    docker registry
    2019最新EI源刊目录
    在Asp.net Core中使用中间件来管理websocket
    自定义WPF窗体形状
    Font Awesome矢量版,十六进制版,WPF字体使用
    什么是fortran语言之fortran语言入门
    Java各国首都列表
    世界各国货币,C#数字货币计算
    Ocelot中文文档入门
    F#语言入门之什么是F#语言
  • 原文地址:https://www.cnblogs.com/jintan/p/1027867.html
  • Copyright © 2011-2022 走看看