Thread Types

Red
y Run at OS level y CPU time+ y HARD

Green
y Run inside the VM y Small overhead y Cooperative scheduling

Fibers vs. Theads
(blocking)

a) Two execution threads; one thread blocks for 40ms on an IO call and then takes 10ms to post-process the data; second thread needs 50ms of pure CPU time b) Same scenario implemented with Fibers and cooperative scheduling

Event-Driven Programming
y Reactor pattern
y Event loop sends to request handlers y i.e. Python s Twisted, Eventmachine, Node.js

y Nested callbacks

Asyncas Sync

Use Cases
Red
y Computationallyexpensive tasks
y Sorting y Map-reduce

Green
y Blocking requests
y Filesystem IO y Network IO

Resources
y igvita.com y EM-Synchrony

Sign up to vote on this title
UsefulNot useful