Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Linuxconf 2011 parallel languages talk

1,727 views

Published on

The slides from my parallel programming talk at LCA 2011. It is an overview of several languages that offer parallel programming paradigms with a strong bias towards functional programmin

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Linuxconf 2011 parallel languages talk

  1. 1. - second oldest high levellanguage (fortran)- John McCarthy (MIT)- list processing- garbage collector
  2. 2. (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
  3. 3. - meta language- type inference- static typing- garbage collector
  4. 4. fun fac 0 = 1 | fac n = n * fac (n - 1)
  5. 5. - SML-- research, compilerdevelopment- Caml-- Categorical AbstractMachine Language-- lisp / C-- OCaml
  6. 6. - .NET- OCaml compatible- both object orientedand functionalcomponents
  7. 7. let rec factorial n = match n with | 0 -> 1 | _ -> n * factorial (n - 1)
  8. 8. fac(0) -> 1;fac(N) -> N * fac(N-1).
  9. 9. - pure- lazy evaluation- type system
  10. 10. -- typefactorial :: Integer -> Integer-- using recursionfactorial 0 = 1factorial n = n * factorial (n - 1)-- using listsfactorial n = product [1..n]
  11. 11. - JVM- java compatible- java -> FP
  12. 12. class Factorial {  def factorial(n: Int): Int = {    def factorialAcc(acc: Int, n: Int): Int = {      if (n <= 1) acc      else factorialAcc(n * acc, n - 1)    }    factorialAcc(1, n)  }}
  13. 13. - JVM- LISP- java integration viamacros
  14. 14. (def factorial (fn [n] (loop [cnt n acc 1] (if (zero? cnt) acc (recur (dec cnt) (* acc cnt))))))
  15. 15. - memory save- no global GC- no shared mutablestate
  16. 16. fn f(int x) -> int { if (x == 1) { ret 1; } else { ret x * f(x-1); }}fn main () { check (f(5) == 120);}
  17. 17. - next gen language- open call 2002- grants for development- IBM, SUN, Cray- easy for researchers
  18. 18. - JVM or C++- partitioned globaladdress space- parent child locking
  19. 19. - fortran concept- scala, haskell syntax- syntax mathematicalnotation- if possible libraryimplementation- for loop lib function
  20. 20. - smalltalk VM- compatible to squeak- IBM research
  21. 21. | count factorial |count := 0.factorial := 1.[ count > 0 ] whileTrue: [ factorial := factorial * (count := count - 1) ]Transcript show: factorial
  22. 22. - logic programminglanguage- natural languageprocessing-
  23. 23. fact(0, 1).fact(X, Y):-    X > 0 ,X1 is X-1, fact(X1, Z), Y is X*Z.
  24. 24. thanks

×