Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add topic - event loop, timers, nextTick() #4936

Conversation

techjeffharris
Copy link
Contributor

This is a rough draft of a Topic that provides an
overview of the event loop, timers, and process.nextTick() that is
based upon a NodeSource "Need to Node" presentation hosted by
@trevnorris: Event Scheduling and the Node.js Event Loop.

I'm sure there's room for improvement, but this is a start!

PTAL

/cc @nodejs/documentation, @nodejs/collaborators

This is a rough draft of a [Topic](https://github.com/nodejs/docs/blob/master/GETTING-STARTED.md#what-we-write) that provides an
overview of the event loop, timers, and `process.nextTick()` that is
based upon a NodeSource "Need to Node" presentation hosted by
@trevnorris: [Event Scheduling and the Node.js Event Loop](https://nodesource.com/resources).
@mscdex mscdex added the doc Issues and PRs related to the documentations. label Jan 28, 2016
@Qard
Copy link
Member

Qard commented Jan 28, 2016

LGTM 👍

@chrisdickinson
Copy link
Contributor

Reviewing now — at first glance this looks like great info!

@@ -0,0 +1,174 @@
# Overview of the Event Loop, Timers, and `process.nextTick()`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should end with a .md extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops >_<

@chrisdickinson
Copy link
Contributor

This is excellent work!

@mscdex
Copy link
Contributor

mscdex commented Jan 28, 2016

It might be worth mentioning that setImmediate() was introduced in node v0.10? Whereas process.nextTick() has been around for much longer.

@techjeffharris
Copy link
Contributor Author

Thanks for the notes! I must go to my day (evening) job ATM, but I'll address all concerns mentioned ASAP.

@Fishrock123
Copy link
Contributor

@trevnorris should probably review this also as he has previously done detailed analysis of the event loop for presentations and such.

@shigeki
Copy link
Contributor

shigeki commented Jan 29, 2016

I made a diagram in several years ago for the discussion in https://html5.ohtsu.org/node-v0.11.13-eventloop.png
I hope it can be helpful for understanding for an event loop in libuv.

@jasnell
Copy link
Member

jasnell commented Jan 29, 2016

+1 on this... awesome to see.

@ronkorving
Copy link
Contributor

Fantastic work 👍


### Why would that be allowed?

Why would something like this be included in Node? Part of it is a design
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js

This is a rough draft of a [Topic](https://github.com/nodejs/docs/blob/master/GETTING-STARTED.md#what-we-write) that provides an
overview of the event loop, timers, and `process.nextTick()` that is
based upon a NodeSource "Need to Node" presentation hosted by
@trevnorris: [Event Scheduling and the Node.js Event Loop](https://nodesource.com/resources).
…hjeffharris/node into doc-topic-event-loop-timers-nextTick
@techjeffharris
Copy link
Contributor Author

Pushed some updates to address issues/concerns/suggestions provided above.

@calvinmetcalf
Copy link
Contributor

you need to remove the file without the .md

@techjeffharris
Copy link
Contributor Author

thanks! Still a bit of a git novice--learning >_<

@techjeffharris
Copy link
Contributor Author

Okay, I believe I have exhausted my capacity to be the guardian of this PR, and it appears that all major concerns have been addressed. Thanks for all the help!

@nodejs/collaborators, @nodejs/ctc PTAL

@mcollina
Copy link
Member

mcollina commented Apr 8, 2016

LGTM! :)

@jasnell
Copy link
Member

jasnell commented Apr 8, 2016

LGTM
If there's anything additional to be done on this it can be done as separate PRs. Awesome work, thank you!

@calvinmetcalf calvinmetcalf merged commit e67fee0 into nodejs:master Apr 8, 2016
@calvinmetcalf
Copy link
Contributor

landed

@Knighton910
Copy link

👍

@techjeffharris
Copy link
Contributor Author

Yay! Thank you all for your help!

MylesBorins pushed a commit that referenced this pull request Apr 8, 2016
Adds a new topic that provides an overview of the event loop, timers, and
`process.nextTick()` that is based upon a NodeSource "Need to Node" presentation
hosted by @trevnorris: Event Scheduling and the Node.js Event
Loop (https://nodesource.com/resources).

PR-URL: #4936
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Calvin W. Metcalf <calvin.metcalf@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 11, 2016
@a0viedo
Copy link
Member

a0viedo commented Apr 15, 2016

Excellent work @techjeffharris!

@techjeffharris
Copy link
Contributor Author

Thank you, @a0viedo !

@MylesBorins
Copy link
Contributor

@calvinmetcalf just as a heads up this landed with a bunch of whitespace errors 😢

Applying: doc: add topic - event loop, timers, `nextTick()`
.git/rebase-apply/patch:18: trailing whitespace.
offloading operations to the system kernel whenever possible.
.git/rebase-apply/patch:26: trailing whitespace.
## Event Loop Explained
.git/rebase-apply/patch:48: trailing whitespace.
    │  ┌──────────┴────────────┐      └───────────────┘
.git/rebase-apply/patch:53: trailing whitespace.
       └───────────────────────┘
.git/rebase-apply/patch:81: trailing whitespace.
* `timers`: this phase executes callbacks scheduled by `setTimeout()`
warning: squelched 20 whitespace errors
warning: 25 lines applied after fixing whitespace errors.

If you are running git am you can avoid this by including the flag --whitespace=fix

MylesBorins pushed a commit that referenced this pull request Apr 19, 2016
Adds a new topic that provides an overview of the event loop, timers, and
`process.nextTick()` that is based upon a NodeSource "Need to Node" presentation
hosted by @trevnorris: Event Scheduling and the Node.js Event
Loop (https://nodesource.com/resources).

PR-URL: #4936
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Calvin W. Metcalf <calvin.metcalf@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@silverwind
Copy link
Contributor

Or even better, use apply-pr, which also does the whitespace fixes.

@silverwind
Copy link
Contributor

silverwind commented Apr 19, 2016

Got to correct myself, apply-pr does no whitespace fixing by itself, but having

git config --global apply.whitespace fix

does so, and works for both apply-pr and git am 😉

MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
Adds a new topic that provides an overview of the event loop, timers, and
`process.nextTick()` that is based upon a NodeSource "Need to Node" presentation
hosted by @trevnorris: Event Scheduling and the Node.js Event
Loop (https://nodesource.com/resources).

PR-URL: #4936
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Calvin W. Metcalf <calvin.metcalf@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 20, 2016
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
Adds a new topic that provides an overview of the event loop, timers, and
`process.nextTick()` that is based upon a NodeSource "Need to Node" presentation
hosted by @trevnorris: Event Scheduling and the Node.js Event
Loop (https://nodesource.com/resources).

PR-URL: #4936
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Calvin W. Metcalf <calvin.metcalf@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This was referenced Apr 21, 2016
jasnell pushed a commit that referenced this pull request Apr 26, 2016
Adds a new topic that provides an overview of the event loop, timers, and
`process.nextTick()` that is based upon a NodeSource "Need to Node" presentation
hosted by @trevnorris: Event Scheduling and the Node.js Event
Loop (https://nodesource.com/resources).

PR-URL: #4936
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Calvin W. Metcalf <calvin.metcalf@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.