CSC 290e Mobile Computing Introduction to Distributed Computing (cont.) 17 September 2001 --------------------------- Three basic ways to design distributed applications: message passing - the programmer explicitly uses unicast/multicast to exchange information between hosts remote procedure call - to programmer, it looks like making a normal procedure call, but the call is done remotely, and the answer shipped back. Java's RMI (Remote Method Invocation) is one example implementation. shared memory - the programmer sees a large piece of memory which it and other processes/hosts have access to. Lime (my middleware for mobile applications) is a shared memory model, and so it Interweave (a middleware designed by Michael Scott, Sandhya Dwarkadas and students). --------------------------- Some key concepts in distributed systems: Event ordering Happened before A->B 1. A executed before B in same process 2. A sendX B receive X 3. A->B and B->C implies A->C may seem easy, but without synchronized clocks, this is difficult. Mutual Exclusion - ensure two processes have proper synchronization when accessing critical data or doing critical operations A simple solution uses a central coordinator - tell coordinator you want into the critical section - coordinator grants only one access at a time - what if coordinator dies? - what if process granted access dies? Another alternative is token-based. - Enter critical section when hold token - if no one wants into CS, still use bandwidth - what if holder of token dies? Dining Philosophers is distributed, pairwise mutex Leader Election - elect one process/host to lead assume know id of all other hosts <<