 Hello, everyone, myself, M. M. Hunt working in computer science and engineering department as an assistant professor in Vulture Institute of Technology, Solapur. Today, we are discussing the topic, encoding and decoding of messages in distributed system. Learning outcomes. At the end of this session, student will be able to describe encoding and decoding operation of data in distributed system and apply failure handling mechanisms in distributed systems. Introduction. Process communication is the mechanism provided by the operating system that allows processes to communicate with each other. Here P1 and P2 processes which residing on two different systems or nodes, they are communicating with each other. P1 is sending message to P1 and P2 is sending the message to P1. So P1 and P2, they are sending the message to each other. Process communication is the mechanism provided by the operating system that allows process to communicate with each other. This communication could involve a process letting another process know that some event has occurred or transferring of data from one process to another. One of the models of process communication is the message passing model. Message passing model allows multiple processes to read and write data to the message queue. Messages are stored on the queue until their recipient retries them. Message queues are quite useful for inter-process communication and are used by most operating system. Information physically copied from center address space to receive address space. Distributed system uses message-based inter-process communication for most applications. Address contains sending process ID and resting process ID. Sequence number consists of consisting of message ID which is useful for identifying lost or duplicate messages. So due to this sequence number or due to this ID of messages we are easily getting the duplicate message or lost messages in message passing model. So these four bits are related to the message encoding and decoding in the message passing model. Encoding and decoding of message data. Two types of representations are used for encoding and decoding of data. Tagged representation and untagged representation. In tagged representation the type of program object along with its values encoded in message. In untagged representation the message data contains only program objects. The receiving process must have a prior knowledge of how to decode the data. Both sender and receiver must carefully aware of the format of data encoded in the message. Process addressing. Addressing involved parties a message passing system support two types of addressing. Explicit addressing and implicit addressing. The explicit addressing in the syntax send the parameters are process ID and message and receive primitive. The parameters are receive process ID and the message. Implicit addressing. Here the syntax is send any means the parameters are send ID and message. Here send a message to any process that provides service of type service ID for functional addressing. The next primitive receive any. The parameters are process ID and message. Receive a message from any process and return the process ID of the process from which the message was received. How to form process ID? Simple method to identify the process is to use a combination of machine ID and local ID. The syntax is machine ID iterate local ID where local ID is the process identifier or port identifier of receiving process. This method is used in Berkley Unix with 32-bit internet address for machine ID and 16-bit number for local ID. Advantage. No global coordination is required to generate unique process IDs. Disadventure does not allow process migration. Process can be identified by three fields. Machine ID, local ID and machine ID. The first field identifies the node on which process was created. The second field local identifier generated by node on which the process is created. Third field identifies the last known of the node or last location of the node of the process. The value of first two fields never changed during its lifetime of process but the third may change. This is also known as link-based process addressing. The kernel of sending machine delivers the message to the machine whose machine ID is specified in the third field of the receiving process address. Disadvantage is a lot of overhead in locating a process if processes have migrated several times. If an intermediate node on which the process once resided is down then it is not possible to locate the process. Two-level naming. Achieve location transparency in process addressing. Each process two identifiers. High-level name which is the machine dependent. Low-level name which is machine dependent. A surname server maintains a mapping table to map a high-level names of process to their low-level names. The sending kernel also caches a high-level name to low-level name mapping information of the receiver process for further use so that the name server need not be contacted every time. Advantages. Support process migration easily. Suitable for functional addressing for high-level name identified. Service instead of process. Disadvantage. Poor scalability and poor reliability. Centralized component. Maintain replicas of name server but problem of consistency. Pause the video and write down your answer. What are the different causes of failure in distributed system? The causes are in failure handling. Node crash or link failure may lead to the following problems. Lost of request message by the sender. Lost of response message by the receiver. Unsuccessful execution of sender or receiver. There will be unsuccessful execution of the request message. Interprocess communication has different protocol to handle these problems. So this is lost of request message, response message, unsuccessful executions or node crash. These are the different causes of failure handling. Three message reliable protocol. Here client will be sending a request to the server. Server will be taking the function or method name and parameter executing that method and it will be the result of that method will be returning to the client and client will be getting that result and sending the acknowledgement to the server. So this is three message reliable protocol. Here request message from client to server, reply message from server to client, acknowledge message from client to server. So this is three message reliable protocol. Fault tolerant communication. Here one side is client and other side is server. So request is sent from client to server. The message get lost. Again the message will be sending from client to server. Here server after reaching the server may crash. Again we are sending the message from client to server. Here the message is successful at the server side execution can be takes place but the response message get lost. Again we are sending that message. Now this time the message successful reached at the server side execution can take place and the response is sending to the client. So this is first, this is called as a fault tolerant communication. The last routine is called as a fault tolerant communication. The first message gets lost, then server crash, then response message get lost. But last time this transmission can be executed successfully. Not an important routine. We can take the example of the ATM machine debit 100 if balance greater than equal to amount balance equal to balance minus amount return success balance return failure end. Client means the user who is withdrawing 100 rupees. So request can be sent from client to server. So debit 100 rupees. So at server side balance is 1000. So proceed debit balance routine now 1000 minus 100 equal to 900. Reign rate success is sending to the client from the server. But this message get lost. Again client to be sending second message debit 100 from client to server. Here proceed debit routine the balance from current balance it will be deducted 900 minus 100 equal to 800. So here server will be sending to the client the message in the form response success 800. So this balance success 800 is the logically not correct. So this routine is called as non-adempotent routine. So first message get lost again it will be resending and from the current balance the 900 to be deducted. So success 800 is the wrong message or wrong result getting to the client. Now exactly one semantics using the request identifier and reply cache. So at the server side when reply cache is maintained whose attributes are request identifier and reply to be sent. Here client is sending the request debit 100 and at the server side check reply from in the cache for the request one no match found to the process request one save the reply and return 1000 minus 100 equal to 900 return success 900 to the client. But the in the response success 900 message get lost again resending that message to buy the client to the server debit 100 check the reply in the cache for request one match found exact reply. So here that return request one previously visited is stored in the one row that result will be get phased. So reply to be sent is taken from this table and that is return success 900 will be sending to the client. So response in the success 900. So at the client end we are getting the balance of 100. This is the correct answer. So exactly one semantics using the request identifier and reply cache. So here every request and its reply stored in this table and we cannot get the duplicate message or lost message due to this table. So this is called as exact one semantics. So now not I had to put it routine with exactly once when using the request identifier using reply cache. Reproducing duplicate request is avoided. Range of request identifier should be much larger than the number of entries in the reply cache. These are the references. Thank you.