Marshalling in Distributed System - GeeksforGeeks (2023)

Table of Contents
Approaches: Java FAQs Videos

A Distributed system consists of numerous components located on different machines that communicate and coordinate operations to seem like a single system to the end-user.

External Data Representation:

Data structures are used to represent the information held in running applications. The information consists of a sequence of bytes in messages that are moving between components in a distributed system. So, conversion is required from the data structure to a sequence of bytes before the transmission of data. On the arrival of the message, data should also be able to be converted back into its original data structure.

Different types of data are handled in computers, and these types are not the same in every position where data must be transmitted. Individual primitive data items can have a variety of data values, and not all computers store primitive values like integers in the same order. Different architectures also represent floating-point numbers differently. Integers are ordered in two ways, big-endian order, in which the Most Significant Byte (MSB) is placed first, and little-endian order, in which the Most Significant Byte (MSB) is placed last or the Least Significant Byte (LSB) is placed first. Furthermore, one more issue is the set of codes used to represent characters. Most applications on UNIX systems use ASCII character coding, which uses one byte per character, whereas the Unicode standard uses two bytes per character and allows for the representation of texts in many different languages.

There should be a means to convert all of this data to a standard format so that it can be sent successfully between computers. If the two computers are known to be of the same type, the external format conversion can be skipped otherwise before transmission, the values are converted to an agreed-upon external format, which is then converted to the local format on receiving. For that, values are sent in the sender’s format, along with a description of the format, and the recipient converts them if necessary. It’s worth noting, though, that bytes are never changed during transmission. Any data type that can be supplied as a parameter or returned, as a result, must be able to be converted and the individual primitive data values expressed in an accepted format to support Remote Procedure Call (RPC) or Remote Method Invocation (RMI) mechanisms. So, an external data representation is a standard for representing data structures and primitive values that have been agreed upon.

  • Marshalling: Marshalling is the process of transferring and formatting a collection of data structures into an external data representation type appropriate for transmission in a message.
  • Unmarshalling: The converse of this process is unmarshalling, which involves reformatting the transferred data upon arrival to recreate the original data structures at the destination.


There are three ways to successfully communicate between various sorts of data between computers.

1. Common Object Request Broker Architecture (CORBA):

CORBA is a specification defined by the Object Management Group (OMG) that is currently the most widely used middleware in most distributed systems. It allows systems with diverse architectures, operating systems, programming languages, and computer hardware to work together. It allows software applications and their objects to communicate with one another. It is a standard for creating and using distributed objects. It is made up of five major components. Components and their function are given below:

  • Object Request Broker (ORB): It provides a communication infrastructure for the objects to communicate across a network.
  • Interface Definition Language (IDL): It is a specification language used to provide an interface in a software component. To exemplify, it allows communication between software components written in C++ and Java.
  • Dynamic Invocation Interface (DII): Using DII, client applications are permitted to use server objects without even knowing their types at compile time. Here client obtains an instance of a CORBA object and then invocation requests can be made dynamically on the corresponding object.
  • Interface Repository (IR): As the name implies, interfaces can be added to the interface repository. The purpose of IR is that a client should be able to find an object which is not known at compile-time and information about its interface then request is made to be sent to ORB.
  • Object Adapter (OA): It is used to access ORB services like object reference generation.

Marshalling in Distributed System - GeeksforGeeks (1)

Data Representation in CORBA:

Common Data Representation (CDR) is used to describe structured or primitive data types that are supplied as arguments or results during remote invocations on CORBA distributed objects. It allows clients and servers’ built-in computer languages to communicate with one another. To exemplify, it converts little-endian to big-endian.

There are 15 primitive types: short (16-bit), long (32-bit), unsigned short, unsigned long, float (32-bit), double (64-bit), char, boolean (TRUE, FALSE), octet (8-bit), and any (which can represent any basic or constructed type), as well as a variety of composite types.

