zoukankan      html  css  js  c++  java
  • Fiber VS Coroutine VS Green Thread

    纤程(Fiber)是一个轻量级的线程,它使用协作完成多任务,而不是使用抢占使用多任务。正在运行的Fiber必须显示让出以此允许其他Fiber运行,这使得Fiber的实现
    比内核线程和用户线程简单很多.Java有一个Fiber库

      

    协程(Coroutine)是一个组件,它被概括成多个子程序,允许多个进入点来暂停程序和恢复程序。但是和子程序又不一样,当前协程能够通过调用其他协程来退出,这就可能在稍后
    返回到在原始协程中调用的它们的位置。


    Green Thread 是由VM调用的线程,而不是由下层操作系统调用的线程.Green Thread模拟多线程环境而不用考虑本地OS的兼容能力,它们在用户空间中管理,而不是内核空间中
    管理,它们可以在没有本地线程支持的环境中工作。

    Java中使用的是Posix标准的Pthread。But

    Remember: "Pthreads" is an interface. How it's implemented depends on the platform. Linux uses kernel threads; Windows uses Win32 threads, etc.

    "Pthreads" is a library, based on the Posix standard. How a pthreads library is implemented will differ from platform to platform and library to library.

    You can query the specific implementation of pthreads under shell using command:

    getconf GNU_LIBPTHREAD_VERSION

  • 相关阅读:
    TApplication元件的OnIdle事件
    Query1AfterScroll 与 DataSource1DataChange 区别
    禁用表外键
    oracle al32utf8 字符长度
    Oracle表空间等操作
    delphi组件说明
    delhpi控件替换
    程序提示Google Internet Authority G2 证书不可用
    PostMessage用法
    OnKeyPress OnKeyDown区别
  • 原文地址:https://www.cnblogs.com/shuiyonglewodezzzzz/p/11152053.html
Copyright © 2011-2022 走看看