Slashdot Mirror


River Trail — Intel's Parallel JavaScript

mikejuk writes "Intel has just announced River Trail, an extension of JavaScript that brings parallel programming into the browser. The code looks like JavaScript and it works with HTML5, including Canvas and WebGL, so 2D and 3D graphics are easy. A demo video shows an in-browser simulation going from 3 to 45 fps and using all eight cores of the processor. This is the sort of performance needed if 3D in-browser games are going to be practical. You can download River Trail as a Firefox add-on and start coding now. Who needs native code?"

85 of 134 comments (clear)

  1. Oblig by grub · · Score: 1, Funny


    What about a beowulf.js cluster of these?

    --
    Trolling is a art,
  2. Who needs native code? by nicholas22 · · Score: 5, Funny

    CPUs

  3. Re:Fuck parallel programming. by ZankerH · · Score: 2

    the concept of assigning more than 1 cores to a single thread

    Computing doesn't work that way. At least not with any meaningful speed increase. That may decrease power usage, but you'll still need "parallel programming shit" to make proper use of parallel processing hardware.

  4. Who needs native code by afidel · · Score: 1

    People who don't have 8 cores available and who want acceptable performance? People who want their Windows 8 tablet to have a real world battery life longer than two hours?

    --
    There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    1. Re:Who needs native code by 93+Escort+Wagon · · Score: 4, Funny

      People who want their Windows 8 tablet to have a real world battery life longer than two hours?

      So, what - 4 or 5 people?

      --
      #DeleteChrome
    2. Re:Who needs native code by Lennie · · Score: 1

      Actually, I heared if you can do your computing in a short time in parallel or a long time. Choose parallel it is usually more power efficient (this means: it is possible to turn off as many parts of a CPU as soon as possible and frequency scaling can be done when nothing is running).

      --
      New things are always on the horizon
    3. Re:Who needs native code by kelemvor4 · · Score: 3, Funny

      People who want their Windows 8 tablet to have a real world battery life longer than two hours?

      So, what - 4 or 5 people?

      I think you overestimate the sales potential for windows8 tablets.

    4. Re:Who needs native code by increment1 · · Score: 1

      Unfortunately, that does not make it more efficient to run Javascript, through however many layers of indirection and abstraction it undergoes, than it does to run native code. Doing a remarkably inefficient task in parallel only parallels your inefficiency, it does not remove it.

      I am not advocating for native code, but if you want good performance on today's hardware then Javascript is not really the number 1 candidate, regardless of whether it can be executed in parallel or not.

    5. Re:Who needs native code by afidel · · Score: 1

      Uh, Windows still gets battery life than Linux. OSX though generally gets better life than Windows.

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    6. Re:Who needs native code by Anonymous Coward · · Score: 1

      I thought all slashdotters registered their kids an account when they were born. We have to endoctrine them into the system as soon as possible after all.

    7. Re:Who needs native code by justforgetme · · Score: 1

      no man, that's the microsoft tablet OS developing department he is talking about

      --
      -- no sig today
    8. Re:Who needs native code by justforgetme · · Score: 1

      well, user accounts can be inherited right?

      --
      -- no sig today
    9. Re:Who needs native code by justforgetme · · Score: 1

      my hp mini 210 disagrees with all your points

      --
      -- no sig today
    10. Re:Who needs native code by justforgetme · · Score: 1

      Well, that's true. JS introduces a hell of a lot of overhead in pretty much anything you might do. But I still have to say that webGL has impressed me. I haven't had a chance to seriously hack on it myself but from what I see being done with it i believe that you can do some pretty serious stuff.
      OTOH webGL is offloading stuff to the gpu so why would I want to use a plugin to offload stuff to the cpu? GPUs (for their bang) are more efficient than cpus anyway.
      BTW, I can't believe no one mentioned webGL up to this point.

      --
      -- no sig today
    11. Re:Who needs native code by tenco · · Score: 1

      my eeepc 1005pe disagrees with your hp mini 210

    12. Re:Who needs native code by justforgetme · · Score: 1

      my nokia 8210 disagrees with everything

      --
      -- no sig today
    13. Re:Who needs native code by tehcyder · · Score: 1

      Endoctrine isn't an English word. You were looking for indoctrinate.

      I was going to add a deliberate spelling mistake in this post to keep up the slashdot tradition, but I just couldn't bring myself to do it.

      --
      To have a right to do a thing is not at all the same as to be right in doing it
    14. Re:Who needs native code by badkarmadayaccount · · Score: 1

      Try programming a GPU some time. Also - opening up space for kernel level exploits for teh shinyz is stupid. Also, JS should be natively compiled and optimized before being received by the browser, source only as fallback - who is gonna notice some ARM and x86 snippets in the web sever cache?

      --
      I know tobacco is bad for you, so I smoke weed with crack.
  5. who needs native code? by nimbius · · Score: 1

    anyone who recognizes you'll pay a pittance to the browser for your share of the fun.

    --
    Good people go to bed earlier.
  6. Superlinear speedup by timeOday · · Score: 1

    Ha ha, a 15x speedup by going from 1 to 8 cores? No. It's hard to invent a situation in which you would get a genuine 8x speedup, let alone somehow making each core almost twice as fast.

    1. Re:Superlinear speedup by jeffb+(2.718) · · Score: 2

      Since JS is normally single-threaded, I'm guessing that the one-core scenario is spending more than half its time on things other than the simulation. Additional cores can be dedicated entirely to the simulation. Under those circumstances, 15x speedup isn't the least bit surprising.

    2. Re:Superlinear speedup by Ceriel+Nosforit · · Score: 1

      Is it now? If the CPU spends half its time unparallellizable preparing its computation and that preparation can just be copied to the other cores, the max theoretical speedup is just under 16x.

      --
      All rites reversed 2010
    3. Re:Superlinear speedup by atisss · · Score: 1

      They probably will be pushing addition to Javascript, because the only things it missed so far was multithreading/semaphores/memory management.
      Finally the JavaScript will be complete

    4. Re:Superlinear speedup by LWATCDR · · Score: 1

      8 cores X 2 threads per core =16X
      Since the cores are also running the OS, Browser and goodness knows what else 15 X could be possible with more cores. Sort of like like your 40 megabyte program getting a massive speed up when you go from 512Mb of RAM to 2 Gb of RAM. PCs today are not like computers back in the day. They are often running a lot of other code besides your application. That is one reason that DOS is still popular for some tasks. Once your code is running pretty much that is all that is running.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    5. Re:Superlinear speedup by jeffb+(2.718) · · Score: 1

      You're looking at it the wrong way. Adding more cores allows more work to be done in a given interval -- in this case, computing and displaying more frames.

      The "other stuff" I was referring to is stuff external to the simulation, that doesn't have to be done repeatedly on other cores.

    6. Re:Superlinear speedup by TheRaven64 · · Score: 2

      It's not totally unbelievable, when you consider the fact that it's using WebGL. Doubling the speed at which the CPU prepares data for the GPU to render can more than double the overall throughput.

      --
      I am TheRaven on Soylent News
    7. Re:Superlinear speedup by AmberBlackCat · · Score: 1

      Is it now? If the CPU spends half its time unparallellizable preparing its computation and that preparation can just be copied to the other cores, the max theoretical speedup is just under 16x.

      If every process is going to work with exactly the same data then it doesn't matter if you have 1 core or 8. The data only has to be prepared one time. So the multiple cores won't save you time preparing that data with each cycle.

    8. Re:Superlinear speedup by WorBlux · · Score: 1

      Not necessarily. Some things will only need to be done once. Say currently that takes 2/3 of the cycle time. Some things will have to be done 15 times to speedup 15 times. These things look 1/3 of the original process. Add in the setup fee and it's not hard to see how you can get 15 times the performance in terms of fps.

    9. Re:Superlinear speedup by yakovlev · · Score: 4, Informative

      No.

      If half the work is unparallelizable then the max theoretical speedup is 2x.

      This is a simple application of Amdahl's law:

      speedup = 1 / ( (1-P) + (P/S) )
      where P is the amount of the workload that is parallelizable and S is the number of cores.
      speedup = 1 / ( (1-0.5) + (0.5/S) )
      lim S-> infinity (speedup) is 1/ 0.5 = 2x

      The likely reason the speedup appears superlinear here is that there are actually two speedups.

      1.) Speedup from parallelizing on multiple threads. From looking at the usage graphs, this is probably about 4x.
      2.) Speedup from vectorizing to use processor AVX extensions: This could be another 4x.

      Total speedup: 16x.

      A 16x speedup is totally believable for vectorizing and parallelizing a simple scientific simulation like the one shown in the video.

    10. Re:Superlinear speedup by timeOday · · Score: 1

      8 cores X 2 threads per core =16X

      Only if the CPU can run 2 threads each as fast as it could run 1. I've never heard of such a thing. (Hyperthreading certainly doesn't come close.) If there were such a beast, it would be marketed as a 16 core chip.

      Since the cores are also running the OS, Browser and goodness knows what else 15 X could be possible with more cores.

      If you have a multi-core machine, you don't need multithreaded javascript to run javascript on one core and other things on other cores.

    11. Re:Superlinear speedup by LWATCDR · · Score: 1

      Yes but it runs in more than one of those other cores. This also support SSE which may help a lot for some benchmarks as well. Of course you do not get a linar increase with cores but this may be in the range of possible with some specific benchmarks.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    12. Re:Superlinear speedup by timeOday · · Score: 1

      2.) Speedup from vectorizing to use processor AVX extensions: This could be another 4x.

      OK, that makes sense (although I would hope vector instructions could normally be tapped by optimizing libraries instead exposing the vector api to the programmer).

      You win "IMHO the best answer to my question."

    13. Re:Superlinear speedup by kramulous · · Score: 1

      There are numerous ways to get superlinear speedup. Turns out that it is not that hard. There is more to parallel programming that just 'cores'. Of course, it depends on the algorithm.

      eg
      Matrix Multiply 101

      --
      .
    14. Re:Superlinear speedup by yakovlev · · Score: 1

      I'll go you one better. I would hope that vector instructions are utilized by the compiler even for code that doesn't explicitly go after using them.

      At a minimum, it should be possible to provide a "write your code like this, and it will be easy for the compiler to detect that what you really want is vector instructions."

      However, sometimes interpreted languages can work against this due to things like strict exception checking.

    15. Re:Superlinear speedup by adri · · Score: 1

      .. err, I think you missed the point with vectorised instructions and interpreted languages.

      If your interpreted language has no vector operations, then although your compiled binary interpreter can vectorise, the data operations being given to your interpreter is not vectorised. Think about it for a minute. Your interpreter is just doing while (read VM opcode) (call func[VM opcode]) ; the data isn't in a parallelable/vectorised form; nor will the CPU ever see it that way. The CPU just sees the VM opcode stream.

      For JITs this is different. I haven't done much digging here, but again getting vectorised performance out of a JIT requires the underlying data be in the right format.

      This is why out of order, parallel instruction execution is a lot "better" for random applications (including interpreters and JITs) - because you're parallelising the instructions themselves, rather than trying to operate on vectored data. Your VM environment and/or application likely doesn't give you the correctly formatted data set.

      I tinkered with vectorised instructions in a FORTH style bytecode stream. Where you pass the data list to vectored instructions. This provided a huge speed benefit. Trouble was, it was FORTH. :)

    16. Re:Superlinear speedup by Ceriel+Nosforit · · Score: 1

      I think I miscommunicated something. The idea was to show an exception which disproves the original postulate (can't speed up more than 8x on 8 cores). I wasn't referring to what is possible in the SIMD setting only. If the computation of the desired result on a single core only gets half its time for some very likely reason, say you're playing MP3s too, then adding 7 more cores will appear as if there were 14 more of the usual time slots for your parallel task.

      --
      All rites reversed 2010
    17. Re:Superlinear speedup by yakovlev · · Score: 1

      I guess I was thinking JITs, or something like perl that is semi-compiled.

      You're of course right that a simple straight-line interpreter can't do much optimization, but this isn't how modern javascript engines work. Getting a correctly formatted data set is part of the "write your code like this" idea I posted above.

      My real point was, if it's possible to do, I would prefer the javascript engine do the work for me. That way I can write standards-compliant code that will compile and run on a machine without special vector language extensions, but that will be blazing fast on a machine supporting vector instructions.

  7. Wow, that is a terrible page to read by danielcolchete · · Score: 1

    We need some sort of metrics here. The I Programmer article content here is using only 314x1213 pixels on my laptop. The whole page have 1160x2078! Only about 16% of my screen area is the article's content. This is like listening to 50 minutes of commercials every hour on the radio. No one would accept that on the radio and I say we shouldn't here. Thanks!

  8. Web Workers by ttong · · Score: 1

    We already have Web Workers, they just can't access the DOM. Why can't they just try to improve the existing framework instead of inventing their own?

    1. Re:Web Workers by georgesdev · · Score: 1

      which standard has Microsoft improved in the past?

    2. Re:Web Workers by Billly+Gates · · Score: 1

      Actually Microsoft is doing a 180 since IE 8 due to losing marketshare and the threat of HTML 5 and the IPad.

      IE 9 is a decent browser. It truly has caught up and supports SVG, HTML 5 canvas elements, hardware acceleration, CSS 3 (even animations), xhtml (about damn time), and so on. You no longer need the horrible hacks to get anything done in it like tricking it to read xhtml when it does not support it.

      Windows 8 supports Web Workers with IE 10 and according www.html5test.com its HTML 5 is on par with Chrome and Firefox making it a lead browser. The only reason it did not get a perfect score is the lack of WebGL due to security issues, but IE 9/10 support CSS 3D.

      If the Windows 8 Pad/Tablet takes off you can bet mass adodption of web workers. Also Microsoft is switching now from a 2.5 year to a 1 year release browser cycle. In 5 years IE 14 will be out. It will be a very different place than where we were with IE 6 for 7 years.

      Even if you want to scoff at my comment and NEVER use IE this is great news. It means webmasters can finally use things like webworkers and advanced designs in their pages as IE 7 always held them back. It is great at work too if you are stuck with IE. IE 9/10 is at least modern and finally doesn't suck even if it is not the best.

    3. Re:Web Workers by Gyrony · · Score: 1

      "A ParallelArray abstraction for JavaScript and a Firefox add-on to enable parallel programming in JavaScript targeting multi-core CPUs and vector SSE/AVX instructions." Sounds to me as though this is not Multithreaded JavaScript or a replacement for Web Workers, but an implementation of vector processing for JavaScript, using OpenCL

  9. Looks like their blog server... by jeffb+(2.718) · · Score: 1

    ...could use a bit of multicore speedup itself.

  10. Re:Fuck parallel programming. by TheRaven64 · · Score: 5, Insightful

    Not entirely. One of the features of Sun's cancelled Rock CPU was something they called Thread Scout. The idea was to run one core ahead of another, skipping most computation, to pre-fault memory addresses. This ensured that data was in cache when it was needed. There was also an idea to use multiple cores to extend the superscalar concept, so when you encountered a branch one core took each potential path and you discarded the wrong one. A lot of GPUs used to do this, but no general purpose CPUs (that I'm aware of, although ARM and Itanium do something similar with their predicated instructions).

    You're right that you won't get the full benefit of writing proper concurrent code, but you will get some.

    --
    I am TheRaven on Soylent News
  11. When your GPU sucks by gr8_phk · · Score: 1

    If your GPU sucks, try to get people to buy 8 CPU cores and do graphics on those. Seriously, doesn't WebGL allow use of the GPU? If not, fix that.

    1. Re:When your GPU sucks by royallthefourth · · Score: 1

      WebCL already exists and has a test implementation from Nokia. Also, those 8 cores would be better than nothing for a software renderer, but not even close to what's built-in on a nice motherboard. The new chips from Intel and AMD with the GPU on the same die as the CPU is the only real hope for 3D for people who don't know well enough to get a motherboard with the right chipset or a computer with a nice discrete GPU.

  12. Re:so 8x parallelism yields 15x speedup? by Nadaka · · Score: 1

    wait time bound magic.

    multiple independent processes on a single core can cause a speedup over the same tasks in a single process because other processes can run while one is waiting for IO.

  13. Re:I understand what their doing... by Pino+Grigio · · Score: 1

    It's frightening how rumpsmackingly crap JS is as a language, yet it seems to be the Next Big Thing for software development according to all of the dribbling articles I keep reading about it.

  14. Re:Fuck parallel programming. by jgagnon · · Score: 1

    So... what? It's an advanced form of out-of-order execution. Big deal, it's been around a LONG time. Revolutionary my ass.

    --
    Remember to maintain your supply of /facepalm oil to prevent chafing.
  15. Re:I understand what their doing... by Toonol · · Score: 1

    Javascript's not a bad language. The pain in javascript programming is usually caused by the DOM and browser cruft... and you'd have to deal with that regardless of what web-scripting language you used.

  16. Square Peg meet Round Hole by trcollinson · · Score: 1

    I see no problem at all with a parallel version of JavaScript. But the question I have is who is really going to use this? Granted, some might say "anyone who wants to make money, this is the future of gaming and entertainment". I certainly hope it isn't! Is a browser really the platform of choice for high performance graphics? I think not. Is there anything really wrong with having a native client to produce something so specialized as a graphics intensive platform? Must we really look to a future where everything runs inside of a browser?

    1. Re:Square Peg meet Round Hole by Coren22 · · Score: 1

      This is the next best thing for Zynga though :)

      --
      APK likes to ask for responses to the same things over and over. Maybe he just likes the responses?
    2. Re:Square Peg meet Round Hole by r3x_mundi · · Score: 1

      There is nothing wrong with having a native client for specialized graphic intensive applications....but why cant the web browser also perform some of these more general tasks? No-one is suggesting you implement a Graphics API in Javascript, but a web browser is more then capable of hosting some fairly advanced graphical visualizations or games by building on top of lower level components like Canvas or WebGL.

      Most "game engines" are based on similar architectures....highly performant engine components written in native C++, but game logic and user interface scripted in a higher level languages (LUA, QuakeC etc).

      Native is always better for no-compromise performance and for taking full advantage of the platform, but web browsers have their place too.

  17. Re:Fuck parallel programming. by Wrath0fb0b · · Score: 1

    There was also an idea to use multiple cores to extend the superscalar concept, so when you encountered a branch one core took each potential path and you discarded the wrong one.

    Given how accurate branch predictors are, what's the point in computing the non-predicted paths?

  18. Re:Fuck parallel programming. by Renegrade · · Score: 4, Interesting

    Not entirely. One of the features of Sun's cancelled Rock CPU was something they called Thread Scout. The idea was to run one core ahead of another, skipping most computation, to pre-fault memory addresses.

    That was done back in the days with the original 68000. They were put in tandem in some machines, and one processor ran slightly ahead of the other. If it hit a bus fault, the second 68000 was used to recover, as the original 68K could not recover normally from a bus fault. Obviously this was not for performance purposes, but rather for reliability, but it's amazingly similar.

    The oh-ten could recover from bus faults, and the 020 had a full-scale (although external) MMU option, so the technique ceased to be used.

  19. Oh boy!!! by frank_adrian314159 · · Score: 5, Insightful

    That means the animated ads can now suck up all of my CPU, rather than just one core's worth. I can't wait!

    --
    That is all.
    1. Re:Oh boy!!! by badkarmadayaccount · · Score: 1

      AdBlock Plus. Geek card please.

      --
      I know tobacco is bad for you, so I smoke weed with crack.
  20. that is the future? by devent · · Score: 2, Insightful

    Instead of get a 50$ graphics card and play Doom3 on it, we need now 8 cores CPU to play JavaScript games in the browser? That is the bright future we can look for with ChromeOS and "the browser is the OS" future?

    --
    http://www.mueller-public.de - My site http://www.anr-institute.com/ - Advanced Natural Research Institute
    1. Re:that is the future? by Toonol · · Score: 1

      I honestly don't know which direction of modding you think is appropriate for that comment.

    2. Re:that is the future? by blackfrancis75 · · Score: 1

      well that's just sad. There's no talk of *needing* 8 processors for anything - that was just part of the set-up for the demonstration. Also the code isn't JavaScript - it 'looks like' JavaScript and would replace it. Also no-one's going to stop you playing Doom3, but why not compare with the hardware required for a semi-recent game.. Crysis for example? Oh, because that wouldn't support your trolling..

    3. Re:that is the future? by royallthefourth · · Score: 1

      Surely you've noticed that besides the number of polygons getting pushed out and how fast you can decompress a large file, your daily tasks aren't any faster than they were 10 years ago. How's your word processor doing? Still chugging along? Doing anything useful that it didn't before?

  21. People who have 8 cores by drolli · · Score: 1

    but rather prefer to use them for something meaningful but the weirdly scrolling ad annoying them in some partialy visible background window....

    1. Re:People who have 8 cores by Yvan256 · · Score: 1

      I think it means people with single-core computer will only get a scrolling banner ad.

      People with a multi-core computer will get a scrolling banner ad with parallax scrolling backgrounds!

  22. For programmers: What DO the extensions look like? by mrjb · · Score: 1

    According to this page, RiverTrail "adds the ParallelArray data type to JavaScript [...] accessible by functions like combine, filter, map, reduce, etc. which perform work in parallel." Hope that saved you some searching.

    --
    Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
  23. Application load balancing by __aazsst3756 · · Score: 4, Insightful

    Why should an application decide the best way to split a load over multiple cpu cores? How does it know what else is going on in the OS to balance this load? Shouldn't the OS handle this behind the scenes?

    1. Re:Application load balancing by CentTW · · Score: 2

      Short answer: It doesn't work that way. Programs can only be split over multiple cores if they are designed to use those cores. Most programs aren't because it's harder to write, maintain, and the extra processing power often isn't necessary.

      Long answer: A program is a sequence of instructions that normally have to be run one after another to complete a task. Imagine a program designed to make a peanut butter and jelly sandwich. The highest level of the program might look something like this (the rest of the program would ultimately describe what these steps mean):

      1. Obtain ingredients()
      2. Open(Peanut butter)
      3. Open(Jelly)
      4. Spread(Peanut butter,Bread0)
      5. Spread(Jelly,Bread1)
      6. Combine(Bread0,Bread1)
      7. Clean Up()

      These steps can easily be followed directly by 1 cook to create 1 PB&J sandwich. Adding extra cooks won't speed up the process, because most of the tasks rely on a previous task being finished. If you're only interested in 1 PB&J sandwich, chances are pretty good you're best bet is to just let one cook make the one sandwich.

      Now, if you want to make a hundred PB&J sandwiches, you'll be able to take advantage of extra cooks, but you'll need to change your instructions a bit so that they don't run into each other (too often) and don't waste time opening and closing jars after each sandwich.

      The biggest problem is that the operating system doesn't know when it has a task that can be split across multiple processors to improve the speed. makeSandwich(1) looks no different to it than makeSandwich(100). Even if it could figure out that the task could be done across processors, it wouldn't know where to split the task, or how to put the pieces back together.

      Generally speaking, in the software world, when you hear about people talking about threads, they are trying to split a task across multiple processors. So, a thread is a piece of code that has work to do, won't (typically) interfere with other threads, and can be run on any processor. So, when an operating system sees a new thread, it'll run it on whichever processor it thinks will get the job done the fastest, which is how load balancing is done.

    2. Re:Application load balancing by martin-boundary · · Score: 1

      Short answer: It doesn't work that way. Programs can only be split over multiple cores if they are designed to use those cores. Most programs aren't because it's harder to write, maintain, and the extra processing power often isn't necessary.

      Short reply: Most programs call system services and libraries to do specialized work. The internals of those system calls and library calls do not matter to the programmer, only their interface does. If the tasks they perform is sufficiently high level, then the parallelism can be inbuilt and transparent.

    3. Re:Application load balancing by optymizer · · Score: 1

      Because only the application knows how to split its own inputs so that multiple worker threads can each work independently on an input chunk. The job of the OS is to figure out how much CPU time each worker gets, based on a variety of factors (such as thread and process priority/nice-ness). If you have multiple CPUs and they're not at 100% usage, this results in parallel processing of those inputs.

    4. Re:Application load balancing by TheTyrannyOfForcedRe · · Score: 1

      Short answer: It doesn't work that way. Programs can only be split over multiple cores if they are designed to use those cores.

      That's only true for some languages. Programs written in pure functional languages such as Haskell absolutely can be split across multiple cores by the compiler/runtime without being designed to be "multithreaded."

      --
      "Liechtenstein is the world's largest producer of sausage casings, potassium storage units, and false teeth."
    5. Re:Application load balancing by johanatan · · Score: 1

      You are thinking too imperatively. Use functional programming and automatic parallelization becomes possible.

    6. Re:Application load balancing by brm · · Score: 1

      That's only true for some languages. Programs written in pure functional languages such as Haskell absolutely can be split across multiple cores by the compiler/runtime without being designed to be "multithreaded."

      On the other hand, pure functional languages such as Haskell often cannot be made to effectively use a bounded set of resources (such as a finite number of cores and memory).

    7. Re:Application load balancing by tlhIngan · · Score: 1

      Why should an application decide the best way to split a load over multiple cpu cores? How does it know what else is going on in the OS to balance this load? Shouldn't the OS handle this behind the scenes?

      It depends on a lot of factors.

      Advantages for doing it in application space include the application knowing what it's doing, and if the OS is saying there's a shortage of CPU time, the application can decide what load to shed more effectively than submitting work and hoping it gets done on time.

      Disadvantages include well, most programmers are idiots and will misuse such functionality. Parallel programming is hard, high-performance parallel programming even more so.

      Advantage of the OS management includes isolation from idiocy and general fairness. But disadvantages include the OS not knowing what work can be pushed off and what work is critical, leading to situations where things can stutter when you don't want them to. All decisions the OS makes are in a vacuum, and have to be balanced between background processes and foreground applications. Also, applications are unaware of how much CPU time they can actually get, so they may create 100 threads and assume that at any time, all 100 can be kicked off.

      In the end, it's a mix of both worlds - you can do it all in the OS with the application submitting high level jobs (threads and processes model, with OS managing both),

      It's sort of the model of Grand Central Dispatch in OS X and ported to BSD - the OS manages the processors, the applications submit work that can be parallelized and the OS decides based on the current load and idleness how many tasks to run together for optimum utilization of the processors. So instead of Photoshop deciding you have a 16-processor system and creating 16 threads to process a filter, while oblivious to the fact that the video encoder task in the background has done the same thing (and resulting in thrashing), the OS can simply decide to run Photoshop on 8 processors and the encoder on the other 8, resulting in more efficient utilization since the scheduler doesn't have to schedule all 16 Photoshop threads then context switch to 16 encoder threads (which cause lots of overhead).

      And if the user runs another program, the OS adjusts the workload accordingly. The applications stop caring about the number of processors and creating the optimum workload, and the OS avoids having to waste CPU time scheduling and context switching unnecessarily.

  24. Re:JS Threading without intervals/timeouts! by mrjb · · Score: 2

    Now all we need is a "sleep" function.

    --
    Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
  25. Parallelism : crashing the browser 8 times quicker by billcopc · · Score: 1

    Just to make sure I got this straight:

    Intel took one of the slowest interpreted languages, though the most popular one, and added parallel data primitives and functions. Then they used a pointless little particle fountain demo to show off its benefits.

    So rather than try to make Javascript execute faster, they spread its disease to all 8 cores. How is this an improvement ? The last thing I want is for a web page to sap my CPU and battery life, doing things web pages should not be doing in the first place. Save that Javascript for friendly client-side form validation and UI animation. Everything else is a hack. 3D graphics in the Javascript is a hack. Heavy number crunching in Javascript is a hack. Fuck off with your hacks! If I want fancy graphics and high framerates, I'll run native code.

    --
    -Billco, Fnarg.com
  26. Re:Mod parent by Billly+Gates · · Score: 1

    Web workers takes care of this and launches things in different processes. The only browser that doesn't support it is IE, but that will change with Windows 8 next spring.

    It can take care of this without Intel's code

  27. benchmarks by suitti · · Score: 1

    I have a couple benchmarks i've run over the years, in multiple languages. For CPU intensive jobs on the same machine:

    C: 1
    Java: 1.1-3
    javascript: 117

    Javascript is in IE8 on win xp.

    Javascript on IE has restrictive time limits for execution, though there are work arounds.
    But If you have 8 cores, you're still 14.6x slower than C.

    IMO, Java, which already runs in the browser, is the better solution. That said, compared to C, Java also has huge memory requirements.
    It would make more sense to allow mutli-core execution in Java in the browser.

    --
    -- Stephen.
    1. Re:benchmarks by BZ · · Score: 2

      > Javascript is in IE8 on win xp.

      Uh.... This is the same IE8 that doesn't have a JIT, right? Unlike every single browser actually shipping now?

      Here's a relevant graph: http://ie.microsoft.com/testdrive/benchmarks/sunspider/default.html

      It's a bit out of date, since all browsers have gotten faster since then, but it shows IE8 being about 18x slower than any modern browser on this particular benchmark. And this is a benchmark that hammers a lot on the VM (dates, regular expressions, etc), not the language itself.

      On code that runs for longer than a few ms and is actually compute-intensive the difference between IE8 and any modern browser is even more pronounced.

      Heck, at this point you can compile C code to JavaScript and then run it in some browsers and have it be only about 5x slower than the original C code. That's with (typed) arrays representing the C stack and heap and so forth...

      I'd love to see your benchmark code, by the way. Or for you to rerun the benchmark in something that actually tries to run Javascript quickly, as opposed to IE8.

    2. Re:benchmarks by kramulous · · Score: 1

      That's interesting ... how long ago did you do this?

      I've spent the better part of 4 hours trying to get RiverTrail to compile for Linux with no luck. I'd love more compute grunt for web graphics (online scientific visualisation) and this seemed pretty good.

      Usually I use Java but really need access to the xmm intrinsics.

      Perhaps I'll forget about parallel javascript if it is really as bad as you say.

      --
      .
  28. Re:Fuck parallel programming. by godrik · · Score: 1

    It might not only be out of order execution. It might must be cache. 8 cores certainly run on more than 1 L3 cache. More cache=>(possibly superlinearly) faster

  29. Re:Fuck parallel programming. by justforgetme · · Score: 1

    I think all functional langs do that

    --
    -- no sig today
  30. Re:NaCL + pthreads by gl4ss · · Score: 1

    Interesting.

    Google Native Client can run C++ multi threaded in a browser using pthreads.

    java applets can run multi threaded. I bet a lot of other extensions can do multi thread too, maybe even shockwave? I guess the point about this is that it looks like javascript, ughh.

    --
    world was created 5 seconds before this post as it is.
  31. Re:But does it run on Linux? by LordThyGod · · Score: 1

    Time to wake up. A good part of the world runs on Linux, starting with Google, Facebook, Android ...

  32. Re:Fuck parallel programming. by LingNoi · · Score: 1

    How can it be a troll and the guy not know anything at the same time..

  33. Re:I understand what their doing... by badkarmadayaccount · · Score: 1

    Mod parent up +1 Down To Earth.

    --
    I know tobacco is bad for you, so I smoke weed with crack.
  34. Re:Fuck parallel programming. by luxifr · · Score: 1

    You do realize you are responding to a troll, right? This guy is just some loser php "programmer" who knows jack and shit about real programming.

    flamebait? what's that shit about allways picking on php? you could even do parallel programming in php