(Video) RMI architecture | distributed system | Lec-23 | Bhanu Priya

CORBA CDR Constructed Types:

Let’s have a look at Types with their representation:

  • sequence: It refers to length (unsigned long) to be followed by elements in order
  • string: It refers to length (unsigned long) followed by characters in order (can also have wide characters)
  • array: The elements of the array follow order and length is fixed so not specified.
  • struct: in the order of declaration of components
  • enumerated: It is unsigned long and here, the values are specified by the order declared.
  • union: type tag followed by the selected member


struct Person {string name;string place;long year;};

Marshalling CORBA:

From the specification of the categories of data items to be transmitted in a message, Marshalling CORBA operations can be produced automatically. CORBA IDL describes the types of data structures and fundamental data items and provides a language/notation for specifying the types of arguments and results of RMI methods.

2. Java’s Object Serialization:

Java Remote Method Invocation (RMI) allows you to pass both objects and primitive data values ​​as arguments and method calls. In Java, the term serialization refers to the activity of putting an object (an instance of a class) or a set of related objects into a serial format suitable for saving to disk or sending in a message.

Java provides a mechanism called object serialization. This allows an object to be represented as a sequence of bytes containing information about the object’s data and the type of object and the type of data stored in the object. After the serialized object is written to the file, it can be read from the file and deserialized. You can recreate an object in memory with type information and bytes that represent the object and its data.

Marshalling in Distributed System - GeeksforGeeks (2)

Moreover, objects can be serialized on one platform and deserialized on completely different platforms as the whole process is JVM independent.

For example, the Java class equivalent to the Person struct defined in CORBA IDL might be:



