What is the difference between a thread and a fiber?

前端 未结 9 902
北荒
北荒 2020-12-07 07:28

What is the difference between a thread and a fiber? I\'ve heard of fibers from ruby and I\'ve read heard they\'re available in other languages, could somebody explain to me

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 07:44

    Threads are scheduled by the OS (pre-emptive). A thread may be stopped or resumed at any time by the OS, but fibers more or less manage themselves (co-operative) and yield to each other. That is, the programmer controls when fibers do their processing and when that processing switches to another fiber.

提交回复
热议问题