0% found this document useful (0 votes)
17 views12 pages

DC Prac

Uploaded by

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

DC Prac

Uploaded by

Abhay G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

ASSIGNMENT 1

 TCP vs UDP:

 Reliability: TCP ensures delivery and order; UDP doesn't.


 Speed: TCP is slower, UDP is faster.
 Connection: TCP is connection-oriented; UDP is connectionless.
 Use Cases: TCP for data-sensitive apps, UDP for real-time apps.

 Accept in Socket Programming:

 Server listens for connections, and accept establishes a new connection for each
client, allowing dedicated communication.

 Advantages of Socket Programming:

 Enables cross-machine IPC.


 Supports TCP/UDP protocols.
 Allows real-time communication.
 Scalable for multiple clients.

Inter-Process Communication (IPC)

 Uses Client-Server Model: Client makes requests; server responds.


 System Calls:
o Client Side:
1. Socket(): Creates a socket.
2. Connect(): Connects to server.
3. Read(): Reads data from server.
4. Write(): Sends data to server.
o Server Side:
1. Socket(): Creates a socket.
2. Bind(): Binds to IP and port.
3. Listen(): Listens for incoming connections.
4. Accept(): Accepts client connection.
5. Read(): Reads data from client.
6. Write(): Sends data to client.

Socket Types

 Domains:
o UNIX Domain: For local communication.
o Internet Domain: For network communication.
 Types:
o Stream Sockets: Use TCP, reliable and continuous data stream.
o Datagram Sockets: Use UDP, unreliable and message-based communication
ASSIGNMENT 2:

RMI (Remote Method Invocation) allows a Java program to invoke methods on an object
located on a remote server, enabling distributed computing. RMI handles communication,
remote object creation, and garbage collection.

Types of Remote Classes in RMI:

1. Remote Interface: Defines the methods a remote object can invoke. It extends
java.rmi.Remote and declares methods that throw RemoteException.
2. Remote Implementation Class: Implements the remote interface. It extends
UnicastRemoteObject, providing the actual logic for remote methods that clients can
call.

1) Difference between RPC and RMI:

 RPC (Remote Procedure Call): A protocol that allows a program to execute


functions on a remote server. It is often language-independent, focusing on procedural
calls without object-oriented features.
 RMI (Remote Method Invocation): A Java-specific mechanism that allows methods
to be invoked on remote objects. RMI is object-oriented, meaning it supports Java’s
features like inheritance and polymorphism, allowing more complex interactions with
remote objects.

2)What rmic does:

 The rmic tool, or RMI compiler, generates stub and skeleton classes for remote
objects. The stub acts as a proxy on the client side, forwarding method calls to the
remote server. The skeleton on the server side receives these calls, processes them,
and sends the results back to the client (skeletons are needed in pre-Java 2 versions).

3)Importance of the RMI Registry:

 The RMI registry is a simple directory service where remote objects are registered by
name. It allows clients to look up and retrieve remote object references, which they
can use to invoke methods on the server. This registry simplifies discovering and
connecting to remote objects in a distributed environment.
Assignment 3

1)

Feature RPC (Remote Procedure Call) LRPC (Lightweight RPC)


Used for communication between Primarily used for communication within a
Scope client and server, often over a single machine or closely connected
network. systems.
More efficient with lower overhead, as it
Has higher overhead due to network
Efficiency often uses shared memory or local
communication and possible delays.
communication.
Suitable for high-performance applications
Suitable for distributed systems over
Use Case where communication is within a local
a network.
system.
Generally slower due to network Faster due to reduced network and
Speed
latency. communication layers.

RPC (Remote Procedure Call)

 Transparency:
o Syntactic Transparency: RPC and LPC have the same syntax.
o Semantic Transparency: RPC and LPC have the same meaning.

Elements of RPC:

1. Client: Initiates the remote procedure call.


2. Client Stub: Local proxy that sends the call to the server.
3. RPC Runtime: Manages communication between client and server.
4. Server Stub: Unpacks the call and invokes the server function.
5. Server: Executes the procedure on the remote system.

RPC Process:

 Client sends a call with parameters.


 Server processes the call and sends back the result.

Stub Generation:

 Manual: User creates custom stubs.


 Automatic: Uses IDL to automatically generate stubs.
RPC Message Formats:

 Request: Contains procedure name and parameters.


 Reply: Contains result and errors.

Marshalling/Unmarshalling:

 Marshalling: Packing data for transmission (encoding).


 Unmarshalling: Decoding received data to extract arguments/results.

RPC allows remote execution of procedures with minimal client-side changes, handling
network communication transparently.

2. What does rpcgen do?:

 rpcgen is a tool used to generate client and server stubs from an Interface Definition
Language (IDL) specification. It automatically creates the necessary code for handling RPC
communication.

3. Packing and Unpacking of RPC Messages:

 Packing: The process of encoding data (arguments and results) into a format suitable for
transmission.
 Unpacking: The process of decoding the received message to extract the original data
(arguments and results).
ASSIGNMENT 4

Logical and Physical Locks:

 Logical Lock: Software-based synchronization mechanism using logical constructs like


semaphores.
 Physical Lock: Hardware-based mechanism (e.g., file or memory locks) controlling access to
resources.

Lamport's Clock:

 A logical clock that orders events in distributed systems by assigning timestamps.


 Correction: When two processes communicate, the receiving process updates its clock to be
the maximum of its current time and the time received + 1.

Lamport's Clock Diagram:


Process A Process B
t1 -------------->
t2 t3
t4 <------------
Process A and B update their clocks based on message exchanges to maintain
event order.

1. Clock Skew and Clock Drift:

 Clock Skew: The difference in time between two clocks in a distributed system at any given
moment.
 Clock Drift: The gradual deviation or inconsistency of a clock over time, causing it to differ
from the correct time or another clock.

2. Converting Logical Clock to Physical Clock:

 Logical Clock to Physical Clock: You cannot directly convert a logical clock to a physical clock
because logical clocks only order events, while physical clocks represent real-world time. To
synchronize physical clocks, protocols like NTP (Network Time Protocol) are used.

3. Happened-Before Event in Lamport’s Clock:

 A happened-before event is a causal relationship between two events, where one event
causally affects the other. If Event A happens before Event B, then the timestamp of A will be
less than that of B in Lamport's clock.
ASSIGNMENT 5

The Bully Algorithm is used in distributed systems for electing a coordinator (leader). It
ensures that the process with the highest ID becomes the coordinator. The algorithm works as
follows:

 When a process notices that the coordinator has failed, it initiates an election.
 The process with the highest ID wins the election and becomes the new coordinator.

Types of Messages in Bully Algorithm:

1. Election Message: Sent by a process to initiate an election when it detects the coordinator
has failed.
2. Reply/Response Message: Sent by a process in response to the election message, either
acknowledging or passing the election to a higher-ID process.
3. Coordinator Message: Sent by the elected coordinator to inform all other processes of the
new coordinator's ID.

1.Time Complexity of Bully Algorithm:

 Best Case: O(1) (if the initiator is the highest-ID process and no messages are needed).
 Average Case: O(n) (if most processes are involved in the election).
 Worst Case: O(n) (involves sending messages to all other processes in the system).

2. Why Elect the Coordinator Process:

 A coordinator is needed to manage tasks like resource allocation, synchronization, and


decision-making in a distributed system. It helps ensure consistency and avoid conflicts.

3. Origin of the "Bully" Name:

 The name “Bully” comes from the way the algorithm works: the process with the highest ID
"bullies" or forces others to accept it as the coordinator by dominating the election process.
ASSIGNMENT 6

NFS (Network File System):

 NFS allows remote file access, making remote files appear local.

Mounting and Unmounting:

 Mounting: Making a remote file system accessible locally.


 Unmounting: Disconnecting a mounted remote file system.

Steps to Set Up NFS:

1. Server:
o Install and configure NFS.
o Edit /etc/exports to share directories.
o Run exportfs -a and start NFS server with systemctl start nfs-server.

2. Client:
o Install NFS client.
o Create a mount point (mkdir /mnt/nfs).
o Mount remote directory: mount -t nfs <server_ip>:/remote_dir
/mnt/nfs.

3. Unmount: umount /mnt/nfs.

1) Mounting: The process of linking a remote or local file system to a directory in the existing
file system, making it accessible.
o Example: mount /dev/sda1 /mnt/usb
2) Unmounting: The process of removing a mounted file system, making it no longer accessible.
o Example: umount /mnt/usb

2. Other File Systems like NFS:

 SMB (Server Message Block): Used for file and printer sharing in Windows networks.
 FTP (File Transfer Protocol): Used for transferring files over a network.
 AFP (Apple Filing Protocol): Used in macOS for file sharing.
 CIFS (Common Internet File System): A version of SMB for cross-platform file sharing.

