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.
查看全文
  • 相关阅读:
    Delphi取硬盘特征字
    Delphi学习中一点心得
    ring0 DOS路径转NT路径
    【code】ring0下的安全拷贝
    联合体在WinDBG中的表现形式
    【转】nmake下一些错误的解决办法
    【转】程序崩溃时自动记录minidump的c++类
    【转】 “指定的服务已标记为删除”
    【转】关于SSDT HOOK取消内存写保护的问题
    【转】内核安全字符函数
  • 原文地址:https://www.cnblogs.com/jintan/p/1027867.html
  • Copyright © 2011-2022 走看看