1 / 24

Implementing Remote Procedure Calls

Implementing Remote Procedure Calls. Andrew Birrell and Bruce Nelson. Presented by Phil Howard. Why?. Consider. #include &lt;stdio.h&gt; int main() { printf(&quot;hello world!<br>&quot;); return 0; }. What Happens. main. main. printf glibc. kernel IO kernel. update_window X

barrowj
Download Presentation

Implementing Remote Procedure Calls

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Implementing Remote Procedure Calls Andrew Birrell and Bruce Nelson Presented by Phil Howard

  2. Why?

  3. Consider #include <stdio.h> int main() { printf("hello world!\n"); return 0; }

  4. What Happens main main printf glibc kernel IO kernel update_window X update_display kernel IO kernel

  5. But what if Laptop Linux Box X Client X Server Console Window main

  6. What Happens Laptop Linux Box main main X Client printf glibc update_display X kernel IO kernel kernel IO kernel update_window X update_display

  7. How do you do this? • Fork/Join • SendMessage/AwaitReply • Remote Procedure Call

  8. What's Involved in RPC • Remote Procedure Call should look and feel like local call • Remote Procedure Call should be independent of where it executes • Remote Procedure Call should be "efficient"

  9. Issues • Finding the callee • Passing data • Implementation • Exceptions • Optimizations

  10. Finding the Callee(Binding) • Where • Server has known static address • Client broadcasts request • Central database of interfaces • What • Servers export named interfaces • Clients request a particular interface • Need Globally Unique Identifiers for interfaces

  11. Passing Data • Can't use the stack • Can't use shared memory • Generally use message passing

  12. Passing Data #include <stdio.h> int main() { union { unsigned long stuff1; unsigned char stuff2[4]; } my_var; my_var.stuff1 = 0x12345678; printf("%X %X %X %X\n", my_var.stuff2[0], my_var.stuff2[1], my_var.stuff2[2], my_var.stuff2[3]); return 0; }

  13. Passing Data What's the output? • 12 34 56 78 • or • 78 56 34 12

  14. Passing data Build a message that includes: • Who and what's being called • Identity of the caller • Data values in known byte order

  15. Issues • Finding the callee • Passing data • Implementation • Exceptions • Optimizations

  16. Implementation foo(a,&b) foo(int a, int *b) return;

  17. Implementation • foo(int a; int *b) • { • build_msg(a,b); • send_msg(); • wait_for_reply(); • get_from_msg(&b); • } • do_foo(msg_t msg) • { • int a,b; • get_from_msg(&a,&b); • foo(a,&b); • build_msg(b); • send_reply(); • }

  18. Implementation • Function prototype is (almost) all that's needed to build the client stub • Also need binding information • Function prototype is (almost) all that's needed to build server stuf • Also need method to wait for message

  19. Implementation • Clients • Threaded • Servers • Event Driven

  20. Issues • Finding the callee • Passing data • Implementation • Exceptions • Optimizations

  21. ExceptionsWhat can happen in "normal" procedures? • Procedure generates an exception • Procedure infinite loops • Procedure generates wrong results

  22. ExceptionsWhat can happen in "remote" procedures? • Client stub generates exception • Transmission failure • knowable failure • unknowable failure • Remote procedure generates an exception • Remote procedure infinite loops • Remote procedure generates wrong results

  23. Optimizations • Servers maintain no state on clients • No penalty for a large number of clients • Messages must be ack'd • for short calls, result serves as ack • for frequent calls, next call ack's last result • for long requests, only last request msg gets ack'd • for long results, only last result msg gets ack'd • Bound to "closest" server • Minimum transmission delay

  24. Conclusion • Remote Procedure Call should look and feel like local call • Remote Procedure Call should be independent of where it executes • Remote Procedure Call should be "efficient"

More Related