WebFund 2014W Lecture 18: Difference between revisions

From Soma-notes
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
The video from the lecture given on March 19, 2014 is available:
* [http://www.screencast.com/t/p4S3RPyl Small from screencast.com]
* [http://www.screencast.com/t/z2SXj16DLx Large from screencast.com]
* [http://dl.cuol.ca/capture/Anil.Somayaji/COMP_2406_2014W_Lecture_18_-_20140319_211725_27.mp4 Original from CUOL]
==invoke versus call==
==invoke versus call==
* SAME THING
* SAME THING
Line 10: Line 16:
** exception: event handlers
** exception: event handlers
** dispatcher calls event handlers
** dispatcher calls event handlers
* type of event-driven programming
** event dispatcher is implicit
** implicit "assembly line"
** raw data comes in, dispatcher has routine(s) that match raw data
** routine process it, leaves processed data
** processed data matches other routines
* normal events are incoming I/O events
** keypresses, mouse clicks, network traffic
* node makes use of synthetic events
** generated by other code
==multitasking==
* node is "cooperatively multitasked"
* multithreaded code is preemptively multitasked
* sane multithreading involves locking
** temporary exclusive ownership
** mistakes lead to race conditions
* node avoids race conditions while being highly concurrent
** node is fast

Latest revision as of 02:47, 21 March 2014

The video from the lecture given on March 19, 2014 is available:

invoke versus call

  • SAME THING


Reactor pattern

  • direct contrast to a procedural pattern
  • procedural: everything is synchronous
    • each line completes before the next executes
  • reactor pattern: mostly synchronous
    • exception: event handlers
    • dispatcher calls event handlers
  • type of event-driven programming
    • event dispatcher is implicit
    • implicit "assembly line"
    • raw data comes in, dispatcher has routine(s) that match raw data
    • routine process it, leaves processed data
    • processed data matches other routines
  • normal events are incoming I/O events
    • keypresses, mouse clicks, network traffic
  • node makes use of synthetic events
    • generated by other code

multitasking

  • node is "cooperatively multitasked"
  • multithreaded code is preemptively multitasked
  • sane multithreading involves locking
    • temporary exclusive ownership
    • mistakes lead to race conditions
  • node avoids race conditions while being highly concurrent
    • node is fast