20

Could anyone explain the difference between reactor-pattern and proactor-pattern? I know that in reactor-pattern the operations are synchronous and in proactor they're asynchronous and also that in reactor the operation is done by the handler which is handed over to the client by the reactor. (correct me if i am wrong)

Also Which of these pattern is used in case of fail safe and which is used in fail fast?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
vishnu viswanath
  • 3,794
  • 2
  • 36
  • 47
  • Is there more background in this failsafe/failfast, or is this some sort of homework question? I mean, is there anything specific you are trying to accomplish? – Nanne Aug 08 '12 at 07:10
  • 3
    See http://stackoverflow.com/questions/9138294/what-is-the-different-between-even-driven-model-and-reactor-pattern – djna Aug 08 '12 at 07:14
  • its kind of homework question. i was searching about fail safe and i came to know about reactor pattern. But i couldn't find any docs stating how we have to implement fail safe in reactor pattern – vishnu viswanath Aug 08 '12 at 07:28
  • If you are going to reference non-standard patterns then you should include a citation to the appropriate pattern catalog/repository you got them from. – Martin Spamer Oct 26 '12 at 18:59

2 Answers2

6

In reactor pattern you will poll device for readiness to do something, while in proactor you do something and poll for its completion.

The good examples for reactor pattern are: epoll(Linux), kqueue(MacOS, FreeBSD), select(Linux, MacOS, Windows) approaches. The good example for proactor pattern is Windows IOCP approach.

Aqua
  • 716
  • 8
  • 10
3

Referencing Fail fast or fail safe? as well as wiki articles I would say that proactor is fail-safe and reactor is fail-fast. Proactor having a completion handler gives it a more "safe" approach. A synchronous environment such as reactor will have large fail if one task fails while blocking a large amount of resources. Hope this helps.

Community
  • 1
  • 1
Matthew Hammel
  • 104
  • 2
  • 8