Skip to content

Commit 5978bbe

Browse files
committed
Added description of Half-Sync/Half-Async pattern
1 parent 0133864 commit 5978bbe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Concurrency patterns are those types of design patterns that deal with the multi
7272
* [Double Checked Locking](#double-checked-locking)
7373
* [Thread Pool](#thread-pool)
7474
* [Async Method Invocation](#async-method-invocation)
75+
* [Half-Sync/Half-Async](#half-sync-half-async)
7576

7677
### Presentation Tier Patterns
7778

@@ -714,7 +715,22 @@ validation and for building to order
714715
* you want to orchestrate calls to multiple business services
715716
* you want to encapsulate service lookups and service calls
716717

718+
## <a name="half-sync-half-async">Half-Sync/Half-Async</a> [&#8593;](#list-of-design-patterns)
719+
**Intent:** The Half-Sync/Half-Async pattern decouples synchronous I/O from asynchronous I/O in a system to simplify concurrent programming effort without degrading execution efficiency.
717720

721+
![Half-Sync/Half-Async class diagram](./half-sync-half-async/etc/half-sync-half-async.png)
722+
723+
**Applicability:** Use Half-Sync/Half-Async pattern when
724+
* A system possesses following characteristics:
725+
* System must perform tasks in response to external events that occur asynchronously, like hardware interrupts in OS
726+
* It is inefficient to dedicate separate thread of control to perform synchronous I/O for each external source of event
727+
* The higher level tasks in the system can be simplified significantly if I/O is performed synchronously.
728+
* One or more tasks in a system must run in a single thread of control, while other tasks may benefit from multi-threading.
729+
730+
**Real world examples:**
731+
* [BSD Unix networking subsystem](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf)
732+
* [Real Time CORBA](http://www.omg.org/news/meetings/workshops/presentations/realtime2001/4-3_Pyarali_thread-pool.pdf)
733+
* [Android AsyncTask framework](http://developer.android.com/reference/android/os/AsyncTask.html)
718734

719735
# Frequently asked questions
720736

0 commit comments

Comments
 (0)