0% found this document useful (0 votes)
36 views7 pages

Code Migration in Distributed Systems

The document discusses code migration in distributed computing, highlighting its evolution from process migration to more flexible models that allow dynamic code movement between machines. It emphasizes the performance benefits of moving code closer to data and the importance of load distribution algorithms, while also addressing the challenges of security and resource management. Additionally, it distinguishes between weak and strong mobility, sender-initiated and receiver-initiated migration, and introduces concepts like remote cloning for improved distribution transparency.

Uploaded by

zoro80290
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views7 pages

Code Migration in Distributed Systems

The document discusses code migration in distributed computing, highlighting its evolution from process migration to more flexible models that allow dynamic code movement between machines. It emphasizes the performance benefits of moving code closer to data and the importance of load distribution algorithms, while also addressing the challenges of security and resource management. Additionally, it distinguishes between weak and strong mobility, sender-initiated and receiver-initiated migration, and introduces concepts like remote cloning for improved distribution transparency.

Uploaded by

zoro80290
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Department of Computer Engineering

SEM- VIII Distributed Computing

Module - 4
Code Migration

Traditionally, code migration in distributed systems took place in the form of process
migration in which an entire process was moved from one machine to another. Moving a
running process to a different machine is a costly and intricate task, and there had better
be a good reason for doing so. That reason has always been performance. The basic idea
is that overall system performance can be improved if processes are moved from
heavily-loaded to lightly-loaded machines. Load is often expressed in terms of the CPU
queue length or CPU utilization, but other performance indicators are used as well. Load
distribution algorithms by which decisions are made concerning the allocation and
redistribution of tasks with respect to a set of processors, play an important role in
compute-intensive systems. However, in many modern distributed systems, optimizing
computing capacity is less an issue than, for example, trying to minimize communication.
Moreover, due to the heterogeneity of the underlying platforms and computer networks,
performance improvement through code migration is often based on qualitative reasoning
instead of mathematical models. Consider, for example, a client-server system in which
the server manages a huge database. If a client application needs to do many database
operations involving large quantities of data, it may be better to ship part of the client
application to the server and send only the results across the network. Otherwise, the
network may be swamped with the transfer of data from the server to the client. In this
case, code migration is based on the assumption that it generally makes sense to process

Code Migration Ashvini Gaikwad


Department of Computer Engineering
SEM- VIII Distributed Computing

data close to where those data reside This same reason can be used for migrating parts of
the server to the client. For example, in many interactive database applications, clients
need to fill in forms that are subsequently translated into a series of database operations.
Processing the form at the client side, and sending only the completed form to the server,
can sometimes avoid that a relatively large number of small messages need to cross the
network. The result is that the client perceives better performance, while at the same time
the server spends less time on form processing and communication. Support for code
migration can also help improve performance by exploiting parallelism, but without the
usual intricacies related to parallel programming. A typical example is searching for
information in the Web. It is relatively simple to implement a search query in the form of
a small mobile program that moves from site to site. By making several copies of such a
program, and sending each off to different sites, we may be able to achieve a linear
speed-up compared to using just a single program instance. Besides improving
performance, there are other reasons for supporting code migration as well. The most
important one is that of flexibility. The traditional approach to building distributed
applications is to partition the application into different parts, and deciding in advance
where each part should be executed. However, if code can move between different
machines, it becomes possible to dynamically configure distributed systems. For
example, suppose a server implements a standardized interface to a file system. To allow
remote clients to access the file system, the server makes use of a proprietary protocol.
Normally, the client-side implementation of the file system interface, which is based on
that protocol, would need to be linked with the client application. This approach requires

Code Migration Ashvini Gaikwad


Department of Computer Engineering
SEM- VIII Distributed Computing

that the software be readily available to the client at the time the client application is
being developed. An alternative is to let the server provide the client’s implementation no
sooner than is strictly necessary, that is, when the client binds to the server. At that point,
the client dynamically downloads the implementation, goes through the necessary
initialization steps, and subsequently invokes the server. This principle is shown in Fig.
3-7. This model of dynamically moving code from a remote site does require that the
protocol for downloading and initializing code is standardized. Also, it is necessary that
the downloaded code can be executed on the client’s machine. Different solutions are
discussed below and in later chapters. The important advantage of this model of
dynamically downloading client side software, is that clients need not have all the
software preinstalled to talk to servers. Instead, the software can be moved in as
necessary, and likewise, discarded when no longer needed. Another advantage is that as
long as interfaces are standardized, we can change the client-server protocol and its
implementation as often as we like. Changes will not affect existing client applications
that rely on the server. There are, of course, also disadvantages. Blindly trusting that the
downloaded code implements only the advertised interface while accessing your
unprotected hard disk and does not send the juiciest parts to heaven-knows-who may not
always be such a good idea.

