537 distributed systems
play

[537] Distributed Systems Chapters 42 Tyler Harter 11/19/14 - PowerPoint PPT Presentation

[537] Distributed Systems Chapters 42 Tyler Harter 11/19/14 File-System Case Studies Local - FFS : Fast File System - LFS : Log-Structured File System Network - NFS : Network File System - AFS : Andrew File System File-System Case


  1. Receiver Remembers Messages Sender Receiver [send message] � [recv message] � [send ack] � � � � � [timout] � [send message] � [ignore message] � [send ack] � [recv ack]

  2. Receiver Remembers Messages Sender Receiver [send message] � [recv message] � [send ack] � � � � � how do we [timout] � know to ignore? [send message] � [ignore message] � [send ack] � [recv ack]

  3. Solutions Solution 1: remember every message ever sent.

  4. Solutions Solution 1: remember every message ever sent. � Solution 2: sequence numbers - give each message a seq number - receiver knows all messages before an N have been seen - receiver remembers messages sent after N

  5. TCP Most popular protocol based on seq nums. � Also buffers messages so they arrive in order. � Timeouts are adaptive.

  6. Overview Raw messages � Reliable messages � OS abstractions - virtual memory - global file system � Programming-languages abstractions - remote procedure call

  7. Virtual Memory Inspiration : threads share memory � Idea : processes on different machines share mem

  8. Virtual Memory Inspiration : threads share memory � Idea : processes on different machines share mem � Strategy : - a bit like swapping we saw before - instead of swap to disk, swap to other machine - sometimes multiple copies may be in memory on different machines

  9. Process on Machine B Process on Machine A PFN valid present PFN valid present - 0 - - 0 - - 0 - - 0 - - 0 - - 0 - - 0 - - 0 - … … … … 21 22 23 24 5 6 7 8

  10. Process on Machine B Process on Machine A PFN valid present PFN valid present - 0 - - 0 - - 1 0 - 1 0 - 1 0 - 1 0 - 1 0 - 1 0 … … … … 21 22 23 24 5 6 7 8 map 3-page region into both memories.

  11. Process on Machine B Process on Machine A PFN valid present PFN valid present - 0 - - 0 - - 1 0 5 1 1 - 1 0 7 1 1 - 1 0 8 1 1 … … … … X Y Z 21 22 23 24 5 6 7 8 A writes X,Y,Z

  12. Process on Machine B Process on Machine A PFN valid present PFN valid present - 0 - - 0 - 23 1 1 5 1 1 - 1 0 7 1 1 - 1 0 8 1 1 … … … … X X Y Z 21 22 23 24 5 6 7 8 B reads 1st page

  13. Process on Machine B Process on Machine A PFN valid present PFN valid present - 0 - - 0 - 23 1 1 5 1 1 22 1 1 7 1 1 - 1 0 8 1 1 … … … … Y X X Y Z 21 22 23 24 5 6 7 8 B reads 2st page

  14. Process on Machine B Process on Machine A PFN valid present PFN valid present - 0 - - 0 - 23 1 1 - 1 0 22 1 1 7 1 1 - 1 0 8 1 1 … … … … Y X’ Y Z 21 22 23 24 5 6 7 8 B writes X’ to 1st page

  15. Process on Machine B Process on Machine A PFN valid present PFN valid present - 0 - - 0 - 23 1 1 6 1 1 22 1 1 7 1 1 - 1 0 8 1 1 … … … … Y X’ X’ Y Z 21 22 23 24 5 6 7 8 A reads 1st page

  16. Virtual Memory Problems What if a machine crashes? - mapping disappears in other machines - how to handle? � Performance? - when to prefetch? - loads/stores expected to be fast � DSM (distributed shared memory) not used today.

  17. Global File System Advantages - file access is already expected to be slow - use common API - no need to modify applications (sorta true, flocks over NFS don’t work) � Disadvantages - doesn’t always make sense, e.g., for video app

  18. Overview Raw messages � Reliable messages � OS abstractions - virtual memory - global file system � Programming-languages abstractions - remote procedure call

  19. RPC R emote P rocedure C all. � What could be easier than calling a function? � Strategy : create wrappers so calling a function on another machine feels just like calling a local function. � This abstraction is very common in industry.

  20. RPC Machine A Machine B int main(…) { int foo(char *msg) { … � } }

  21. RPC Machine A Machine B int main(…) { int foo(char *msg) { int x = foo(); … } } Want main() on A to call foo() on B.

  22. RPC Machine A Machine B int main(…) { int foo(char *msg) { int x = foo(); … } } Want main() on A to call foo() on B.

  23. RPC Machine A Machine B int main(…) { int foo(char *msg) { int x = foo(); … } } � int foo(char *msg) { send msg to B recv msg from B } Want main() on A to call foo() on B.

  24. RPC Machine A Machine B int main(…) { int foo(char *msg) { int x = foo(); … } } � � int foo(char *msg) { void foo_listener() { send msg to B while(1) { recv msg from B recv, call foo } } } Want main() on A to call foo() on B.

  25. RPC Machine A Machine B int main(…) { int foo(char *msg) { int x = foo(); … } } � � int foo(char *msg) { void foo_listener() { send msg to B while(1) { recv msg from B recv, call foo } } } Actual calls.

  26. RPC Machine A Machine B int main(…) { int foo(char *msg) { int x = foo(); … } } � � int foo(char *msg) { void foo_listener() { send msg to B while(1) { recv msg from B recv, call foo } } } What it feels like for programmer.

  27. RPC Machine A Machine B int main(…) { int foo(char *msg) { int x = foo(); … } } � � int foo(char *msg) { void foo_listener() { send msg to B while(1) { client server recv msg from B recv, call foo wrapper wrapper } } } Wrappers.

Recommend


More recommend