how does source become code?

  Рет қаралды 92,399

Low Level Learning

Low Level Learning

Күн бұрын

It's extremely easy to take the process of converting source code to machine code for granted. Every day, we write code, but do we understand how the code gets generated? How is the code stored? How does it get ran? By understanding the technical underpinning of these ideas, we can all become better developers.
In this video, I'd like to answer a few questions: how do bits become code? How do the thoughts that we have in our head manifest as source code? And how do we take that source code and convert it into a file format that the operating system executes? Finally, how does the operating system execute this file in a way that makes sense.
Check out Brilliant.org RIGHT NOW and get a free 30-day trial and 20% off your annual subscription when you sign up at www.brilliant.org/LowLevelLea...
🏫 COURSES 🏫 Learn to code in C at lowlevel.academy
📰 NEWSLETTER 📰 Sign up for our newsletter at mailchi.mp/lowlevel/the-low-down
How Does Return Work? • do you know how "retur...
🙌 SUPPORT THE CHANNEL 🙌 Become a Low Level Associate and support the channel at / lowlevellearning
🔥🔥🔥 SOCIALS 🔥🔥🔥
Low Level Merch!: lowlevel.store/
Follow me on Twitter: / lowleveltweets
Follow me on Twitch: / lowlevellearning
Join me on Discord!: / discord