Code Migration Ashvini Gaikwad


Department of Computer Engineering
SEM- VIII Distributed Computing

Models for Code Migration

Although code migration suggests that we move only code between machines, the term
actually covers a much richer area. Traditionally, communication in distributed systems is
concerned with exchanging data between processes. Code migration in the broadest sense
deals with moving programs between machines, with the intention to have those
programs be executed at the target. In some cases, as in process migration, the execution
status of a program, pending signals, and other parts of the environment must be moved
as well. In this framework, a process consists of three segments. The code segment is the
part that contains the set of instructions that make up the program that is being executed.

Code Migration Ashvini Gaikwad


Department of Computer Engineering
SEM- VIII Distributed Computing

The resource segment contains references to external resources needed by the process,
such as files, printers, devices, other processes, and so on. Finally, an execution segment
is used to store the current execution state of a process, consisting of private data, the
stack, and the program counter. The bare minimum for code migration is to provide only
weak mobility. In this model, it is possible to transfer only the code segment, along with
perhaps some initialization data. A characteristic feature of weak mobility is that a
transferred program is always started from its initial state. This is what happens, for
example, with Java applets. The benefit of this approach is its simplicity. Weak mobility
requires only that the target machine can execute that code, which essentially boils down
to making the code portable. We return to these matters when discussing migration in
heterogeneous systems. In contrast to weak mobility, in systems that support strong
mobility the execution segment can be transferred as well. The characteristic feature of
strong mobility is that a running process can be stopped, subsequently moved to another
machine, and then resume execution where it left off. Clearly, strong mobility is much
more powerful than weak mobility, but also much harder to implement. An example of a
system that supports strong mobility is D’Agents, which we discuss later in this section.
Irrespective of whether mobility is weak or strong, a further distinction can be made
between sender-initiated and receiver-initiated migration.
In sender initiated migration, migration is initiated at the machine where the code
currently resides or is being executed. Typically, sender-initiated migration is done when
uploading programs to a computer server. Another example is sending a search program
across the Internet to a Web database server to perform the queries at that server. In

Code Migration Ashvini Gaikwad


Department of Computer Engineering
SEM- VIII Distributed Computing

receiver-initiated migration, the initiative for code migration is taken by the target
machine. Java applets are an example of this approach.
Receiver-initiated migration is often simpler to implement than sender initiated
migration. In many cases, code migration occurs between a client and a server, where the
client takes the initiative for migration. Securely uploading code to a server, as is done in
sender-initiated migration, often requires that the client has previously been registered
and authenticated at that server. In other words, the server is required to know all its
clients, the reason being is that the client will presumably want access to the server’s
resources such as its disk. Protecting such resources is essential. In contrast, downloading
code as in the receiver-initiated case, can often be done anonymously. Moreover, the
server is generally not interested in the client’s resources. Instead, code migration to the
client is done only for improving client-side performance. To that end, only a l
imited number of resources need to be protected, such as memory and network
connections. In the case of weak mobility, it also makes a difference if the migrated code
is executed by the target process, or whether a separate process is started. For example,
Java applets are simply downloaded by a Web browser and are executed in the browser’s
address space. The benefit of this approach is that there is no need to start a separate
process, thereby avoiding communication at the target machine. The main drawback is
that the target process needs to be protected against malicious or inadvertent code
executions. A simple solution is to let the operating system take care of that by creating a
separate process to execute the migrated code. Note that this solution does not solve the
resource-access problems just mentioned. Instead of moving a running process, also

Code Migration Ashvini Gaikwad


Department of Computer Engineering
SEM- VIII Distributed Computing

referred to as process migration, strong mobility can also be supported by remote cloning.
In contrast to process migration, cloning yields an exact copy of the original process, but
now running on a different machine. The cloned process is executed in parallel to the
original process. In UNIX systems, remote cloning takes place by forking off a child
process and letting that child continue on a remote machine. The benefit of cloning is that
the model closely resembles the one that is already used in many applications. The only
difference is that the cloned process is executed on a different machine. In this sense,
migration by cloning is a simple way to improve distribution transparency.
The various alternatives for code migration are summarized in Fig. 3-8.

Code Migration Ashvini Gaikwad

Common questions

Powered by AI

Dynamic downloading of software in distributed systems offers several advantages, such as reducing the need for pre-installed client software, thereby minimizing the amount of software the client must maintain . It also allows changes to server protocols and implementations without affecting existing client applications, as long as interfaces are standardized . Disadvantages include security risks, such as executing untrusted code which might access sensitive client data . There is also a potential performance overhead associated with downloading and initializing software every time it is needed .

