diff --git a/producer-consumer/README.md b/producer-consumer/README.md index a40ef5a65..bb62c799a 100644 --- a/producer-consumer/README.md +++ b/producer-consumer/README.md @@ -36,6 +36,10 @@ Wikipedia says > 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." +Sequence diagram + +![Producer-Consumer sequence diagram](./etc/producer-consumer-sequence-diagram.png) + ## Programmatic Example of Producer-Consumer Pattern in Java 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. diff --git a/producer-consumer/etc/producer-consumer-sequence-diagram.png b/producer-consumer/etc/producer-consumer-sequence-diagram.png new file mode 100644 index 000000000..7a97024da Binary files /dev/null and b/producer-consumer/etc/producer-consumer-sequence-diagram.png differ diff --git a/promise/README.md b/promise/README.md index 76b67e2fb..9c919862a 100644 --- a/promise/README.md +++ b/promise/README.md @@ -37,6 +37,10 @@ Wikipedia says > 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. +Sequence diagram + +![Promise sequence diagram](./etc/promise-sequence-diagram.png) + ## Programmatic Example of Promise Pattern in Java 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. diff --git a/promise/etc/promise-sequence-diagram.png b/promise/etc/promise-sequence-diagram.png new file mode 100644 index 000000000..9209fea11 Binary files /dev/null and b/promise/etc/promise-sequence-diagram.png differ