Roberto Fuentes
fullstack devops
Downtown ReactJS Meetup - 2018/10/30
OS vs Userland
two or more tasks can start, run, and complete in overlapping time periods. It doesn't rule out that the tasks can be both be running at the same instant. For example, multitasking on a single- vs multi-core machine.
... a property of a program or system
tasks literally run at the same time e.g., on a multicore processor.
parallelism as the run-time behaviour of executing multiple tasks at the same time
Multi-tasking
-is a Process
-top-level execution container
-have their own memory space
-communicate with other processes via IPC
-sandbox / safety
Multi-threading
-runs inside a process
-share same memory
-need to manage sync
OS vs Userland
Race conditions cannot happen
"Everything runs in parallel except your code"
one operation is executed at a time
write code to make it behave asynchronous
OS vs Userland
DOM is tree-structured
DOM trees are easy to traverse
ENTER THE SPA
need to manipulate the tree A LOT!!
*Facebook did not invent this
Background
key features: the ability to pause, abort, or reuse work as new updates come in; the ability to assign priority to different types of updates; and new concurrency primitives.
incremental rendering: the ability to split rendering work into chunks and spread it out over multiple frames.
Reconciliation
computations that must be performed. Work is usually the result of an update (e.g. setState).
https://github.com/acdlite/react-fiber-architecture
CPU
IO
isolated thread
-code lives in its own file
-some APIs are not accessible (i.e. DOM)
postMessage
-communicates with the Main Thread
Spawn other workers (sub-workers)
isolated thread
-code lives in its own file
-some APIs are not accessible (i.e. DOM)
postMessage
-communicates with the Main Thread
Spawn other workers (sub-workers)
main
worker
Web Workers makes it possible to run a script operation in background thread separate from the main execution thread of a web application. The advantage of this is that laborious processing can be performed in a separate thread, allowing the main (usually the UI) thread to run without being blocked/slowed down.
By Roberto Fuentes