Web in Native Assembly (Linux x86_64)

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024
  • НаукаНаука

Комментарии • 202

  • @garakchy
    @garakchy Год назад +479

    Protect this geek at all costs. He is a gem in modern world where people find even python a difficult language.

    • @snk-js
      @snk-js Год назад +11

      yesss, I am so grateful to find deep content in the surface of the web

    • @aziskgarion378
      @aziskgarion378 Год назад

      Sadly, his government will snatch him and force him to be a part of their military programs.

    • @varshneydevansh
      @varshneydevansh Год назад +34

      Python is difficult as it hides so many things behind the wrapper 😫

    • @shedontlove8490
      @shedontlove8490 Год назад +40

      He said it quite clearly on his last Twitch stream: "There's no magical book or course that will make you a programmer. Just endure the pain."
      That's the only way you can learn programming.

    • @axelkoster
      @axelkoster Год назад

      ​@@shedontlove84901:02:38

  • @helidrones
    @helidrones Год назад +98

    For me as a late boomer / early gen X this feels like coming home from a long journey. No dependency hell, can be debugged with pen and paper. Thank you!

  • @cobbcoding
    @cobbcoding Год назад +169

    oh my gosh he did webdev in the language the memes tell me not to learn because it is hard oh my.

    • @ocaly
      @ocaly Год назад +10

      But what a beautiful video he assembled here today for you!

    • @nikkehtine
      @nikkehtine Год назад +1

      The best way to do web dev is without the tools that have been made specifically for web dev

    • @angelcaru
      @angelcaru 6 месяцев назад +1

      too true​@@nikkehtine

  • @rkdeshdeepak4131
    @rkdeshdeepak4131 Год назад +54

    Best Web Dev Tutorial for beginners.

  • @bitmanagent67
    @bitmanagent67 Год назад +60

    Tsoding is a freaking genius!!! I love the way he decomposed problems and solves them one by one. He is a real OG programmer.

  • @im-anomalies
    @im-anomalies Год назад +10

    Dude, I really appreciate what you are doing, it is rare to have such of deep content (at least to me who is a junior myself) but yet entertaining.
    I really love to see and learn how things work under the hood, not just using them, and most of your video just fit that.

  • @DivineDarknesss
    @DivineDarknesss Год назад +25

    the cubicle bound webdev fears the recreational assembler

  • @bbq1423
    @bbq1423 Год назад +32

    1:32:20 You can use the `goto out` pattern used in the linux kernel here, as in for each error branch you'd do `jl out_x` where x is an incrementing number, then at the end of the function you have the labels in reverse.

  • @brunopena3710
    @brunopena3710 Год назад +20

    this is what i thought WebAssembly was at first.

  • @sortof3337
    @sortof3337 Год назад +9

    I watched and followed everything in the entire video. Oh man, it was so satisfying to see hello world. I even parsed the name myself. Thank you thank you.

  • @yyvan5125
    @yyvan5125 Год назад +6

    Watching this taught me a lot, on top of you explaining how things work, reading some docs and following along in c is super fun. Thank you mr Tsoding

  • @shipitko
    @shipitko Год назад +2

    wow, the development screencast by anyone who is not indian on youtube in 2023! instant subscription

  • @nefrace
    @nefrace Год назад +4

    This is the first video that I've fully watched on your channel, and now I want to try fasm in gamedev

  • @legendrags
    @legendrags 11 месяцев назад +1

    Yesterday, I didn't even know this guy. Now, he is one of the best ppl I know.

  • @JannisAdmek
    @JannisAdmek 9 месяцев назад +4

    If you ever feel neglected, just remember the EXIT_SUCCESS and EXIT_FAILURE he defined at 59:40 and then ignored for the rest of the stream.

  • @paoloose
    @paoloose Год назад +4

    i can literally watch you coding for hours

  • @grenadier4702
    @grenadier4702 Год назад +4

    Sockets automatically close on program exit
    Backlog defines the queue of waiting-to-connect sockets and already-connected sockets. If your backlog is 100, you have at maximum 50 connected sockets and 50 awaiting sockets

  • @JamesSjaalman
    @JamesSjaalman Год назад +8

    The size argument to bind() is also needed for copy_from_user to know how much to copy, without knowing the exact subspecies of the polymorphism. (BTW: the overlaid "struct sockaddr" construct is often named a "smart union")

    • @Tawre007
      @Tawre007 Год назад

      "struct sockaddr" hopefully doesn't want to get raised pay

  • @kompocik5195
    @kompocik5195 Год назад +15

    I love how you explained syscalls so fast. I do know that you don't make tutorials but maybe you would like to do one about Assembly etc. because you're explaining everything in very easy way without unnecessary theory while doing real-life examples :P.

    • @iamdozerq
      @iamdozerq Год назад +15

      this IS a tutorial for everyone who wants to learn

    • @pokefreak2112
      @pokefreak2112 Год назад +10

      all his videos are already tutorials, you can follow along and learn exactly what he's doing by googling the parts you don't understand
      I've been watching since 2019 and learned a ton
      anything more trimmed down than this would lose a bunch of important information

  • @remrevo3944
    @remrevo3944 Год назад +5

    1:56:35 In my experience you can also always just open the network tools and capture one request.
    That already shows enough about http to be useful.

  • @victornikolov537
    @victornikolov537 Год назад

    I like you find all that fun.
    That is the way to learn. If one can't enjoy learning it is torture.

  • @Arniores
    @Arniores Год назад +4

    watched the whole thing, actually cool

  • @whoopsimsorry2546
    @whoopsimsorry2546 Год назад +19

    Well, x86_64 has it, however if you were dealing with x86 amd and intel have different ways of calling syscalls and you'd have to use the vDSO. That's the original reason vDSO was created so you don't have to different syscalls for the different architecture. However, nowadays the vDSO also contains stuff that just shouldn't require kernel access like get_time() and stuff like that.

    • @__christopher__
      @__christopher__ Год назад +6

      On x86 you can just use INT 0x80, that works on both architectures.

  • @JakobKenda
    @JakobKenda Год назад +4

    13:15 I downloaded the fasm executable directly from their website and it is, in fact, statically linked

  • @rt1517
    @rt1517 11 месяцев назад +1

    1:23:43 It is really easy to implement htons in assembly using XCHG instruction.
    And for htonl, there is the BSWAP instruction.
    And for information, in C, you can use __builtin_bswap16/__builtin_bswap32 under gcc and _byteswap_ushort/_byteswap_ulong under msvc.

  • @bbq1423
    @bbq1423 Год назад +21

    1:45:20 The size field is calculated the wrong way around

    • @julesl2087
      @julesl2087 Год назад +2

      yeah it's "$ - .sin_family"

    • @remrevo3944
      @remrevo3944 Год назад +2

      @@julesl2087 Or as written in the documentation also just $ - .

  • @akashkarnatak6581
    @akashkarnatak6581 Год назад +5

    What a madlad!!

  • @bbq1423
    @bbq1423 Год назад +5

    There is a pretty neat clang built in that lets you dump structs in a formatted way (__builtin_dump_struct)

  • @konstantinsotov6251
    @konstantinsotov6251 Год назад +4

    That's what I thought of when I first heard the word "Webassembly"

    • @gempf
      @gempf 26 дней назад

      jajajaja, same bro

  • @gnorts_mr_alien
    @gnorts_mr_alien Год назад

    That was really fun you made me watch the whole thing!

  • @jamesnewman9547
    @jamesnewman9547 Год назад +8

    Starcraft used IPX by default for networking

  • @rebokfleetfoot
    @rebokfleetfoot Год назад +1

    i've done my share of assembly, but never thought about it as a web app, wild and cool idea :)N

  • @HPMuwa
    @HPMuwa Год назад +10

    You forgot close connfd, maybe if browser get close or content-length, it would be faster because browser will know that content is over

    • @HPMuwa
      @HPMuwa Год назад +1

      And will not wait new content

  • @disoversity
    @disoversity Год назад +2

    This channel is amazing.

  • @coldtech06
    @coldtech06 Год назад +15

    So when can we expect a developer bootcamp for beginners using this stack?

  • @telnobynoyator_6183
    @telnobynoyator_6183 Год назад +1

    > interpreter that outputs binary
    No way I had a similar idea a couple days ago for my own programming language and now I'm seeing an example of that x)

  • @nefrace
    @nefrace Год назад +1

    1:02:49 -- now that's my favorite way to tell user that everything is ok
    "Oking service"

  • @hughdavenport1
    @hughdavenport1 Год назад +2

    I had a similar issue with not having names in the debugger. I looked into the specs needed. In the end I used porth (yes porth!!) to read the custom debug file fasm to create some more asm (and maybe C?) files so that the debugger knew the names!

  • @andy_lamax
    @andy_lamax Год назад +8

    I just had a crash course on syscals and I am mad how I understood them in under 12 mins

  • @gempf
    @gempf 27 дней назад

    estamos viendo a un programador de la puta madre con excelentes formas de comunicar, te amo!!

  • @tomaspecl1082
    @tomaspecl1082 Год назад +3

    This is cool. And btw I also had a similar idea before. Basically its not an assembler. Its all macros. Even the "instructions" are just macros. That way you should be able to use different instruction sets with it by only changing the definitions.

  • @orizach01
    @orizach01 Год назад +3

    this whole video reminded me of the time you did basically the same thing but in porth

    • @orizach01
      @orizach01 Год назад

      1:28:20 this made me smile

  • @ichigo_nyanko
    @ichigo_nyanko Год назад +1

    Hello, 'not a low level person', nice to meet you.

  • @wisnoskij
    @wisnoskij Год назад +1

    This language seems so cool.
    For me, It is weird thinking about code being OS dependent. The OS they built for example in in theory either be written in Windows fasm or Linux fasm or possibly even written in fasmOS fasm and only compile-able on itself a different kind of self hosting.

  • @tonym5857
    @tonym5857 Год назад

    Great video ... took my attention from the beginin..

  • @ukuluhamaa5908
    @ukuluhamaa5908 Год назад +3

    It does seem that fasm not being static is a debian thing, in the arch repos it's static.

  • @Tigregalis
    @Tigregalis Год назад +7

    since i am learning technology from tsoding, and tsoding is a meme lord, does that not mean i am learning technology from memes?

  • @ecosta
    @ecosta Год назад

    ASM is "hard" because people treat CS like the "how to draw an owl" joke: we have machine code, then we have assembly, then we have React. What is in-between? Who cares! I just LOVED the concept of "fasm" - I might try it sometime on my old asm repos.

  • @anon_y_mousse
    @anon_y_mousse Год назад +3

    This might be why I used nasm instead, but I've been trying to figure out if you can do variadic macros and none of the examples from the fasm website are working with fasm itself. So supposedly you can do variadic macros, but either the examples are out of date or my copy of fasm is. Maybe I'll write my own assembler so it's not annoying.

  • @Tepigers
    @Tepigers Год назад

    cant wait for the cobol web development video 🙏

  • @rationalityfirst
    @rationalityfirst Год назад +9

    On my Arch install fasm is static. I use Arch, btw.

    • @__christopher__
      @__christopher__ Год назад

      Your second sentence is redundant. Well, technically I guess you could have an Arch install without using it ...

    • @ce5983
      @ce5983 Год назад

      ​@@__christopher__bro was invoking the "arch, btw" meme so people wouldn't think he was just saying that to highlight his use of arch. I'm using Arch rn, btw

  • @ce5983
    @ce5983 Год назад +2

    fasm: I'm a bit of a webdev myself

  • @jamesnewman9547
    @jamesnewman9547 Год назад +1

    I also did a very similar thing back in the oughts by writing go functions that when called, looked like G-Code and output gcode to stdout. So then I have all the power of golang, but then my main was this go-gcode hybrid that output gcode when run. Yeah.

  • @huistelefoon5375
    @huistelefoon5375 Год назад +1

    Ah, so this is the Web Assembly my colleagues have been talking about..

  • @varshneydevansh
    @varshneydevansh Год назад

    I watched this stream and it was amazing 💪🏻

  • @f1refa11
    @f1refa11 Год назад

    это слишком офигенно

  • @rogo7330
    @rogo7330 Год назад +3

    IPX is dead. I remembering fixing aircrack-ng's driver for TP-Link USB WiFi dongle and it would not compile because there was some shit in code about IPX, and at the time IPX was already purged from Linux code base. I least I remember it when I was searching for it in git logs in kernel sources.

    • @rogo7330
      @rogo7330 Год назад

      words are hard bruh

  • @keremardicli4013
    @keremardicli4013 Год назад

    Visual studio is on the market since 97!

  • @freezingcicada6852
    @freezingcicada6852 Год назад +1

    1:56:29
    This whole bit has been my experience whenever I'm searching for answers/ examples and makes me question the legitimacy of "I just google the answers, bro" memes.

  • @Leo-vs3xq
    @Leo-vs3xq 2 месяца назад

    i love your videos

  • @rationalityfirst
    @rationalityfirst Год назад +2

    Gdb has a command that starts and automatically stops at the entry, it's 'starti'.

  • @StevenMartinGuitar
    @StevenMartinGuitar Год назад +2

    Next up, "Implementing our own C in fasm" 😅

  • @billwall267
    @billwall267 Год назад +1

    Tremendous. Please do more fasm vids.

  • @KitsuneAlex
    @KitsuneAlex Год назад

    Does bind really determine the type based on the size? Looks more like a validation thing to me, the actual type is probably deduced using a union-type approach where they check the address family, since that's always the first field of the struct. At least that's what i'd expect. Good video :3

  • @dennis-heinrich
    @dennis-heinrich Год назад

    First of all: A really great video! I learned a few basics about fasm.
    But one more thing: What desktop environment is here in use? I never had seen something like this before. But i like it :)

  • @rationalityfirst
    @rationalityfirst Год назад +2

    1:45:00 it didn't work because you switched the operators for computing size.

  • @flamendless
    @flamendless Год назад +2

    I think I'll prefer to code in fasm over cpp

  • @lnlnxlnx3685
    @lnlnxlnx3685 Год назад +3

    Very interesting

  • @ayoubbelatrous9914
    @ayoubbelatrous9914 Год назад +3

    in my opinion fasm competes with food

  • @alexandrohdez3982
    @alexandrohdez3982 Год назад

    Great 👏👏👏

  • @ChaoticNeutral6
    @ChaoticNeutral6 Год назад +1

    Huh, when I use fasm locally the output elf files are executable by default. Weird

  • @Cosmos-g2n
    @Cosmos-g2n Год назад +1

    Are you john_found who wrote article on habr about this?

  • @p2k7777
    @p2k7777 Год назад +1

    26:31 writing a simple TCP server in fasm

  • @uuu12343
    @uuu12343 Год назад +1

    1:08:57 This is the art of grepping

  • @fareltek4111
    @fareltek4111 Год назад +1

    Hi.Can you implement Eventbus Publish/Subscribe system in c please.Thank you for videos

  • @farpurple
    @farpurple Год назад

    Why do i need stdlib if syscall(1, 1, "Hello world", 14) ?

  • @7KeHek
    @7KeHek Год назад

    There was int 80h for syscalls in 32bit Linux.

  • @curoviyxru
    @curoviyxru Год назад +4

    why I have read the title as dev in webassembly...

    • @TsodingDaily
      @TsodingDaily  Год назад +2

      I changed the title. Hopefully it's easier to read now.

    • @PopescuAlexandruCristian
      @PopescuAlexandruCristian Год назад +2

      From what I remember fasm has wasm as a target so future stream where the response payload is fasm compiled to wasm from fasm is the next logical step :)

    • @Rakkoonn
      @Rakkoonn Год назад +2

      ​@@PopescuAlexandruCristian So you could have a fullstack framework in assemby. Finally gone full circle from javascript.

  • @alicewyan
    @alicewyan Год назад +1

    What is the pretty font in your emacs?

  • @cobbcoding
    @cobbcoding Год назад +2

    Chromium syscall table 🗿

  • @user-plgmgrs326
    @user-plgmgrs326 Год назад +1

    Try nasm assembly too please 🙏

  • @andy_lamax
    @andy_lamax Год назад +1

    tsoding after explaining something for like 10 mins. Then says "I don't fully understand it"

  • @yaksher
    @yaksher Год назад

    Only like an hour in, but it kinda feels like using an assembler with such powerful macros ends up sorta defeating the point, because if you're generating the bulk of your code through macros like this... well, it's basically serving as a compiler that does no optimization. You lose out on the ability to skip unnecessary operations and very tightly pack things and whatever.
    At that point it's just like... why not write C?

    • @TsodingDaily
      @TsodingDaily  Год назад

      twitter.com/tsoding/status/1704206555594264984

    • @yaksher
      @yaksher Год назад

      @@TsodingDaily I don't think it's cheating, and I think it's a very neat. Obviously the objective of this video was not to create the best or easiest website and it's not a criticism of the video.
      I'm just wondering if assembly with this many macros serves any practical purpose or if using so many macros ends up defeating what limited practical function assembly still has with compilers as smart as they are.

    • @TsodingDaily
      @TsodingDaily  Год назад

      > I'm just wondering if assembly with this many macros serves any practical purpose
      urmom said it does

    • @Winnetou17
      @Winnetou17 Год назад

      @@yaksher Whenever you want/need to optimize or do crazy stuff, you can simply not use macros or whatever.

    • @yaksher
      @yaksher Год назад

      @@Winnetou17 Okay but by that token, you may as well just write C and inline assembly the parts you need to super-duper optimize. Optimizing or doing crazy stuff is the only practical purpose assembly really _has._ Outside that, it's just a fun gimmick.
      Or perhaps I'm missing something, which is what I was asking about.

  • @FireDragon91245
    @FireDragon91245 Год назад

    lol it reminds my of my own assembly transpiler it also has compile time generatoed code
    but mine does not have compiler directives like %for or something you can write you own compile time generators in the language itself

  • @kgarrison343
    @kgarrison343 Год назад

    How long until you're writing your own os in fasm?

  • @samnit.
    @samnit. Год назад

    I need programming classes from you

  • @konkitoman
    @konkitoman Год назад

    Why in ASM takes 30-50ms to load, from binary content and in Rust (tokio + axum + tower-http) loading a file then presenting takes only 1-2ms to load
    Why ASM binary that is 1KB is slower then 60MB Rust binary
    Please explain why is that slow and how you can make-it faster!

    • @Joorin4711
      @Joorin4711 Год назад

      @@aqfj5zy There is no compiler involved when generating the *binary* that is serving the data to the browser in the video. I know that tsoding says "And it compiles!" but that is not actually what is happening. The time it takes from the browser making its request to the page being counted as loaded is pretty much bounded by the browser in this case.

    • @Stroopwafe1
      @Stroopwafe1 Год назад +3

      Because Tsoding didn't include any of the optimisations you can do to make it serve responses as quickly as possible. You're comparing the most basic webserver to a well developed framework. Also, webservers aren't CPU bound, IO is the thing that takes the most time. If webservers were CPU bound, then this most basic example would outspeed every framework

    • @TsodingDaily
      @TsodingDaily  Год назад +7

      Because I forgot to close the connection

    • @konkitoman
      @konkitoman Год назад +2

      Now i realizate that you need to flush or close the connection!

  • @juniordataengineer
    @juniordataengineer Год назад

    And what is this guys real name . He is soo good

  • @rev_krakken70
    @rev_krakken70 10 месяцев назад

    Can you share with me the discord link?

  • @SolathPrime
    @SolathPrime Год назад +1

    This evil :fear:

  • @cj1296
    @cj1296 Год назад +2

    Couldn't he use coogle?

    • @cj1296
      @cj1296 Год назад +1

      Damn, I had been programming all morning. I forgot how to English.
      Couldn't he have used coogle?*

    • @Winnetou17
      @Winnetou17 Год назад

      @@cj1296 It happens to the best of us. But... wouldn't it be better to simply edit the post ?

  • @paulzupan3732
    @paulzupan3732 Год назад

    Do you use evil mode

  • @Phoenix4_Trade
    @Phoenix4_Trade Год назад +1

    bro i will make celebrate if you respond i want your opinion about problem solving website

  • @AlexHagdahl
    @AlexHagdahl Год назад

    Is the source code for this on github?

  • @sams6889
    @sams6889 Год назад

    Just following along for fun, my gf2 does not show the instructions after i try `run` even though the program runs fine (at 47:00)... anyone know why?
    Btw thanks for this great video. +1 sub

  • @konstantinrebrov675
    @konstantinrebrov675 Год назад

    What kind of assembly language is this?

    • @ango_coding
      @ango_coding 9 месяцев назад

      Its fasm assembler

  • @IamRavara
    @IamRavara Год назад

    my man wrote his owns language, applications using that language, is doing a video about web development with assembly and says "I'm not a low level person"

  • @Scouarn
    @Scouarn Год назад +2

    So Fasm is Forth with a slightly more advanced parser.

  • @TheSpec90
    @TheSpec90 Месяц назад

    25:35 🐰

  • @warnaoh
    @warnaoh Год назад

    How does he get this gdb "gui" ?

    • @huistelefoon5375
      @huistelefoon5375 Год назад +1

      it's a built-in feature of gdb, you can do this with `tui enable` as he did in the video