diff options
| -rw-r--r-- | _bibliography/futures.bib | 333 | ||||
| -rw-r--r-- | chapter/2/futures.md | 16 |
2 files changed, 348 insertions, 1 deletions
diff --git a/_bibliography/futures.bib b/_bibliography/futures.bib index cf17cac..b3d0d19 100644 --- a/_bibliography/futures.bib +++ b/_bibliography/futures.bib @@ -25,7 +25,7 @@ pages = {727-739}, } -@article{Halstead:1985:MLC:4472.4478, +@article{1, author = {Halstead,Jr., Robert H.}, title = {MULTILISP: A Language for Concurrent Symbolic Computation}, journal = {ACM Trans. Program. Lang. Syst.}, @@ -43,3 +43,334 @@ publisher = {ACM}, address = {New York, NY, USA}, } + +@inproceedings{2, + author = {Liskov, B. and Shrira, L.}, + title = {Promises: Linguistic Support for Efficient Asynchronous Procedure Calls in Distributed Systems}, + booktitle = {Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation}, + series = {PLDI '88}, + year = {1988}, + isbn = {0-89791-269-1}, + location = {Atlanta, Georgia, USA}, + pages = {260--267}, + numpages = {8}, + url = {http://doi.acm.org/10.1145/53990.54016}, + doi = {10.1145/53990.54016}, + acmid = {54016}, + publisher = {ACM}, + address = {New York, NY, USA}, +} + +@article{3, + author = {Liskov, B. and Shrira, L.}, + title = {Promises: Linguistic Support for Efficient Asynchronous Procedure Calls in Distributed Systems}, + journal = {SIGPLAN Not.}, + issue_date = {July 1988}, + volume = {23}, + number = {7}, + month = jun, + year = {1988}, + issn = {0362-1340}, + pages = {260--267}, + numpages = {8}, + url = {http://doi.acm.org/10.1145/960116.54016}, + doi = {10.1145/960116.54016}, + acmid = {54016}, + publisher = {ACM}, + address = {New York, NY, USA}, +} + +@article{4, + author = {Eriksen, Marius}, + title = {Your Server As a Function}, + journal = {SIGOPS Oper. Syst. Rev.}, + issue_date = {January 2014}, + volume = {48}, + number = {1}, + month = may, + year = {2014}, + issn = {0163-5980}, + pages = {51--57}, + numpages = {7}, + url = {http://doi.acm.org/10.1145/2626401.2626413}, + doi = {10.1145/2626401.2626413}, + acmid = {2626413}, + publisher = {ACM}, + address = {New York, NY, USA}, +} + +@misc{5, + title={What are the differences between JavaScript Promise and a Java Future?}, + author={Google}, + url = {https://www.quora.com/What-are-the-differences-between-JavaScript-Promise-and-a-Java-Future}, + publisher = {Quora} +} + +@misc{6, + title={The JavaScript Event Loop: Explained}, + author={Erin Swenson-Healey}, + url = {http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/} +} + +@misc{7, + title={The JavaScript Event Loop: Explained}, + author={Erin Swenson-Healey}, + url = {http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/} +} + +@misc{8, + title={Effective Scala}, + author={Marius Eriksen}, + url = {http://twitter.github.io/effectivescala} +} + +@misc{8, + title={Concurrency model and Event Loop}, + author={MDN}, + url = {https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop} +} + +@misc{9, + title={Task vs Future vs Promise}, + author={Ned Stoyanov}, + url = {http://www.nedstoyanov.com/promises-and-futures/} +} + +@misc{10, + title={Futures and Promises - List of Implementations}, + url = {http://www.liquisearch.com/futures_and_promises/list_of_implementations} +} + +@misc{11, + title={Promises and Deferreds}, + author={Trevor Burnham}, + url = {https://www.safaribooksonline.com/library/view/async-javascript/9781941222782/f_0028.html} +} + +@misc{12, + title={Futures and Promises}, + url = {http://www.seastar-project.org/futures-promises/} +} + +@misc{13, + title={Why do Promise libraries use event loops?}, + url = {http://stackoverflow.com/questions/23447876/why-do-promise-libraries-use-event-loops} +} + +@misc{14, + title={Why do Promise libraries use event loops?}, + url = {http://stackoverflow.com/questions/23447876/why-do-promise-libraries-use-event-loops} +} + + +@misc{15, + title={Tasks, microtasks, queues and schedules}, + author={Jake Archibald}, + url = {https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/} +} + +@misc{16, + title={You're Missing the Point of Promises}, + author={Domenic Denicola}, + url = {https://blog.domenic.me/youre-missing-the-point-of-promises/} +} + +@misc{17, + title={Dataflow Concurrency}, + url = {http://doc.akka.io/docs/akka/2.3-M1/scala/dataflow.html} +} + +@misc{18, + title={Promise & Deferred objects in JavaScript Pt.1: Theory and Semantics}, + author={Chris Webb}, + url = {http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt1-theory-and-semantics} +} + +@misc{19, + title={Promise & Deferred objects in JavaScript Pt.1: Theory and Semantics}, + author={Chris Webb}, + url = {http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt1-theory-and-semantics} +} + +@misc{20, + title={CompletableFuture}, + author={Doug Lea}, + url = {http://cs.oswego.edu/pipermail/concurrency-interest/2012-December/010423.html} +} + +@misc{21, + title={CompletableFuture}, + author={Doug Lea}, + url = {http://cs.oswego.edu/pipermail/concurrency-interest/2012-December/010423.html} +} + +@misc{22, + title={Difference between Future and Promise}, + url = {http://stackoverflow.com/questions/14541975/difference-between-future-and-promise} +} + +@misc{23, + title={Welcome to Thunk.org!}, + url = {https://thunk.org/} +} + +@misc{24, + title={CompletableFuture}, + author={Doug Lea}, + url = {http://cs.oswego.edu/pipermail/concurrency-interest/2012-December/010423.html} +} + +@misc{25, + title={JVM Internals}, + author={james d bloom}, + url = {http://blog.jamesdbloom.com/JVMInternals.html} +} + +@misc{26, + title={ExecutionContext}, + url = {http://www.scala-lang.org/api/current/scala/concurrent/ExecutionContext.html} +} + +@misc{27, + title={ForkJoinPool: the Other ExecutorService}, + author={Jessica Kerr}, + url = {http://blog.jessitron.com/2014/02/forkjoinpool-other-executorservice.html} +} + +@misc{28, + title={Scala: the global ExecutionContext makes your life easier}, + author={Jessica Kerr}, + url = {http://blog.jessitron.com/2014/02/scala-global-executioncontext-makes.html} +} + +@misc{29, + title={Learn implicits: Scala Futures}, + author={Jorge Montero}, + url = {http://engineering.monsanto.com/2015/06/15/implicits-futures/} +} + +@misc{30, + title={Simple concurrency with Scala Futures (Futures tutorial)}, + author={Alvin Alexander}, + url = {http://alvinalexander.com/scala/concurrency-with-scala-futures-tutorials-examples} +} + +@misc{31, + title={JavaScript Promises and Error Handling}, + author={OdeToCode}, + url = {http://odetocode.com/blogs/scott/archive/2015/10/01/javascript-promises-and-error-handling.aspx} +} + +@inproceedings{32, + author = {Lea, Doug}, + title = {A Java Fork/Join Framework}, + booktitle = {Proceedings of the ACM 2000 Conference on Java Grande}, + series = {JAVA '00}, + year = {2000}, + isbn = {1-58113-288-3}, + location = {San Francisco, California, USA}, + pages = {36--43}, + numpages = {8}, + url = {http://doi.acm.org/10.1145/337449.337465}, + doi = {10.1145/337449.337465}, + acmid = {337465}, + publisher = {ACM}, + address = {New York, NY, USA}, +} + +@inproceedings{33, + author = {de Boer, Frank S. and Clarke, Dave and Johnsen, Einar Broch}, + title = {A Complete Guide to the Future}, + booktitle = {Proceedings of the 16th European Symposium on Programming}, + series = {ESOP'07}, + year = {2007}, + isbn = {978-3-540-71314-2}, + location = {Braga, Portugal}, + pages = {316--330}, + numpages = {15}, + url = {http://dl.acm.org/citation.cfm?id=1762174.1762205}, + acmid = {1762205}, + publisher = {Springer-Verlag}, + address = {Berlin, Heidelberg}, +} + +@inproceedings{34, + author = {de Boer, Frank S. and Clarke, Dave and Johnsen, Einar Broch}, + title = {A Complete Guide to the Future}, + booktitle = {Proceedings of the 16th European Symposium on Programming}, + series = {ESOP'07}, + year = {2007}, + isbn = {978-3-540-71314-2}, + location = {Braga, Portugal}, + pages = {316--330}, + numpages = {15}, + url = {http://dl.acm.org/citation.cfm?id=1762174.1762205}, + acmid = {1762205}, + publisher = {Springer-Verlag}, + address = {Berlin, Heidelberg}, +} + +@article{35, + author = {Friedman, D. P. and Wise, D. S.}, + title = {Aspects of Applicative Programming for Parallel Processing}, + journal = {IEEE Trans. Comput.}, + issue_date = {April 1978}, + volume = {27}, + number = {4}, + month = apr, + year = {1978}, + issn = {0018-9340}, + pages = {289--296}, + numpages = {8}, + url = {http://dx.doi.org/10.1109/TC.1978.1675100}, + doi = {10.1109/TC.1978.1675100}, + acmid = {1310419}, + publisher = {IEEE Computer Society}, + address = {Washington, DC, USA}, + keywords = {Compiling, Lisp, functional combinations, multiprocessing, recursion, suspensions, suspensions, Compiling, functional combinations, Lisp, multiprocessing, recursion}, +} + +@techreport{36, + author = {Baker,Jr., Henry G. and Hewitt, Carl}, + title = {The Incremental Garbage Collection of Processes}, + year = {1977}, + source = {http://www.ncstrl.org:8900/ncstrl/servlet/search?formname=detail\&id=oai%3Ancstrlh%3Amitai%3AMIT-AILab%2F%2FAIM-454}, + publisher = {Massachusetts Institute of Technology}, + address = {Cambridge, MA, USA}, +} + +@inproceedings{37, + author = {Miller, Mark S. and Tribble, E. Dean and Shapiro, Jonathan}, + title = {Concurrency Among Strangers: Programming in E As Plan Coordination}, + booktitle = {Proceedings of the 1st International Conference on Trustworthy Global Computing}, + series = {TGC'05}, + year = {2005}, + isbn = {3-540-30007-4, 978-3-540-30007-6}, + location = {Edinburgh, UK}, + pages = {195--229}, + numpages = {35}, + url = {http://dl.acm.org/citation.cfm?id=1986262.1986274}, + acmid = {1986274}, + publisher = {Springer-Verlag}, + address = {Berlin, Heidelberg}, +} + +@INPROCEEDINGS{38, + author = {Didier Le Botlan and Guido Tack and Andreas Rossberg and Andreas Rossberg and Didier Le and Botlan Guido Tack and Thorsten Brunklaus and Thorsten Brunklaus and Gert Smolka and Gert Smolka}, + title = {Alice through the looking glass}, + booktitle = {In Trends in Functional Programming}, + year = {2006}, + pages = {79--96}, + publisher = {Intellect Books} +} + +@misc{39, + title={Futures and Promises in Scala 2.10}, + author={Heather Miller}, + url = {https://speakerdeck.com/heathermiller/futures-and-promises-in-scala-2-dot-10} +} + +@misc{40, + title={Futures and promises}, + url = {https://en.wikipedia.org/wiki/Futures_and_promises} +} diff --git a/chapter/2/futures.md b/chapter/2/futures.md index 612ed8e..4e17472 100644 --- a/chapter/2/futures.md +++ b/chapter/2/futures.md @@ -275,6 +275,22 @@ The idea for explicit futures were introduced in the Baker and Hewitt paper. The Implicit futures were introduced originally by Friedman and Wise in a paper in 1978. The ideas presented in that paper inspired the design of promises in MultiLisp. Futures are also implicit in Scala and Javascript, where they’re supported as libraries on top of the core languages. Implicit futures can be implemented this way as they don’t require support from language itself. Alice ML’s concurrent futures are also an example of implicit invocation. +In Scala, although the futures are implicit, Promises can be used to have an explicit-like behavior. This is useful in a scenario where we need to stack up some computations and then resolve the Promise. + +An Example : + +```scala + +val p = Promise[Foo]() + +p.future.map( ... ).filter( ... ) foreach println + +p.complete(new Foo) + +``` + +Here, we create a Promise, and complete it later. In between we stack up a set of computations which get executed once the promise is completed. + # Promise Pipelining One of the criticism of traditional RPC systems would be that they’re blocking. Imagine a scenario where you need to call an API ‘a’ and another API ‘b’, then aggregate the results of both the calls and use that result as a parameter to another API ‘c’. Now, the logical way to go about doing this would be to call A and B in parallel, then once both finish, aggregate the result and call C. Unfortunately, in a blocking system, the way to go about is call a, wait for it to finish, call b, wait, then aggregate and call c. This seems like a waste of time, but in absence of asynchronicity, it is impossible. Even with asynchronicity, it gets a little difficult to manage or scale up the system linearly. Fortunately, we have promises. |
