Escolar Documentos
Profissional Documentos
Cultura Documentos
Communication in Distributed
Systems
Application
Presentation
Interface
Session
Process B
Application protocol
Presentation protocol
Session protocol
Application
Presentation
Interface
Sessionn
Transport
Transport protocol
Transport
Network
Network protocol
Network
Data link
Physical
Data link
Physical
The data link layer does its work by putting a special bit pattern on
the start and end of each frame, to mark them, as well as computing a
checksum by adding up all the bytes in the frame in a certain way.
The receiver recomputes the checksum from the data and compares
the result to the checksum following the frame. If they agree, ok. If
not, resend.
Hamming code
Frame: 1101011011
Generator: 10011, agreed by the send and the revceiver.
Message after 4 (the degree of the generator) zero bits
are appended: 11010110110000
11010110110000 divide 10011 using modulo 2
division. The remainder is 1110.
Append 1110 to the frame and send it.
When the receiver gets the message, divide it by the
generator, if there is a remainder, there has been an
error.
Presentation Layer
Client-Server Model
Client
Request
Reply
Kernel
Server
Kernel
Network
Request/Reply
4
3
2
Data link
Physical
Advantages
An example of Client-Server
header.h
/* definitions needed by clients and servers.*/
#define MAX_PATH 255 /* maximum length of a file name */
#define BUF_SIZE 1024 /* how much data to transfer at once */
#define FILE_SERVER 243 /* file servers network address */
/* definitions of the allowed operations. */
#define CREATE 1 /* create a new file */
#define READ 2 /* read a piece of a file and return it */
#define WRITE 3 /* write a piece of a file */
#define DELETE 4 /* delete an existing file */
/* Error codes. */
#define OK 0 /* operation performed correctly */
#define E_BAD_OPCODE 1 /* unknown operation requested */
#define E_BAD_PARAM 2 /* error in a parameter */
#define E_IO -3 /* disk error or other I/O error */
#include <header.h>
void main(void)
{
struct message m1, m2; /* incoming and outgoing messages */
int r;
/* result code */
while (1) { /* server runs forever */
receive(FILE_SERVER, &m1); /* block waiting for a message */
switch(m1.opcode) { /* dispatch on type of request */
case CREATE: r = do_create(&m1, &m2); break;
case READ: r = do_read(&m1, &m2); break;
case WRITE: r = do_write(&m1, &m2); break;
case DELETE: r = do_delete(&m1, &m2); break;
default: r = E_BAD_OPCODE;
}
m2.result = r; /* return result to client */
send(m1.source, &m2); /* send reply */
}
}
#include <header.h>
int copy (char *src, char *dst) /* procedure to copy file using the server */
{ struct message m1; /* message buffer */
long position;
/* current file position */
long client = 110;
/* clients address */
Addressing
Solution:
a.The sender can broadcast a special locate packet
containing the address of the destination process.
b. All the kernel check to see if the address is theirs.
c. If so, send back here I am message giving their
network address (machine number).
Client running
Client running
Return from kernel,
process released
Trap to
kernel,
Process blocked
Client running
Return
Trap
Message
copied to
kernel
buffer
Nonblocking primitives
Machine number
Sparse process
address
ASCII names
looked up via
server
Blocking
Blocking
primitives
Nonblocking with
copy to kernel
Nonblocking with
interrupt
Buffering
Unbuffered,
discarding
unexpected
messages
Unbuffered,
temporarily keeping
unexpected messages
Mailboxes
Reliability
Unreliable
Request-Ack-Reply
Ack
Request-Reply-Ack
Acknowledgement
Code
To
Description
REQ
Request
Client
Server
REP
Reply
Server
Client
ACK
Ack
Either
Other
AYA
Are you
alive?
Client
Server
IAA
I am alive
Server
Client
TA
Try again
Server
Client
AU
Address
unknown
Server
Client
Client
REQ
ACK
REP
ACK
REQ
ACK
AYA
IAA
REP
ACK
Server
Server
The client procedure calls the client stub in the normal way.
The client stub builds a message and traps to the kernel.
The kernel sends the message to the remote kernel.
The remote kernel gives the message to the server stub.
The server stub unpacks the parameters and calls the server.
The server does the work and returns the result to the stub.
The server stub packs it in a message and traps to the kernel.
The remote kernel sends the message to the clients kernel.
The clients kernel gives the message to the client stub.
The stub unpacks the result and returns to the client.
Client stub
Pack parameters
Client
Server stub
Server machine
Unpack
parameters
Call
Server
Return
Unpack result
Pack result
Kernel
Return
Kernel
Message transport
over the network
Parameter Passing
Dynamic Binding
When the client calls one of the remote procedure read for
the first time, the client stub sees that is not yet bound to a
server.
The client stub sends message to the binder asking to import
version 3.1 of the file-server interface.
The binder checks to see if one or more servers have already
exported an interface with this name and version number.
If no server is willing to support this interface, the read call
fails; else if a suitable server exists, the binder gives its handle
and unique identifier to the client stub.
The client stub uses the handle as the address to send the
request message to.
Advantages
Disadvantage
Server Crashes
Client Crashes
Implementation Issues
Flow control
overrun error: with some designs, a chip
cannot accept two back-to-back packets
because after receiving the first one, the
chip is temporarily disabled during the
packet-arrived interrupt, so it misses the
start of the second one.
Timer Management
Current time
Current time
14200
14200
Process table
14205
Process 3
14212
Process 2
0
1
2
14216
Process 0
14216
0
14212
14205
Group Communication
Group Membership
Management
Group Addressing
Atomicity
Message Ordering
Overlapping Groups
Group 1
A
4
2
D
3
Scalability
ATM
A virtual circuit
Router
Sender
Receiver
Adaptation layer
ATM layer
Physical layer
An ATM cell
Bytes
5
Header
48
User data