Note: Multiprocessor Synchronization
14 Oct 2014volatile
in Java, it’s for thread contextstatic
in Java, it’s for object context- thread-oblivious and
volatile
in Java, it’s for thread contextstatic
in Java, it’s for object contextCircuit switching vs Packet switching
STDM: waste capacity; doesn’t degrade gracefully; illusion of direct link
Statistical Multiplexing: maximizes link utilization; unfair; unpredictable; packet may take different paths; more overhead(additional information like destination address)
Address for link layer: MAC address; Address for IP: IP address
Method | advantage | disadvantage |
Circuit switching | guaranteed allocation; low space overhead; easy to reason about | failures: must re-establish connection; no graceful degration; waste: allocate for peak; set up time long |
Packet switching | high utilization; flexible | unfair; unpredictable; different paths for each packet |
Shannon’s law
NRZ: Non-Return to Zero
NRZ Drawbacks: no signal is 0; consecutive 1s or 0s are problematic; baseline wander problem; clock recovery problem
NRZI: Non-Return to Zero Inverted; encode 1 with transition, 0 with staying the same
Solve problem of consecutive 1s
Manchester: map 0 to chips 01; 1 to chips 10
Solve clock recovery and baseline wander but transmission rate now in half
4B/5B: every 4 bits encoded as 5 chips; transmit using NRZI
Never get more than 3 consecutive 0s
Encoding goals: page 24
Sentinels
Byte-oriented: character stuffing
Bit-oriented: bit stuffing
Drawback of sentinel: variable length
Length-based: put length in header
Drawback: length get corrupted
CRC checksum helps detect error
Clock-based: 125 us, encode with NRZ but XOR payload with 127-bit string to ensure lots of transitions
Throughput | number of bits received per unit of time |
Good put | Useful bits received per unit of time |
Latency | How long for message to cross network (Process+Queue+Transmit+Propagation) |
Jitter | variation in latency |
Stop and Wait Protocol | Duplicate data; Duplicate acks; Slow; Timeout hard to set |
Duplicate data: add sequence numbers
Uniquely identify each packet
How big is the window? “Bandwidth-Delay Product” BW B/s x RTT s
Sender:
last frame sent (LFS)
Receiver:
last frame received (LFR)
Tuning send window
SWS- fill the pipe RWS- 1 <= RWS <= SWS SWS <= max valid seq# / 2
If min HD between valid codewords is d:
2-D Parity
n-bit code should capture all but 2^-n fraction of errors- Why?
Addressing: MAC address
Collision detection
10Base2:
Token Ring
Learning Bridges
bridges | same broadcast domain | copy frames |
repeaters | same broadcast and collision domain | copy signals |
Spanning Tree Protocol
Topology doesn’t have to mirror physical locations
Cut-through | decrease latency | can waste transmission(optimistic approach) |
Store and forward | high latency | pessimistic approach |
A protocol runs on top of IP
Calculate closures:
.attr()
method$('a').attr('href', 'example.com')
$('a').attr('href')
$('#myId')
$('.myClass')
$('#contents ul.people')
Pseudo-selectors:
$('a.external:first')
if ($('div.foo').length) {
// do things
}
// Refining selections.
$( "div.foo" ).has( "p" ); // div.foo elements that contain <p> tags
$( "h1" ).not( ".bar" ); // h1 elements that don't have a class of bar
$( "ul li" ).filter( ".current" ); // unordered list items with class of current
$( "ul li" ).first(); // just the first unordered list item
$( "ul li" ).eq( 5 ); // the sixth
For matrix multiplication, use GROUP BY
both row_num
and col_num
will help a lot.
Find a key that works for both pairs.