tokio-rs / doc-push

Tokio doc blitz effort - A concerted effort to improve Tokio's documentation.
MIT License
50 stars 7 forks source link

Getting started: define "task" #81

Open nrc opened 6 years ago

nrc commented 6 years ago

"task" is used without definition, and it's a bit confusing what exactly it is - does it have a precise, technical meaning or is it colloquial? Is it the same as a future or a combination of futures or something else?

nrc commented 6 years ago

In particular, "task" seems to mean something different in 'hello world' c.f., 'polling model'.

rylev commented 6 years ago

This is still an issue. It seems that we sometimes use the term "task" when we simply mean "future". "Task" should probably only refer to futures that are spawned onto the runtime. @carllerche Do you have a better, clearer picture of when it's appropriate to use each term?

carllerche commented 6 years ago

Maybe instead of just calling things a "task", we could call them "future spawned as a task"? It is longer though.

rylev commented 6 years ago

I think that just punts the question along. What does it mean to be spawned as a task?

carllerche commented 6 years ago

It does... but it at least differentiates between future & task. A task is a unit of execution managed by an executor and it is represented by a Future.

ghost commented 6 years ago

I think of a task as just a spawned future running inside an executor.

Perhaps a good analogy could be threads and closures. Consider:

The analogy goes like this: