ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Parallel & Distributed Computing
    COMP3139
    Progress0 / 33 topics
    Topics
    1. Introduction to Parallel and Distributed Systems2. Why Use Parallel and Distributed Systems?3. Speedup and Amdahl's Law4. Hardware Architectures: Multi Processors (Shared Memory)5. Hardware Architectures: Networks of Workstations (Distributed Memory)6. Hardware Architectures: Clusters (Latest Variation)7. Software Architectures: Threads and Shared Memory8. Software Architectures: Processes and Message Passing9. Software Architectures: Distributed Shared Memory (DSM)10. Software Architectures: Distributed Shared Data (DSD)11. Parallel Algorithms12. Concurrency and Synchronization13. Data and Work Partitioning14. Common Parallelization Strategies15. Granularity16. Load Balancing17. Examples of Parallel Algorithms: Parallel Search18. Examples of Parallel Algorithms: Parallel Sorting19. Shared-Memory Programming20. Threads in Shared-Memory Programming21. P Threads22. Locks and Semaphores23. Distributed-Memory Programming24. Message Passing25. Map Reduce26. Distributed-Memory Programming with PI27. Google's Map Reduce28. Hadoop29. Other Parallel Programming Systems30. Tread Marks31. Distributed Shared Memory32. Aurora: Scoped Behavior and Abstract Data Types33. S Enterprise: Process Templates
    COMP3139›Software Architectures: Processes and Message Passing
    Parallel & Distributed ComputingTopic 8 of 33

    Software Architectures: Processes and Message Passing

    9 minread
    1,495words
    Intermediatelevel

    Software Architectures: Processes and Message Passing

    In parallel and distributed systems, processes and message passing are crucial concepts for enabling multiple components or systems to work together concurrently or across a network. Unlike threads and shared memory, which are typically used in multi-threaded, single-machine systems, processes and message passing are fundamental in environments where tasks are distributed across multiple machines or components.

    Let’s explore these two concepts in detail:


    1. What Are Processes?

    A process is an independent unit of execution that has its own memory space and system resources. Each process runs in its own isolated environment, which is distinct from other processes running in the system. Processes can communicate with each other using inter-process communication (IPC) mechanisms, but they do not share memory by default, which ensures that one process's memory is protected from others.

    Key Features of Processes:

    • Isolation: Each process has its own memory space, which makes it more fault-tolerant. If one process crashes, it does not directly affect others.
    • Resource Ownership: Processes own resources like memory, file handles, and system variables.
    • Concurrency: Multiple processes can run concurrently, either on separate CPUs in a multi-core system or on different machines in a distributed system.
    • Communication: Processes communicate through explicit IPC mechanisms (like message passing, pipes, or shared memory).

    Types of Processes:

    1. User Processes: These are processes initiated by users (e.g., a web browser, a word processor).
    2. Kernel Processes: These are system-level processes that are managed by the operating system kernel (e.g., process scheduling, device management).
    3. Zombie Processes: These are terminated processes that have not yet been cleaned up by their parent process.

    2. Message Passing: An Overview

    Message passing is a communication model where processes (either within the same machine or distributed across multiple machines) send and receive messages to exchange information. It is one of the primary mechanisms for communication in distributed systems or multi-process environments where processes do not share memory.

    In message passing, a message is a block of data that one process sends to another. This communication can occur in two ways:

    1. Point-to-point communication: A direct exchange of messages between two processes.
    2. Broadcast communication: A process sends messages to multiple processes at once.

    Message passing can be used for both synchronous and asynchronous communication, depending on the system requirements.

    Key Features of Message Passing:

    • Explicit Communication: Unlike shared memory models, message passing requires that processes explicitly send and receive messages, making the communication between processes more visible and controlled.
    • No Shared Memory: Since processes are isolated, they cannot access each other’s memory directly. Communication must occur through messages.
    • Scalability: Message passing scales well in distributed systems, especially when processes are spread across different machines.

    3. Message Passing: Communication Methods

    There are two main forms of message passing that systems use:

    Synchronous Message Passing:

    In synchronous message passing, the sending process sends a message and waits for an acknowledgment or response from the receiving process before it continues execution.

    • Blocking: In synchronous communication, the sender is blocked until the receiver acknowledges the message, which ensures that the sender and receiver stay in sync.

      Example:

      • Process A sends a request to Process B to retrieve some data, and Process A will wait until Process B sends back the requested data before continuing its execution.
    • Use Case: Synchronous message passing is useful when tasks need to be tightly coordinated or when the sender depends on the response of the receiver to proceed.

    Asynchronous Message Passing:

    In asynchronous message passing, the sending process sends the message without waiting for an immediate response. The sender continues execution without waiting for an acknowledgment from the receiver.

    • Non-blocking: The sender can proceed with other tasks, and the receiver processes the message when it's ready, without blocking the sender.

      Example:

      • Process A sends a message to Process B and immediately moves on to perform other tasks. Process B will process the message whenever it can, without interrupting Process A.
    • Use Case: Asynchronous message passing is often used in systems where processes need to work independently without waiting for each other, making it well-suited for distributed systems and decoupled architectures.

    Reliability of Message Passing:

    • Message Delivery Guarantees: Some message-passing systems guarantee reliable delivery of messages (i.e., they ensure the message will reach the receiver even if there are network issues), while others may offer best-effort delivery.
    • Example: TCP/IP (Transmission Control Protocol) guarantees reliable message delivery, while UDP (User Datagram Protocol) is best-effort and may lose messages.

    4. Message Passing in Distributed Systems

    In distributed systems, where processes run on different machines, message passing plays a key role in enabling communication between processes that do not share physical memory. This communication can be complex due to the variety of network topologies, latency, and potential failure points in distributed systems.

    Key Concepts in Distributed Message Passing:

    1. Remote Procedure Call (RPC):

      • RPC is a mechanism that allows a program on one machine (the client) to execute a procedure or function on another machine (the server) as if it were a local call. The message is sent over the network, and the result is returned to the client.
      • Synchronous or Asynchronous: RPCs can be either synchronous (where the client waits for the result) or asynchronous (where the client proceeds without waiting for the result).
    2. Message Queues:

      • A message queue is a data structure used to store messages sent between processes. The messages are placed in the queue and can be retrieved by the receiving process in the order they were sent.
      • Message queues help decouple sender and receiver processes, allowing for more scalable and fault-tolerant systems.
      • Example: RabbitMQ, Apache Kafka, and Amazon SQS are popular message queue systems used for asynchronous communication in distributed systems.
    3. Publish/Subscribe Model:

      • In the publish/subscribe model, publishers send messages to a central server (or broker) which then distributes the messages to multiple subscribers who have expressed interest in receiving them.
      • This model allows for many-to-many communication and is widely used in event-driven architectures, real-time systems, and broadcasting.
    4. Message Brokers:

      • A message broker acts as an intermediary that routes messages between sender and receiver processes. Brokers allow systems to be loosely coupled, as sender and receiver don’t need to know each other’s location or existence.
      • Example: Apache Kafka, RabbitMQ, and ActiveMQ are examples of message brokers.

    5. Advantages and Disadvantages of Message Passing

    Advantages of Message Passing:

    • Decoupling: Processes do not need to know about each other’s internal state, allowing for loosely coupled components. This makes the system easier to scale and maintain.
    • Flexibility: Message passing is versatile and can be used in a variety of architectures, including distributed, parallel, and multi-threaded systems.
    • Fault Tolerance: Message passing systems can be designed to handle partial failures. For example, if a message fails to be delivered, it can be retried, and processes can recover without affecting the entire system.
    • Scalability: Since message passing is typically based on a client-server or broker model, it can scale easily in distributed environments. New processes or nodes can be added without affecting the overall system.

    Disadvantages of Message Passing:

    • Latency: Message passing, especially in distributed systems, can introduce delays due to network communication. This is particularly important for applications where low-latency communication is required.
    • Complexity: Designing a system that uses message passing effectively can be complex, especially when dealing with issues like message ordering, delivery guarantees, and fault tolerance.
    • Error Handling: In message-passing systems, handling errors such as message loss, duplication, or network failures requires extra mechanisms to ensure reliability and consistency.

    6. Use Cases of Processes and Message Passing

    Here are some examples where processes and message passing are widely used:

    1. Distributed Databases:

      • In a distributed database system, different nodes (processes) communicate with each other via message passing to coordinate queries, replication, and transactions across multiple servers.
    2. Microservices Architecture:

      • In a microservices architecture, different services run as separate processes and communicate with each other using message-passing protocols like RESTful APIs, gRPC, or AMQP.
    3. Web Servers:

      • Web servers use message-passing techniques to handle incoming client requests (often processed by different processes) and to communicate with databases or other services.
    4. Cloud Computing:

      • In cloud environments, services are distributed across many virtual machines (VMs), and message passing is used for communication between these services. For example, serverless computing platforms like AWS Lambda use message passing to invoke functions in response to events.
    5. Real-Time Systems:

      • In real-time systems, such as air traffic control or stock trading, processes must exchange information via message passing to maintain synchronization and to meet strict timing requirements.

    Conclusion

    Processes and message passing are integral components of distributed and parallel systems, enabling independent processes to communicate and collaborate across different machines or components. Message passing provides a robust mechanism for inter-process communication, allowing systems to scale and

    Previous topic 7
    Software Architectures: Threads and Shared Memory
    Next topic 9
    Software Architectures: Distributed Shared Memory (DSM)

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time9 min
      Word count1,495
      Code examples0
      DifficultyIntermediate