WebAssembly Threads - HTTP 203

Ғылым және технология

Surma tries to explain WebAssembly, threads and WebAssembly Threads to Jake. He also has scary diagrams and uses assembly language. Just in time for Halloween. Spooky. We hope you enjoy. If you read this far, thank you. We appreciate your thoroughness. Put a 👻 at the end of your comment as a secret signal that you are a description reader.
WebAssembly Text Format → goo.gle/2Hwm30W
WebAssembly Spec → goo.gle/3krRVSJ
Atomics → goo.gle/35pnCGc
WebAssembly Threads proposal → goo.gle/3krRVSJ
Other videos in the series → goo.gle/2wneQLl
Subscribe to Google Chrome Developers here → goo.gle/ChromeDevs
Also, if you enjoyed this, you might like the HTTP203 podcast! → goo.gle/2y0I5Uo

Пікірлер: 84

  • @timwangdev
    @timwangdev3 жыл бұрын

    I love this version of HTTP 203 so much, which has a length of 20-30 mins and more in-depth conversation. Great work! 👻

  • @cat-.-
    @cat-.-3 жыл бұрын

    Woo this is what i wanted to learn about but too lazy to look at docs and specs Happy halloween👻

  • @rishabhanand4270
    @rishabhanand42703 жыл бұрын

    Beautiful explanation surma. Now im onward to find a usecase of wasm threads for my blogging website.

  • @RickBeacham
    @RickBeacham3 жыл бұрын

    I really enjoy learning from both you! Thanks!

  • @sonyarianto
    @sonyarianto3 жыл бұрын

    wow Surma, brilliant, you have deep undertanding of how things work

  • @BrickieBuilder
    @BrickieBuilder3 жыл бұрын

    Really enjoyable breakdown of modern specs mapped to support classical programming paradigms.

  • @gouravkhator
    @gouravkhator3 жыл бұрын

    Thank you guys this is just another great video which can be learnt or studied through great researches and many years of knowledge and experience

  • 3 жыл бұрын

    If the slides are skipping, it’s probably the joy-con drift.

  • @fatemehazizkhani5414
    @fatemehazizkhani54143 жыл бұрын

    thanks for sharing this helpful and informative talk with us... I am new in programming and watching such videos makes me excited

  • @davidedey3623
    @davidedey36233 жыл бұрын

    Link to the episode on COOP and COEP that Jake mentioned at the end: kzread.info/dash/bejne/qJp1qsNud6WymdI.html

  • @daniyelme9535
    @daniyelme95353 жыл бұрын

    Thank you guys!

  • 3 жыл бұрын

    We are hopefully going to see a lot of C libraries, like image and video processing being ported to the web! 👻

  • @jakearchibald

    @jakearchibald

    3 жыл бұрын

    That's what we did for squoosh.app

  • 3 жыл бұрын

    @@jakearchibald I know, I peeked under the dev tools hood!

  • @dandcodes
    @dandcodes3 жыл бұрын

    Does Surma use a Switch controller for navigating slides during these videos?

  • @LuLeBe

    @LuLeBe

    2 жыл бұрын

    I think they've done that a few times, yes. Maybe more than a few times but I've only actually seen it like 2 times.

  • @juliasemenova4000
    @juliasemenova40003 жыл бұрын

    The perfect playlist for daily watching 👻

  • @hypersonic12
    @hypersonic123 жыл бұрын

    SIMD intrinsics tutorial in Rust next please!

  • @jaysistar2711
    @jaysistar27112 жыл бұрын

    19:30 It can be argued that the OS is outside of the process, and, therefore, the same sort of thing is done to spawn threads: a"system call" or some exposed way of calling something running at a more privledged level.

  • @MrUrag
    @MrUrag3 жыл бұрын

    Thank you for sharing this video very informative and helpful.

  • @AndrzejPauli
    @AndrzejPauli3 жыл бұрын

    If I'm right in anticipating what comes next; I would love to see some next HTTP 203 episode about Atomics and SharedArrayBuffers :-). Specially linking with previous episodes about COOP, CORB and other 4 letter acronyms security features. Maybe after release of Chrome 88 which will have those settled with crossOriginIsolated.

  • @timgerk3262
    @timgerk32623 жыл бұрын

    this is a compliment from the not-quite-dead-and-gone: wasm is becoming what Java always wanted to be, relative to JS as a complete & event-driven job control language...SPOOKY 👻

  • @maxb5919
    @maxb59193 жыл бұрын

    great vid. Thanks :3

  • @wobble_cat
    @wobble_cat3 жыл бұрын

    Debugging with alerts? Yeah, I remember the time when I had many of them in a single script to make sure that everything is going how it supposed to be :D

  • @tahoemph
    @tahoemph3 жыл бұрын

    The description of something that blocks after checking a value is close to how you would use a condition variable in combination with a mutex than what a bare mutex usually is.

  • @patrickc.6183
    @patrickc.61833 жыл бұрын

    Great video 👻!

  • @DavidAlsh
    @DavidAlshАй бұрын

    I'd love an update on the state of wasm, threads, etc, Rust in 2024!

  • @srijanreddy
    @srijanreddy3 жыл бұрын

    Amazing video guys...👻

  • @zuzanahroudova9028
    @zuzanahroudova90283 жыл бұрын

    Thanks! 👻

  • @bahatijustin
    @bahatijustin3 жыл бұрын

    I've been using WebAssembly with rust and c++ but think I should try writing WAT by hand 👻

  • @martixy2
    @martixy23 жыл бұрын

    9:45 Technically all of javascript is syntactic sugar over hardware machine code (x86, arm, what-have-you).

  • @SimonBuchanNz

    @SimonBuchanNz

    3 жыл бұрын

    "syntactic sugar" is generally reserved for local translations, so eg functions are out due to things like argument renaming and return addresses being actual features that require agreement between different parts of the code, but a variable declaration might count as it's just an alias for some memory address (so long as you don't count the allocation of those addresses by the compiler) So WAT is reasonable to call a sugar, as the translation for each statement is very local and largely doesn't depend on any other part of the file (the only exceptions being a function name table, really) But really, sugar is a very ambiguous term, it's very hard to argue convincingly about why something is or isn't.

  • @SmujMaiku
    @SmujMaiku3 жыл бұрын

    "Oh no?" What oh no?

  • @lohitakshtrehan6379
    @lohitakshtrehan63793 жыл бұрын

    Happy Halloween!!! 👻

  • @nathnolt
    @nathnolt3 жыл бұрын

    Nice

  • @CyberAcidPlanet
    @CyberAcidPlanet3 жыл бұрын

    10:32 should we call that a race condition?

  • @tmbarral664
    @tmbarral6643 жыл бұрын

    spooky..ky....ky....ky...👻

  • @GauravYadav-rv7wx
    @GauravYadav-rv7wx3 жыл бұрын

    I see a photo of gentleman, it's written gone but not forgotten, who is he?

  • @charlescote3989

    @charlescote3989

    3 жыл бұрын

    I was wondering the same

  • @Aphixx
    @Aphixx3 жыл бұрын

    How expensive is context switching from JS to wasm? Is it different in a worker/thread context? Cheers 👻

  • @dassurma

    @dassurma

    3 жыл бұрын

    Same thread. It’s fairly optimized, but obviously does have a small cost. But for example Emscripten calls into JS for every single OpenGL call (and backs it with WebGL) and it performs really well.

  • @Aphixx

    @Aphixx

    3 жыл бұрын

    @@dassurma Interesting, I definitely didn't expect that to be the case for emscripten/OpenGL -- thanks!

  • @SimonBuchanNz

    @SimonBuchanNz

    3 жыл бұрын

    There's some work to allow passing JS, including DOM, objects to WASM (which is currently sort of allowed), and allowing it to call into them, which presumably could be quite well optimized.

  • @florianreuschel2951
    @florianreuschel29513 жыл бұрын

    wait surma don't you leave us with that cliffhanger D:

  • @dassurma

    @dassurma

    3 жыл бұрын

    Well the episode went live so it seems like everything went okay after all ;)

  • @kiwiabcdefghijklmnopqrstuvw
    @kiwiabcdefghijklmnopqrstuvw3 жыл бұрын

    "gringo" died but you are still showing him as alive on google

  • @SamualN
    @SamualN2 жыл бұрын

    is that paul?

  • @victornpb
    @victornpb3 жыл бұрын

    I don’t understand why you can’t have typed arrays like uint8_t as shared arrays, it would make a lot more sense than having everything tied to 64bit, specially for things like strings it puts unnecessary memory pressure specially for mobile devices

  • @dassurma

    @dassurma

    3 жыл бұрын

    You totally can. `new Uint8Array(new SharedArrayBuffer(128))` works. It often makes more sense to use `DataView` tho

  • @adamtolbert1296
    @adamtolbert12963 жыл бұрын

    I assume this has fully replaced the audio podcast then??

  • @jakearchibald

    @jakearchibald

    3 жыл бұрын

    We're planning more podcasts, just been pretty busy with Chrome Dev Summit stuff recently.

  • @EonMack
    @EonMack3 жыл бұрын

    Are you using a joycon for changing slides?

  • @dassurma

    @dassurma

    3 жыл бұрын

    Yes! Jake introduced me to that

  • @EonMack

    @EonMack

    3 жыл бұрын

    @@dassurma is that just a joycon driver for bluetooth?

  • @dassurma

    @dassurma

    3 жыл бұрын

    @@EonMack it doesn't even need a special driver. I just paired it and used Web Gamepad API

  • @EonMack

    @EonMack

    3 жыл бұрын

    @@dassurma Awesome thanks for the response!

  • @djudju8047
    @djudju80473 жыл бұрын

    The days of C are counted.

  • @ratias0
    @ratias03 жыл бұрын

    Thanks, 👻

  • @GiangLe-xi5gv
    @GiangLe-xi5gv3 жыл бұрын

    👻👻

  • @Manivelarino
    @Manivelarino3 жыл бұрын

    You really ran out of easy topics huh. Y u gotta bring assembly to my website I'm just trying to make my buttons look nice 😅

  • @jakearchibald

    @jakearchibald

    3 жыл бұрын

    fwiw, the next episode is about using CSS/JS to fade something in, and back out again… and all the ways that can go wrong.

  • @dassurma

    @dassurma

    3 жыл бұрын

    @@jakearchibald nothing is ever simple 😭

  • @dassurma

    @dassurma

    3 жыл бұрын

    Except vertical centering nowadays 😮

  • @SimonBuchanNz

    @SimonBuchanNz

    3 жыл бұрын

    @@dassurma not when you are trying to center the visual boundary of a button label, rather than the logical line boundary (at least from what I could find!)

  • @DJTechnostyler
    @DJTechnostyler3 жыл бұрын

    You should have a look to AssemblyScript

  • @dassurma

    @dassurma

    3 жыл бұрын

    Oh I am _very_ aware. I love ASC (to the point where I even wrote a rollup plugin for AssemblyScript. github.com/surma/rollup-plugin-assemblyscript)

  • @MaxCoplan
    @MaxCoplan3 жыл бұрын

    Surma says SIMD types in WASM are just 128bits long. Are there any WASM runtimes that take advantage of native AVX instructions or YMM registers where available? The true power of SIMD doesn't come from the wide registers, it comes from the cpu-specific instructions that take advantage of them

  • @dassurma

    @dassurma

    3 жыл бұрын

    That is up to the engine. As I said, wasm is a intermediate format. So they needed a SIMD bit width and instruction set that compiles to native SIMD instructions on as many architectures as possible.

  • @SimonBuchanNz

    @SimonBuchanNz

    3 жыл бұрын

    @@dassurma that actually confused me, as I expected that the primary use would be float operations (for matrix math)

  • @dassurma

    @dassurma

    3 жыл бұрын

    How is my statement confusing wrt the use case you are stating?

  • @SimonBuchanNz

    @SimonBuchanNz

    3 жыл бұрын

    @@dassurma not your statement, sorry, the fact that i128 alone was found useful enough to spend the spec and implementation time on. I guess there are some uses like bloom filters or bignum (maybe image compression?) that can get a lot of value, but it's a bit of a surprising disappointment to me that float isn't when it's the first example I always see. I can see the argument that it's probably in the cases that you need float SIMD that you *need* it to be SIMD, while it's a nice to have for int, but that's just a guess.

  • @dassurma

    @dassurma

    3 жыл бұрын

    @@SimonBuchanNz Oh I think I understand now! Sorry, I wasn’t completely thorough in what I said. Of course the SIMD proposal also supports interpreting the 128-bit vector as 4x 32-bit float or 2x 64-bit float.

  • @mikehurtado4772
    @mikehurtado47723 жыл бұрын

    Spanish subs. Thanks

  • @rlamacraft
    @rlamacraft3 жыл бұрын

    Cool, but why??

  • @jakearchibald

    @jakearchibald

    3 жыл бұрын

    Well… threads have some history of success when it comes to application development

  • @rlamacraft

    @rlamacraft

    3 жыл бұрын

    @@jakearchibald so is the end goal to turn the Web platform into a fully functional virtual machine?

  • @jakearchibald

    @jakearchibald

    3 жыл бұрын

    @@rlamacraft I'm not sure what you mean by "fully functional" or "virtual machine". Web pages already run in a sandbox of sorts. Eg, you don't want a web page to be able to access your local filesystem without up-front permission.

  • @rlamacraft

    @rlamacraft

    3 жыл бұрын

    @@jakearchibald I’m just observing the fact that it seems like as the Web evolves it’s approaching the full capabilities of a desktop runtime. I get that things are being done in a more secure way, as you say by explicitly requiring permissions for powerful features, so I guess it’s approaching something like iOS’s model. It started off with HTML, and then CSS, and then full Turing completeness with JS, and now we’re at the point where we’re running assembly code in threads. Is the goal to make the Web platform as capable as any desktop environment, albeit once the user has given full permissions?

  • @jakearchibald

    @jakearchibald

    3 жыл бұрын

    @@rlamacraft I think that's kinda what the whole PWA thing is about web.dev/what-are-pwas/

  • @miroslavparvanov
    @miroslavparvanov3 жыл бұрын

    I don't like the fact that we need javascipt glue code in order to use threads in wasm. Javascript will be unremovable legacy even after 100 years :(

  • @dassurma

    @dassurma

    3 жыл бұрын

    That's why Wasi is so important imo

Келесі