The primary motivation for code migration in distributed systems is performance improvement. Code migration can enhance system performance by relocating processes from heavily-loaded to lightly-loaded machines, thus optimizing CPU utilization and reducing network data traffic . For example, in a client-server system that involves numerous database operations, migrating the client application closer to the server reduces communication overhead . Flexibility is another motivation for code migration. It allows dynamic configuration of distributed systems by using a model where code components move between machines as needed, rather than pre-installing all necessary software . This flexibility enables changes in client-server protocols and implementations without affecting existing client applications as long as interfaces remain standardized .

Allowing code migration introduces security risks such as unauthorized data access, malicious code execution, and potential exposure of sensitive resources . In server environments, clients need to be authenticated and authorized, preventing unauthorized access to resources . In clients, downloaded code must be verified to avoid executing potentially harmful programs . Strategies to mitigate these risks include implementing robust authentication and authorization mechanisms, using secure communication protocols, sandboxing environments to run downloaded code, and conducting regular security audits . Ensuring code only executes within its intended operational boundaries is crucial to maintaining security integrity in dynamic distributed environments.

It is essential for dynamically moved code to adhere to standardized protocols to ensure compatibility and interoperability across different machines and systems . Standardization allows clients and servers to communicate effectively, enabling seamless integration of dynamically downloaded software without requiring changes to the client applications . Failure to standardize can lead to compatibility issues, increased development overhead to handle diverse systems, and potential security vulnerabilities as devices might interpret or execute the code incorrectly, which can compromise system integrity .

Migrating client applications closer to servers can significantly improve network performance by reducing the amount of data transferred across the network . When client applications are closer to servers, data operations can be processed locally, minimizing the need for data to traverse the network. This can reduce latency, congestion, and the demand on network bandwidth, improving overall system responsiveness and efficiency . As a result, network performance is enhanced as the transfer of large volumes of data between the client and server is minimized, reducing potential bottlenecks .

Weak mobility involves transferring only the code segment, along with some initialization data, without any execution state. This means a transferred program starts from its initial state each time . This model is simpler and requires only that the code can execute on the target machine . In contrast, strong mobility involves transferring the entire execution state, allowing a process to be paused, moved to another machine, and resumed exactly where it left off . Strong mobility is more powerful as it enables continuous execution across machines, but it is also harder to implement . The primary implication of weak mobility is simplicity and portability, while strong mobility allows for seamless process continuation, demanding more resources and sophisticated support systems.

Receiver-initiated code migration simplifies implementation because it often does not require client registration or authentication, allowing clients to anonymously download code from servers . The server does not need to know the client's identity since it typically accesses only its resources . This reduces administrative overhead and complexity compared to sender-initiated migration, which requires pre-established trust relationships and authentication because the client needs access to server resources . However, the potential risks of receiver-initiated migration include security concerns, such as executing untrusted code on client machines, which could lead to unauthorized access to client data or system compromise .

Load distribution algorithms play a critical role in code migration by making decisions regarding the allocation and redistribution of tasks among processors, thus optimizing computing power and balancing workload . These algorithms are crucial in traditional systems to improve performance by moving tasks from overloaded machines to those with spare capacity . However, their importance is diminishing in modern distributed systems because optimizing computing capacity has become less critical compared to minimizing communication overhead. Heterogeneous platforms require qualitative reasoning for performance improvements, and systems often prioritize minimizing data transfer over strictly balancing loads .

Process migration involves moving a running process, its execution state, and environment to another machine, allowing it to resume execution there . This method supports strong mobility, enabling continuous execution across machines. Remote cloning, however, creates an exact copy of a process on another machine, running both processes in parallel . This method offers simplicity and distribution transparency benefits by maintaining the same model used in many concurrent applications . Process migration benefits scenarios requiring uninterrupted execution, while remote cloning effectively creates redundancy and increases reliability by executing two instances simultaneously.

In the framework of code migration, a process is viewed as consisting of three segments: code, resource, and execution . The code segment contains the instructions that make up the program intended for migration . The resource segment holds references to external resources needed by the process, such as files, devices, and other processes . The execution segment stores the current execution state, including private data, the stack, and the program counter, which allows a process to be resumed precisely . These segments are significant because they determine what part of a process needs to be migrated, and how seamlessly the migration and execution can be continued on a different machine. Strong mobility involves moving all three segments, enabling a complete process transfer, whereas weak mobility might involve only transferring the code segment .

You might also like