Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright 2012 & 2015 – Noah Mendelsohn A Brief Intro to the RPC Project Framework Noah Mendelsohn Tufts University

Similar presentations


Presentation on theme: "Copyright 2012 & 2015 – Noah Mendelsohn A Brief Intro to the RPC Project Framework Noah Mendelsohn Tufts University"— Presentation transcript:

1 Copyright 2012 & 2015 – Noah Mendelsohn A Brief Intro to the RPC Project Framework Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: http://www.cs.tufts.edu/~noah COMP 150-IDS: Internet Scale Distributed Systems (Spring 2015)

2 © 2010 Noah Mendelsohn Review From the Earlier Lecture On Remote Procedure Call

3 © 2010 Noah Mendelsohn RPC: Call remote functions automatically  Interface definition: float sqrt(float n);  Proxies and stubs generated automatically  RPC provides transparent remote invocation CPU Memory Storage CPU Memory Storage x = sqrt(4) float sqrt(float n) { …compute sqrt… return result; } float sqrt(float n) { send n; read s; return s; } proxy void doMsg(Msg m) { s = sqrt(m.s); send s; } stub Request invoke sqrt(4) Response result=2 (no exception thrown)

4 © 2010 Noah Mendelsohn How the Demo Programs Work

5 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage int main() { func1() } simplefunctionclient.cpp This client

6 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage int main() { func1() } void func1() { return; } simplefunctionclient.cpp …is calling this function Interface definition file: simplefunction.idl void func1();

7 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp simplefunction.cpp int main() { func1() } void func1() { return; } simplefunctionclient.cpp Sample proxy

8 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp simplefunction.cpp int main() { func1() } void func1() { return; } simplefunctionclient.cpp Proxy and stub names always match IDL file name

9 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } int main() { func1() } simplefunctionclient.cpp rpcserver is generic main program…doesn’t depend on IDL or func1 rpcserver.cpp linked as simplefunctionserver

10 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } int main() { func1() } simplefunctionclient.cpp …but we name the executable to match the particular use (simplefunctionserver) rpcserver.cpp linked as simplefunctionserver

11 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp void dispatchFunction() { read from socket call __func1() } void __func1() { read args from stream call func1 send response } simplefunction.stub.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } int main() { func1() } simplefunctionclient.cpp All stubs provide a dispatchFunction rpcserver.cpp linked as simplefunctionserver

12 © 2010 Noah Mendelsohn Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp void dispatchFunction() { read from socket call __func1() } void __func1() { read args from stream call func1 send response } simplefunction.stub.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } int main() { func1() } simplefunctionclient.cpp …that reads function names from the network and calls the right stub rpcserver.cpp linked as simplefunctionserver

13 © 2010 Noah Mendelsohn void func1() { return; } Demo program uses function w/no arguments CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp void dispatchFunctiong() { read from socket call __func1() } void __func1() { read args from stream call func1 send response } simplefunction.stub.cpp Request invoke func1() Response DONE simplefunction.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver int main() { func1() } simplefunctionclient.cpp

14 © 2010 Noah Mendelsohn void func1() { return; } Demo program uses function w/no arguments Interface definition file: simplefunction.idl CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp void dispatchFunctiong() { read from socket call __func1() } void __func1() { read args from stream call func1 send response } simplefunction.stub.cpp Request invoke func1() Response DONE simplefunction.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver int main() { func1() } simplefunctionclient.cpp You’ll be implementing proxies and stubs like these…first by hand…then using your RPC generator

15 © 2010 Noah Mendelsohn void func1() { return; } Demo program uses function w/no arguments Interface definition file: simplefunction.idl CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp void dispatchFunctiong() { read from socket call __func1() } void __func1() { read args from stream call func1 send response } simplefunction.stub.cpp Request invoke func1() Response DONE simplefunction.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver int main() { func1() } simplefunctionclient.cpp simplefunction.proxy.cpp & simplefunction.stub.cpp are provided for you as samples … Yours will have to support other IDL files with functions that take arguments and return values!


Download ppt "Copyright 2012 & 2015 – Noah Mendelsohn A Brief Intro to the RPC Project Framework Noah Mendelsohn Tufts University"

Similar presentations


Ads by Google