3. Communication Protocols Used for NFS:

 TCP/IP: Used for reliable communication between client and server.


 RPC (Remote Procedure Call): Allows client to request services from the server.
 UDP: Optional, used for faster, connectionless communication (less reliable than TCP).
ASSIGNMENT 7

Cloud Computing:

 Cloud Computing is the delivery of computing services (storage, processing power,


networking, etc.) over the internet, allowing users to access and manage resources remotely
without owning physical hardware.

Virtualization:

 Virtualization is the creation of virtual versions of physical resources, like servers, storage, or
networks, allowing multiple virtual instances to run on a single physical system.

How VMware Works:

 VMware is a virtualization platform that creates and manages virtual machines (VMs) on
physical hardware. It uses a hypervisor (software layer) to allocate physical resources to
multiple VMs, each running its own operating system independently.

1. Types of Virtualization:

 Server: Multiple VMs on one physical server.


 Storage: Combines physical storage into a single resource.
 Network: Creates virtual networks from physical ones.
 Desktop: Remote desktop access on any device.
 Application: Runs apps on a remote server.

2. VMware Applications:

 Workstation: Desktop virtualization tool.


 vSphere: Server virtualization platform.
 Fusion: Virtualization for macOS.
 vCenter: Management tool for vSphere.

3. Example of a Virtual Server:

 A VM running Ubuntu Linux on VMware ESXi, hosting a web server.


ASSIGNMENT 8

The reason for choosing the specific cloud computing example

The specific cloud computing example is chosen to highlight the flexibility and scalability
of cloud services, where users can access resources like storage, computing power, and
applications over the internet, reducing the need for on-premises infrastructure and enabling
efficient resource management.

1. Public and Private Clouds:

 Public Cloud: Cloud services provided over the internet by third-party providers (e.g., AWS,
Azure) accessible to anyone.
 Private Cloud: Cloud infrastructure dedicated to a single organization, either on-premises or
hosted by a third party.

2. Different Types of Services Offered by Clouds:

 IaaS (Infrastructure as a Service): Virtual machines, storage, and networking.


 PaaS (Platform as a Service): Platform for building and deploying apps.
 SaaS (Software as a Service): Access to software applications via the internet.

3. Distributed Computing and Cloud Computing:

 Distributed Computing involves multiple computers working together on tasks, while Cloud
Computing leverages distributed computing principles to provide scalable, on-demand
resources over the internet.
ASSIGNMENT 9

To understand the importance of clusters in distributed computing

Clusters in distributed computing are important because they combine multiple


interconnected computers to work together as a single system, providing enhanced
performance, reliability, and scalability. They enable parallel processing, fault tolerance, and
resource sharing, making it easier to handle large-scale computations and ensure continuous
availability.

1. Cluster of Machines:

 A cluster of machines is a group of interconnected computers that work together as a single


system to perform tasks more efficiently, providing scalability and fault tolerance.

2. Grid of Machines:

 A grid of machines is a network of distributed, geographically dispersed computers working


together to share resources and perform large-scale computations, often over long
distances.

3. Applications of Cluster Computing:

 Scientific Simulations: Running complex simulations in fields like physics, chemistry, and
biology.
 Data Processing: Handling large datasets in fields like big data analytics and machine
learning.
 High-Performance Computing (HPC): For tasks requiring significant computational power,
like weather forecasting and simulations.
ASSIGNMENT 10

Cloud services offer on-demand access to computing resources over the internet:

 IaaS: Virtualized infrastructure (e.g., AWS EC2).


 PaaS: Platform for app development (e.g., Google App Engine).
 SaaS: Software applications online (e.g., Google Workspace).

They provide scalability, flexibility, and cost-efficiency.

1. What is AWS?

 AWS (Amazon Web Services) is a comprehensive cloud computing platform providing


various services like computing power, storage, and databases over the internet.

2. Different Services of Cloud

 IaaS: Infrastructure like virtual machines and storage.


 PaaS: Platforms for developing and deploying applications.
 SaaS: Software applications provided online.

3. Public and Private Clouds

 Public Cloud: Cloud services offered by third-party providers to the general public (e.g., AWS,
Google Cloud).
 Private Cloud: Cloud infrastructure dedicated to a single organization.

You might also like