Skip to content

Commit 3abaa83

Browse files
committed
docs: producer-consumer and promise diagrams
1 parent 261da00 commit 3abaa83

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

producer-consumer/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Wikipedia says
3636

3737
> Dijkstra wrote about the case: "We consider two processes, which are called the 'producer' and the 'consumer' respectively. The producer is a cyclic process that produces a certain portion of information, that has to be processed by the consumer. The consumer is also a cyclic process that needs to process the next portion of information, as has been produced by the producer. We assume the two processes to be connected for this purpose via a buffer with unbounded capacity."
3838
39+
Sequence diagram
40+
41+
![Producer-Consumer sequence diagram](./etc/producer-consumer-sequence-diagram.png)
42+
3943
## Programmatic Example of Producer-Consumer Pattern in Java
4044

4145
Consider a manufacturing process of item, the producer will need to pause the production when manufacturing pipeline is full and the consumer will need to pause the consumption of item when the manufacturing pipeline is empty. We can separate the process of production and consumption which work together and pause at separate times.
40.2 KB
Loading

promise/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Wikipedia says
3737

3838
> In computer science, future, promise, delay, and deferred refer to constructs used for synchronizing program execution in some concurrent programming languages. They describe an object that acts as a proxy for a result that is initially unknown, usually because the computation of its value is not yet complete.
3939
40+
Sequence diagram
41+
42+
![Promise sequence diagram](./etc/promise-sequence-diagram.png)
43+
4044
## Programmatic Example of Promise Pattern in Java
4145

4246
The Promise design pattern is a software design pattern that's often used in concurrent programming to handle asynchronous operations. It represents a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action's eventual success value or failure reason.
61.3 KB
Loading

0 commit comments

Comments
 (0)