Stub funcon contains the funcons interface client side

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lock (queue_mutex); lock (queue_mutex); enqueue (); if (queue is empty) { unlock (queue_mutex); unlock (queue_mutex); goto try_again; } dequeue (); unlock (queue_mutex); •  Problem: repe\\ve locking and unlocking is costly Condi\onal Variables •  Typical opera\ons on a condi\on variable (used with a lock): –  wait: wai\ng on the condi\on variable –  signal: waking up one wai\ng thread to run. •  DEQUEUE lock (queue_mutex); while (queue is empty) wait (queue_mutex, nonempty_cond); dequeue (); unlock (queue_mutex); •  ENQUEUE lock (queue_mutex); enqueue (); signal (nonempty_cond); unlock (queue_mutex); RPC •  A remote procedure call that looks like a local one. •  Commonly used today: RPC Architecture •  Create stub func\ons to make RPC appear to the user that the call is local. •  Stub func\on contains the func\on’s interface. •  Client side composes a RPC request and send to the server •  Server side executes the procedure and sends back the result. •  Client side returns the result to the caller. Marshaling and Unmarshaling •  Incompa\bility problems: –  Different bytes ordering –  Different sizes of integer –  Different float number representa\ons –  Different character sets –  Different alignments –  ... Marshaling and Unmarshaling •  Marshaling convert the data to make transfers across plamorm •  Unmarshaling is the opposite – construct the object from the data received. •  Some\mes referred to as serialize and desterilize. RPC Seman\cs •  Communica\on and machines may fail. •  Most RPC systems will offer either –  at least once seman\cs –  or at most once seman\cs (such as YFS RPC) •  No such thing as exactly once seman\cs More Issues with RPC •  RPC is slower, a lot slower… •  Security –  Authen\ca\on, encryp\on, etc. Clock Synchroniza\on – Why? •  Temporal ordering of events produced by concurrent processes •  Synchroniza\on between senders and receivers of messages •  Coordina\on of joint ac\vity •  Serializa\on of concurrent access for shared objects Clock Synchroniza\on •  Real world clock –  Cris\an’s Algorithm –  Berkeley Algorithm •  Logical clock –  Lamport Logical Clock Cris\an’s Algorithm •  Request \me, get reply – Measure actual round- trip \me d •  Request Sent: T0 •  Reply rece...
View Full Document

This document was uploaded on 02/20/2014.

Ask a homework question - tutors are online