public class Person implements Serializable {

(Video) XML Marshalling and UnMarshalling using Spring and Castor XML binding framework - Annotation Config

public String name;

public String place;

public int phonenumber;

public void letter() {

System.out.println("Issue a letter to " + name + " " + place);



(Video) Remote Procedure Calls (RPC)

3. Extensible Markup Language (XML):

Clients communicate with web services using XML, which is also used to define the interfaces and other aspects of web services. However, XML is utilized in a variety of different applications, including archiving and retrieval systems; while an XML archive is larger than a binary archive, it has the advantage of being readable on any machine. Other XML applications include the design of user interfaces and the encoding of operating system configuration files.

In contrast to HTML, which employs a fixed set of tags, XML is extensible in the sense that users can construct their tags. If an XML document is meant to be utilized by several applications, the tag names must be unique.

(Video) Java Interprocess Communication Challenges in Low-Latency Deployments

Clients, for example, typically interface with web servers via SOAP messages. SOAP is an XML standard with tags that web services and their customers can utilize. Because it is expected that the client and server sharing a message have prior knowledge of the order and types of information it contains, some external data representations (such as CORBA CDR) do not need to be self-describing. On the other hand, XML was designed to be utilized by a variety of applications for a variety of reasons. This has been made possible by the inclusion of tags and the usage of namespaces to specify the meaning of the tags. Furthermore, the usage of tags allows applications to pick only the portions of a document that they need to process.


XML definition of the Person struct:<person id="9865"> <name>John</name> <place>England</place> <year>1876</year> <!-- comment --></person>


Marshalling is used to create various remote procedure call (RPC) protocols, where separate processes and threads often have distinct data formats, necessitating the need for marshalling between them.

To transmit data across COM object boundaries, the Microsoft Component Object Model (COM) interface pointers employ marshalling. When a common-language-runtime-based type has to connect with other unmanaged types via marshalling, the same thing happens in the.NET framework. DCOM stands for Distributed Component Object Model.

Marshalling in Distributed System - GeeksforGeeks (3)

Scripts and applications based on the Cross-Platform Component Object Model (XPCOM) technology are two further examples where marshalling is crucial. The Mozilla Application Framework makes heavy use of XPCOM, which makes considerable use of marshalling.

So, XML (Extensible Markup Language) is a text-based format for expressing structured data. It was designed to represent data sent in messages exchanged by clients and servers in web services

The primitive data types are marshalled into a binary form in the first two ways- CORBA and Java’s object serialization. The primitive data types are expressed textually in the third technique (XML). A data value’s textual representation will typically be longer than its binary representation. The HTTP protocol is another example of the textual approach.

On the other hand, type information is included in both Java serialization and XML, but in distinct ways. Although Java serializes all of the essential type information, XML documents can refer to namespaces, which are externally specified groups of names (with types).

My Personal Notesarrow_drop_up

(Video) Remote Method Invocation


What is marshalling and unmarshalling in distributed system? ›

Marshalling: the act of taking a collection of data items (platform dependent) and assembling them into the external data representation (platform independent). Unmarshalling: the process of disassembling data that is in external data representation form, into a locally interpretable form.

What is the concept of marshaling? ›

noun. variants also marshalling. : an equitable doctrine requiring that if one creditor can obtain satisfaction of a claim from only one fund and a second creditor can obtain satisfaction from more than one fund the second creditor must claim against the fund that the other creditor cannot reach.

What is the difference between marshalling and unmarshalling? ›

To "marshal" an object means to record its state and codebase(s) in such a way that when the marshalled object is "unmarshalled," a copy of the original object is obtained, possibly by automatically loading the class definitions of the object.

What is marshalling in a remote procedure call? ›

Marshalling includes converting the representation of the parameters into a standard format, and copying each parameter into the message. The client stub passes the message to the transport layer, which sends it to the remote server machine.

What is marshalling in distributed systems? ›

Marshalling: Marshalling is the process of transferring and formatting a collection of data structures into an external data representation type appropriate for transmission in a message.

What is meant by marshalling in distributed systems? ›

In distributed system different modules can use different representations for the same data. To exchange such data between modules, it is necessary to reformat the data. This operation (called marshalling) needs some computer time and sometimes it is most expensive part in network communication.

What is the objective of marshalling? ›

Marshalling is an equitable principle which aims to prevent one secured creditor arbitrarily depriving another secured creditor of his only security. Traditionally it applies where the same debtor owes debts to two secured creditors.

What is the importance of marshalling? ›

Marshalling is very important for moving a large aircraft safely and accurately. On behalf of the pilots in the cockpit with relatively narrow visibility, the marshaller watches for obstacles on the ground, and makes sure the aircraft does not strike other aircraft.

What is the rule of marshaling? ›

A creditor who invokes the marshaling doctrine (sometimes spelled “marshalling” and also known as the “two funds” doctrine) asks a court to force a superior creditor to satisfy their debt out of the security interest which the invoking creditor does not have a lien against.

What is the difference between marshalling and serialization? ›

Marshaling and serialization are loosely synonymous in the context of remote procedure call, but semantically different as a matter of intent. In particular, marshaling is about getting parameters from here to there, while serialization is about copying structured data to or from a primitive form such as a byte stream.

Why do we need marshalling and unmarshalling? ›

Marshalling and unmarshalling is used both on the client and server side. On the server side it is used to map an incoming request to a Scala or Java object and to map a Scala or Java object to an outgoing response.

What is marshalling and unmarshalling data? ›

Marshalling is the process of converting Java objects into a format that is transferable over the wire. Unmarshalling is the reversal of this process where data read from a wire format is converted into Java objects.

What are the methods of marshalling? ›

The following are ways of marshalling the balance sheet:
  • Order of permanence.
  • Order of liquidity.
  • Mixed order.

What are the types of marshalling? ›

What are the types of marshalling?
  • Order of permanence.
  • Order of liquidity.
  • Mixed order.

Why is it called marshalling? ›

The word Marshal comes from Millitary terms. Such as to Marshal ones troops and move them somewhere else.

How do I apply for marshalling? ›

How to Apply. If you're considering judge marshalling for the first time, the first step would be to contact your local courts via telephone or email and enquire about the opportunity to marshal a judge. Then, you will be advised on whether judge marshalling is available and the instructions for applying.

What are the equipment used in marshalling? ›

The usual equipment of a Marshaller is a reflecting safety vest, a helmet with acoustic earmuffs, and gloves or marshaling wands, handheld illuminated beacons.

What are marshalling signals? ›

Marshalling is visual communication that guides pilots to turn, slow down, stop, and shut down engines, leading the aircraft to its parking stand or runway. It is a part of an aircraft's ground handling. Learn nonverbal (visual) communication between ground personnel and cockpit crew.

What is the difference between marshalling and contribution? ›

Marshalling is the right of subsequent mortgagees whereas contribution is with respect to mortgagors. Marshalling is if a creditor has multiple funds to realize his debt, he must first pursue the multiple funds instead of prejudicing the creditor who is secured only by one fund.

What is the difference between marshalling and subrogation? ›

The difference here is that under marshalling one or more properties belong to one person but in contribution, their properties belong to two or more persons. Subrogation is a right of a person to stand in the place of the creditor after paying off his liabilities.

What is an example of marshalling of assets? ›

(Rs.) CapitalCash in HandTrade CreditorsCash at BankLoansInvestmentsBills PayableBills ReceivableDebtorsStock (closing)StoresFurniture and FixturesPlant and MachineryLand and Buildings.

What is marshalling in API? ›

Marshalling is the process of converting a higher-level (object) structure into some kind of lower-level representation, often a “wire format”. Other popular names for marshalling are “serialization” or “pickling”.

What is marshalling in JSON? ›

Marshal . -Encoding/decoding JSON refers to the process of actually reading/writing the character data to a string or binary form. - Marshaling/Un marshaling refers to the process of mapping JSON types from and to Go data types and primitives.

What is parameter marshalling? ›

Marshalling is the packing of procedure parameters into a message packet.

What is marshalling and unmarshalling in RMI? ›

Marshalling and Unmarshalling

In case the parameters are objects, then they are serialized. This process is known as marshalling. At the server side, the packed parameters are unbundled and then the required method is invoked. This process is known as unmarshalling.

What is the difference between grouping and marshalling? ›

Marshalling refers to the arrangement of assets & liabilities in a balance sheet, whereas, Grouping refers to the presentation of items of similar characteristics under one head. Example - Inventories in the balance sheet comprise of Raw Material, Work-in-Progress & Finished Stock. This is called Grouping.

What is JAXB marshalling and unmarshalling? ›

JAXB definitions

Marshalling is the process of transforming Java objects into XML documents. Unmarshalling is the process of reading XML documents into Java objects. The JAXBContext class provides the client's entry point to the JAXB API. It provides API for marshalling, unmarshalling and validating.

What is marshalling and unmarshalling in Android? ›

Marshalling: A procedure for converting higher level application data structures into parcels for purpose of embedding into Binder transaction. Unmarshalling: A procedure for reconstructing higher-level application data-structures from parcels received though binder transactions.

What is marshalling and unmarshalling in spring boot? ›

As stated in the introduction, a marshaller serializes an object to XML, and an unmarshaller deserializes XML stream to an object. In this section, we will describe the two Spring interfaces used for this purpose.


1. Learn with TCS: MapReduce (Nano Course)
(TCS Videos)
2. How Amazon's automated reasoning team use verification methods | Amazon Science
(Amazon Science)
3. CORBA : What is CORBA in Distributed System ? : Distributed System
(Computer Science Academy By Dinesh Sir)
4. Interaction model of distributed system
(Last Night Study)
5. Map : key, value pair elements
(Hello ai)
6. Remote Procedure Call
(Umakant Kulkarni)
Top Articles
Latest Posts
Article information

Author: Kelle Weber

Last Updated: 03/15/2023

Views: 5931

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.