Пікірлер: 133
@LowLevelLearning
@LowLevelLearning 10 ай бұрын
Don't forget to check out my limited time merch at lowlevel.store/
@me5ng3
@me5ng3 10 ай бұрын
As a compiler engineer I have a few problems with this video 😬 I do understand that it tries to be as simple and comprehensible as possible, but there are a few things I'd change, for example I'd remove the part where "instructions correspond to transistors" and maybe I'd rework on the AST part. Also, you could continue the video for an extra minute or two talking about how the kernel handles interrupts in programs, how it saves the state and loads it again at a later point, etc.
@0xhhhhff
@0xhhhhff 10 ай бұрын
Link some resources for the same please.
@sesu6743
@sesu6743 10 ай бұрын
@@0xhhhhff Whats google?
@0xhhhhff
@0xhhhhff 10 ай бұрын
@@sesu6743 your mom
@sesu6743
@sesu6743 10 ай бұрын
@@0xhhhhff Link some resources for the same please.
@0xhhhhff
@0xhhhhff 10 ай бұрын
@@sesu6743 can't. She left you when you were born
@richardericlope3341
@richardericlope3341 10 ай бұрын
Writing a programming language was one of the most fun projects I did(almost as fun as writing games in a handheld). Lots of rewrites and lots of grammar changes.
@DeanHorak
@DeanHorak 10 ай бұрын
You left out the step between compiler and executing- the linker step (not to be confused with the dynamic linker you did mention). The output of the compiler is in object format, with external references unresolved. The linker resolves those references and produces the execution (elf) file.
@hashimoto128
@hashimoto128 10 ай бұрын
Hey there, The example in @2:50 is technically not detected at lexer stage, it is at the parsing stage. The lexer, usually*, only tokenizes the source file (separates into tokens, shown around @3:13). So there should be an invalid token to cause an error there (I think '1x' is an example for the C language). The parsing stage "joins" the tokens to build a AST (Abstract Syntax Tree, mentioned around @3:15). The Grammar of the Language gives rules on how to build the AST. The grammar/parser says that "int x x;" doesn't make sense (that's my interpretation, hopefully accurate, on the meaning of "Syntax Error"). "Syntax Error" is closely related to parsing and AST. It was a nice overview on the steps from source code to running the program. *usually because sometimes people join the meaning of lexer and parser into "Lexing" or "Parsing"
@user-yv1qs7sy9d
@user-yv1qs7sy9d 10 ай бұрын
You are absolutely correct. At least on the compiler my team wrote that is exactly how it works, and to be fair, I don't think anyone would implement grammar into the lexer. In fact, if we consider the lexer to be a Finite Automaton (pretty sound assumption), the lexer cannot even comprehend the grammar.
@viddeshk8020
@viddeshk8020 10 ай бұрын
Are you working on any open-source?
@weiSane
@weiSane 10 ай бұрын
We wanna see you write some code exactly like NASA does . Following their blue prints and rules . That would be interesting. I loved that NASA code video
@stachowi
@stachowi 10 ай бұрын
This is the type of content i subscribed for! amazing
@CC-1.
@CC-1. 10 ай бұрын
It's fascinating I was just working on my own programming language
@jokasthejokas
@jokasthejokas 10 ай бұрын
1:50 "We can write the binary by hand, but no one in their right mind would do it" My uncle had to compile the assembly code he wrote, for his graduation, by hand, because the memory of the hardware he was working on was insufficient for the assembly compiler & the code (he was designing a printer software, and it was the 1970's / 1980's)
@user-il4ux8ml5p
@user-il4ux8ml5p 10 ай бұрын
how much did he get paid for the the job
@jordixboy
@jordixboy 10 ай бұрын
ive written binary code for some virtual machines. Its really not that hard
@jokasthejokas
@jokasthejokas 10 ай бұрын
@@jordixboy it's not that it was hard, but really time consuming, and he didn't had many resources to ease up the workload
@Sami_K99
@Sami_K99 10 ай бұрын
Please do a series on this, it's very interesting
@aravindhemachandran
@aravindhemachandran 10 ай бұрын
Really well explained the complete process! Thanks a ton for this video😊
@anon_y_mousse
@anon_y_mousse 10 ай бұрын
Next step, writing your own compiler. Would make for a fun video series. I'm writing one for my own language, and trust me, it is fun.
@blaze9872
@blaze9872 10 ай бұрын
Fantastic Video! Now I have to step through this process with my own programs!
@dakata2416
@dakata2416 10 ай бұрын
The best way to become a better software engineer is to try and write lexer, parser and interpreter/compiler. Great video ❤
@cheako91155
@cheako91155 10 ай бұрын
2:00 I know you were going for simplicity, but I don't think it's been true for a long time that x86 assembly code corresponds to transistors. My understanding is that there is a RISC interpreter translating the x86 code, part of the CPU firmware blob.
@chicoern
@chicoern 10 ай бұрын
And all of this is very similar in windows as well, of course the file is different, and there are extra steps between asking the OS for process creation, and the syscall. Very nice video! Thanks!
@sobanejaz
@sobanejaz 10 ай бұрын
2:02 got me laughing🤣😆
@piesek7489
@piesek7489 10 ай бұрын
sup! thanks for the vid, always get excited when new vid comes, god bless
@AceofSpades5757
@AceofSpades5757 9 ай бұрын
This was a fantastic and clear explanation. Thank you!
@orterves
@orterves 10 ай бұрын
The clock on the sponsor message is a nice touch
@GeekyMino
@GeekyMino 10 ай бұрын
It's amazing how good this video is!
@shneor.e
@shneor.e 10 ай бұрын
Dude please make a course on low level stuff (bits, bytes, byte-code, machine-code, interpreted langs vs compiled langs, etc.)
@jordixboy
@jordixboy 10 ай бұрын
as a self taught software engineer, I really love this topics!
@CallousCoder
@CallousCoder 10 ай бұрын
So the HVAC would shut off again when temperature is 70? I hope it can cool fast enough ;) I've never written a compiler, I wrote an interpreter and an assembler but that was enough of that. The latter was also more for myself because in college we had to do Z80 machine language. So we typed opcodes etc on a small uProfessor board, I have a video on the luxurious MFP-1. So I wrote an assembler to generate the opcodes and operands, just to speed up the assignment. So I could stream it from my tiny Atari Portfolio, the one John Conner used to hack the ATM, also wrote that in assembly and streamed it out of the serial interface using a MAX232 to convert RS232 to TTL level. That made it really easy for me to do that Spartan assignment. Even something as seemingly trivial as a washing machine that needs to control a motor, a pump, temperature (69F online ;) ) is a hassle in machine code. Yet trivial in assembly.
@modolief
@modolief 10 ай бұрын
Dynamic linking at runtime!
@simonegiuliani4913
@simonegiuliani4913 5 ай бұрын
Binary code represents assembler instructions. The CPU interprets assembler instructions and it's internally made of combinational circuits which are made out of transistors.
@QmVuamFtaW4
@QmVuamFtaW4 10 ай бұрын
This is amazing, no one could have explained this easier than you.
@damn_right_man8606
@damn_right_man8606 10 ай бұрын
Amazing. Keep on.
@LowLevelLearning
@LowLevelLearning 10 ай бұрын
We will!
@Timm2003
@Timm2003 10 ай бұрын
Wow, when i saw that the video was just 8mins i thought it couldnt get into that much detail without skipping stuff, but u smh made it! + its nice that things are explained on linux as example, i use debian btw
@LowLevelLearning
@LowLevelLearning 10 ай бұрын
Glad you enjoyed!
@doingwell5629
@doingwell5629 10 ай бұрын
7:56 dynamic linker is not coming with an executable, it's part of the os.
@Stoupy51
@Stoupy51 10 ай бұрын
Feedback : your videos audio are lower than other KZfaq videos, please increase it for the next ones!
@user-ts9ks8in2n
@user-ts9ks8in2n 10 ай бұрын
Simply awesome 🎉
@cristiconstantin452
@cristiconstantin452 10 ай бұрын
There's some misleading information: at 7:40 it's stated that "the kernel brings in a program called the dynamic linker that runs alongside your program when it starts". Later, at 7:56 it's stated that "... the dynamic linker that comes with your program ...". This is contradictory information and it's not clear whether the kernel or the program provide the "dynamic linker" part. Also, at 7:27 it's not clear what exactly the "loader for your program" means or does, as it is only mentioned and later discarded. It would be great if you can clarify these points but I like your channel anyway. Cheers!
@Gooberpatrol66
@Gooberpatrol66 10 ай бұрын
I can't answer your question because youtube thinks my comment contains a URL and deletes it. This is really an abysmal platform for educational discussion.
@BenEehayeh
@BenEehayeh 10 ай бұрын
How to extract the Abstract Syntax Tree and visualize it in Constellation or other data Viz app. With LLVM? How would the same program written in different languages appear in the Abstract Syntax Tree?
@user-uu5xf5xc2b
@user-uu5xf5xc2b 10 ай бұрын
thanks for making us better developers, sincerely
@MorningStarChrist
@MorningStarChrist 10 ай бұрын
I once contemplated building an object code keyboard
@arkadiusz6688
@arkadiusz6688 10 ай бұрын
I love love love your videos I just wonder where can I learn more about software development ad how?
@TechnicalHeavenSM
@TechnicalHeavenSM 10 ай бұрын
What a co incidence.. I was literally reading many articles about this same topic, then I got the notification😅😅
@paulmundt3990
@paulmundt3990 10 ай бұрын
While the compiler is free to choose between bss and data, your uninitalized_memory global will ordinarily be placed in bss and initalized to 0. Explicitly initializing to 0 could have the unintended consequence of shifting it to .data, but most compilers are smart enough to position it in .bss anyways. GCC at least has flags to control this, -fzero-initialized-in-bss/-fno-zero-initialized-in-bss, with the former being the default.
@KaidenBird
@KaidenBird 10 ай бұрын
You don’t want to upset people who write assembly, there’s at least 6 of us.
@nixlq
@nixlq 10 ай бұрын
More like that!
@durikke2
@durikke2 10 ай бұрын
What font is used in the "coming up" intro part?`
@kvelez
@kvelez 10 ай бұрын
Awesome.
@sim0ne_pl_
@sim0ne_pl_ 10 ай бұрын
Where to learn C? My hobby is programming and learning how computers works but I learned everything by my own and I started from high level languages like C#, python, js and idk where to learn C in most efficient way and understand things like handles, memory leaks, making code less vulnerable but without repeating everything like "This is variable. Variable is ... " over and over. And how is C compared to C++. Is It worth to learning C and then next C++ or just take everything at once ( Cherno has awesome tutorial about C++ but I decided to first learn C. Maybe I'm wrong ). I thought raw C is good starter for rust which is language i would like to learn in future. So finnaly, where to learn C for mid averange programmer ( mostly with high level languages ) and is It worth to learn C and C++ separatly or just learn C++ right away? Thanks for every help.
@pitpotputpet
@pitpotputpet 10 ай бұрын
Yep. This is what I'm here for
@elijahdecalmer613
@elijahdecalmer613 10 ай бұрын
I'm an undergrad, and I'm starting with a space company. One of the guys says the first thing he teaches people who are inexperienced is how a compiler works. He also says that one of the first things he asks experienced people is how a compiler works. Just my 2c. I'm on the learning end of this all
@jemo_hack
@jemo_hack 10 ай бұрын
Really cool, but you kind of left us half way there… there us a cool video that complements this from David Smith that might be work looking into, it’s a hand made executable (elf) hello world for Linux X856.
@mdski95
@mdski95 10 ай бұрын
2:24 👽 my respecc good sir
@mr.togrul--9383
@mr.togrul--9383 10 ай бұрын
I read the message of binary in @0:21, I got rick rolled, "Never gonna give you up Never gonna let you down". Nice one
@LowLevelLearning
@LowLevelLearning 10 ай бұрын
FIRST ONE TO NOTICE :D
@eliasgvinp2141
@eliasgvinp2141 10 ай бұрын
I am destroyed... I learned more during this 8 and a half minute vide than during a couple of semesters in my university
@saviofernandes5263
@saviofernandes5263 10 ай бұрын
At 0:35, why are there floppy disks on that programmer's desk?
@brady9737
@brady9737 10 ай бұрын
definitely not first
@vetuform5780
@vetuform5780 10 ай бұрын
correct
@mayank8387
@mayank8387 10 ай бұрын
But you're the first in my heart bro 😄🫶
@kermitdafrog8
@kermitdafrog8 10 ай бұрын
Definitely not last
@Proferk
@Proferk 10 ай бұрын
Good. Be happy that you are not racing with 10 year olds to click a notification in the nanosecond it appears.
@vetuform5780
@vetuform5780 10 ай бұрын
@@Proferk you are an absolute beast bro. neo of this world
@Trucho1996
@Trucho1996 6 ай бұрын
As a JavaScript developer i would like to write an operating system in JavaScript and the ui in react. Minimum memory required 64gb
@thingsiplay
@thingsiplay 10 ай бұрын
Thanks.
@johnmaguire3608
@johnmaguire3608 10 ай бұрын
I can't wait to get my elf parsed.
@Oldiesyoungies
@Oldiesyoungies 10 ай бұрын
yes
@whamer100
@whamer100 10 ай бұрын
lmao missing spotted at the beginning
@Murderbot2000
@Murderbot2000 10 ай бұрын
Compilers do kind of blow my mind. Is there a source (like a book, not a program) that would illustrate compiler design? I’m trained as an electrical engineer and am proficient in assembly. I only mention this as something to provide context, if anyone would answer this.
@Gooberpatrol66
@Gooberpatrol66 10 ай бұрын
Try "crafting interpreters"
@Murderbot2000
@Murderbot2000 10 ай бұрын
@@Gooberpatrol66 my guess would be that an interpreter would be a tougher job. I’ve been distracted from this , lately.
@ac3_train3r_blak34
@ac3_train3r_blak34 10 ай бұрын
You know you've made it when you got that Brilliant money 😂
@makee28
@makee28 10 ай бұрын
Hello man
@cloey_b
@cloey_b 10 ай бұрын
Man, I just found this channel and it's definitely sent by God, because I'M INTERESTED IN EVERY SINGLE VIDEO.❤
@LowLevelLearning
@LowLevelLearning 10 ай бұрын
Welcome aboard!
@otesunki
@otesunki 10 ай бұрын
its the magic smoke obviously
@user-td5gy2fh3p
@user-td5gy2fh3p 5 ай бұрын
what's that vim theme?
@tmahad5447
@tmahad5447 6 ай бұрын
4:21 Low Level Learing: Uninitialized memory. C: Initialized variable as {0, 0, 0, 0 .... 60 more zeros}
@KangJangkrik
@KangJangkrik 10 ай бұрын
Why we need loader for EACH segment? That doesn't make any sense
@williamdrum9899
@williamdrum9899 10 ай бұрын
So riddle me this: what makes compilers not AI? It seems like they basically write assembly code for you based on vague suggestions
@judgeomega
@judgeomega 10 ай бұрын
well one, who said they arent ai? and two, programming languages are hardly 'vague'
@OneMilian
@OneMilian 9 ай бұрын
Compilers don't learn and improve, like AI does
@esra_erimez
@esra_erimez 9 ай бұрын
Fun fact: The Intel iAPX 432 was a CPU designed to be programmed in high-level language
@maxmuster7003
@maxmuster7003 10 ай бұрын
I use the assembly programming language.
@itsKOTU
@itsKOTU 10 ай бұрын
Notification gang 😈💻💯
@echoptic775
@echoptic775 10 ай бұрын
We love casting spells😈
@argumentchannel
@argumentchannel 10 ай бұрын
Who is this guy @1:55 . i have alway wanted to try and program in binary
@ragnarock811
@ragnarock811 10 ай бұрын
Just a random guy on internet~
@capthehacker9985
@capthehacker9985 10 ай бұрын
I think that's Linus Torvalds. I'm not sure tho.
@ishaangupte3336
@ishaangupte3336 10 ай бұрын
@@capthehacker9985 yep its him -- creator of the linux kernel
@ragnarock811
@ragnarock811 10 ай бұрын
Lol it was meant a sarcasm
@PatrioticGestalt
@PatrioticGestalt 10 ай бұрын
Ok. Next topic. Your program in a microcontroller. Go.
@parallellinesmeetatinfinity
@parallellinesmeetatinfinity 10 ай бұрын
KZfaq recommended me while watching Javascript tutorial 🤡🤡
@MH_VOID
@MH_VOID 10 ай бұрын
it knows just how fed up you get with JS
@sreejishnair5922
@sreejishnair5922 9 ай бұрын
Hence proved we live in a matrix
@eineatombombe
@eineatombombe 10 ай бұрын
~11,000th 🎉
@superduper6090
@superduper6090 Ай бұрын
3:07
@speedTurtle
@speedTurtle 10 ай бұрын
These type videos attract the backseat driving "I would have done it this way" type guys like moths to a flame. Scrolling the comments just to see how many nitpickers who've never made their own compiler video tell this guy how to do his.
@fus3n
@fus3n 10 ай бұрын
bruh
@joshuavincent7884
@joshuavincent7884 10 ай бұрын
audio too low
@nicolaskeroack7860
@nicolaskeroack7860 9 ай бұрын
its kinda what chat gpt does *clickbait* title lol
@simonfarre4907
@simonfarre4907 9 ай бұрын
Also, It's not just the .text section that gets mapped in, into that program segment that you talked about, although you called it the ".text segment". Other executable sections also get mapped in there, like .init, .fini, and .plt - it's really arbitrary, but it is executable code that ends up in that segment (because it has the executable flag set 'X'). So you're confusing the .text *section* with "segment". A segment is a combination of multiple *sections*. So it's the "text section" that it's called, not the text segment.
@float_3.14
@float_3.14 10 ай бұрын
Ok.
@Ego--Sum
@Ego--Sum 10 ай бұрын
sound too quiet
@openwaysociety
@openwaysociety 8 ай бұрын
Doesn’t answer the question when everyone keeps personifying computers
@CC-1.
@CC-1. 10 ай бұрын
Second
@Officerballsmemechannel
@Officerballsmemechannel 10 ай бұрын
The audio sounds a bit off my man. It's very low level.
@LowLevelLearning
@LowLevelLearning 10 ай бұрын
Thanks for the heads up
@lambda256
@lambda256 10 ай бұрын
j
@Gh0_-st
@Gh0_-st 10 ай бұрын
i love pineapples on pizza
@SaudiHacker
@SaudiHacker 10 ай бұрын
There's a slapping sound in the background that's annoying and distracting
@GustavoPinho89
@GustavoPinho89 10 ай бұрын
Bro, this Brilliant blocky cody thingy is sooooo infantilising. Their other courses are amazing, though. But, again, if you're not using the keyboard, you're not programming
@fukmyass
@fukmyass 10 ай бұрын
Definitely not last
everything is open source if you can reverse engineer (try it RIGHT NOW!)
13:56
Low Level Learning
Рет қаралды 1,2 МЛН
how do hackers exploit buffers that are too small?
8:25
Low Level Learning
Рет қаралды 183 М.
SHE WANTED CHIPS, BUT SHE GOT CARROTS 🤣🥕
00:19
OKUNJATA
Рет қаралды 11 МЛН
where is the ball to play this?😳⚽
00:13
LOL
Рет қаралды 14 МЛН
Buy Feastables, Win Unlimited Money
00:51
MrBeast 2
Рет қаралды 101 МЛН
Каха с волосами
01:00
К-Media
Рет қаралды 6 МЛН
How do computers read code?
12:01
Frame of Essence
Рет қаралды 3 МЛН
How a Computer Works - from silicon to apps
42:32
Improbable Matter
Рет қаралды 1,2 МЛН
you need to stop using print debugging (do THIS instead)
7:07
Low Level Learning
Рет қаралды 399 М.
rust runs on EVERYTHING (no operating system, just Rust)
18:10
Low Level Learning
Рет қаралды 342 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,5 МЛН
computers suck at division (a painful discovery)
5:09
Low Level Learning
Рет қаралды 1,5 МЛН
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 1,9 МЛН
WHY IS THE HEAP SO SLOW?
17:53
Core Dumped
Рет қаралды 183 М.
every good programmer should know how to code this data structure (its easy)
21:08
A problem so hard even Google relies on Random Chance
12:06
Breaking Taps
Рет қаралды 1,1 МЛН
M4 iPad Pro Impressions: Well This is Awkward
12:51
Marques Brownlee
Рет қаралды 6 МЛН
IPad Pro fix screen
1:01
Tamar DB (mt)
Рет қаралды 3,3 МЛН
😱НОУТБУК СОСЕДКИ😱
0:30
OMG DEN
Рет қаралды 1,6 МЛН
Вы поможете украсть ваш iPhone
0:56
Romancev768
Рет қаралды 663 М.