Node.js & Event Loop Flashcards

1
Q

JS Event loop

A

concurrency model built on top of the core JS in a browser ( or programming environment) and accessed through browser APIs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Basic Browser Architecture

A

Left Column: Core JS
Right Column: WebAPIs
Bottom footer: callback queue
Above footer: event loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Browser Structure: Core JS

A

Heap - objects allocated in heap, unstructured region of memory
Stack (call stack)- represents single thread for JS code execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Browser Structure: WebAPIs

A

Built into browser, able to expose data from the browser and surrounding computer environment. Not part of JS itself. i.e. DOM, Ajax, setTimeout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Browser Structure: Callback (task) queue

A

Accepts completed process code from the WebAPI, and ferries the code to the main call stack for code execution based on the event loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Browser Structure: Event loop

A

Checks if the main call stack is empty, and if any processes in the callback queue are due to be put back onto the callstack. Must wait until call stack is clear to push reinsert processes in queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Node.js

A

An asynchronous, event driven runtime environment for JS that allows for non-blocking I/O using a concurrency model like the browser JS event loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly