Half-Sync/Half-Async patterns

The job of Half-Sync and Half-Async is to distinguish between the two types of processing called asynchronous and synchronous, for the simplification of the program without hindering its performance.

The two layers intercommunicating are introduced for both asynchronous and synchronous services for the purpose of processing with a queuing layer in between.

Every concurrent system contains both asynchronous and synchronous services. To enable these services to communicate with each other, the Half-Sync/Half-Async pattern decomposes the services in the system into layers. Using the queuing layer, both these services pass messages to each other for intercommunication.

Let's see the following diagram that illustrates these design patterns:

As you can see in the preceding diagram, there are three layers--Synchronous Service Layer, Queuing Layer, and Asynchronous Service Layer. Synchronous layer contains the services that are working synchronously to the queue at the Queuing Layer, and this query performs asynchronously using Asynchronous services at the Asynchronous Service Layer. These Asynchronous Services at this layer are using the external event-based resources.

As you can see in the preceding diagram, there are three layers included here. Let's look at these layers:

  • Synchronous Task Layer: The tasks in this layer are active objects. High-level input and output operations are carried by these tasks, which transfer the data synchronously towards the queuing layer.
  • Queuing Layer: This layer provides the synchronization and buffering required between the synchronous and asynchronous task layers.
  • Asynchronous Task Layer: The events from the external sources are handled by the tasks present in this layer. These tasks do not contain a separate thread of control.

We have discussed the Half-Sync and Half-Async design patterns of the concurrency pattern. Let's move to another concurrency pattern, that is, the leader/follower Pattern.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset