WHY IS THE HEAP SO SLOW?

  Рет қаралды 271,608

Core Dumped

Core Dumped

Күн бұрын

Пікірлер: 746
@ThePrimeTimeagen
@ThePrimeTimeagen 8 ай бұрын
This was so good i would just like to say. And my great great great grandson, William, is very primed and ready to tell you about u8 and their downfall
@theblackquill5921
@theblackquill5921 8 ай бұрын
isn't the name of your great great great grandson the GreatGreatGreatGreatGrandsonagen? cause otherwise that would be stupid
@eugenemark836
@eugenemark836 7 ай бұрын
lol
@eugenemark836
@eugenemark836 7 ай бұрын
@@theblackquill5921 XD
@Visitor______________________v
@Visitor______________________v 4 ай бұрын
Prime you still yet to add me on LinkedIn
@gillall4828
@gillall4828 2 ай бұрын
First man to choose the name of your great great great grandson. lol
@chicoern
@chicoern 8 ай бұрын
Absolutely great video. You managed to cover almost everything and keep it simple. There's only one huge problem. I'm 257 years old and that invalidates everything.
@p0t4toePotato
@p0t4toePotato 8 ай бұрын
congratulations on being 1 year old again
@electrolyteorb
@electrolyteorb 7 ай бұрын
​@@p0t4toePotatofloating point baby
@moussaadem7933
@moussaadem7933 7 ай бұрын
​@electrolyteorb integer overflow*
@electrolyteorb
@electrolyteorb 7 ай бұрын
@@moussaadem7933 I know it's two complement... Was just giving alternative
@MrSonny6155
@MrSonny6155 8 ай бұрын
That "as an AI model" jab with the voice was hilarious. This was a great refresher since I could hardly remember anything from my own operating systems unit.
@fergalhennessy775
@fergalhennessy775 Ай бұрын
its not a joke 🤖🤖
@TheSast
@TheSast 9 ай бұрын
I think they were just mad that vampires ages would be excluded by that u8
@anlumo1
@anlumo1 9 ай бұрын
Also Tolkien's elves! Won't somebody think of the elves?
@jongeduard
@jongeduard 8 ай бұрын
Actually future cyborgs and androids have a good chance too. Not sure if they'll still code in Rust then, but what I am sure about is that software can be updated. So any robot in the future is probably able to post a feature request. 😂
@austin-ee4tp
@austin-ee4tp 3 ай бұрын
also the people before the flood im sure aren't happy Methuselah i bet is rolling in his grave
@isuckatthisgame
@isuckatthisgame 9 ай бұрын
This guy is one of the better discoveries I've made on KZbin in quite some time. This is helping me pass my Operating Systems exam. Btw, books referenced couple of times in your videos are the same ones I'm currently learning from. Great minds think alike. 👍
@ProgrammingRainbow
@ProgrammingRainbow 9 ай бұрын
This is not a human. So this guy is this ai model
@d1ma894
@d1ma894 9 ай бұрын
the voice is, but someone has to write the content@@ProgrammingRainbow
@ProgrammingRainbow
@ProgrammingRainbow 9 ай бұрын
@@d1ma894 I'm not so sure about that one after listening to it.
@leandrocasas90
@leandrocasas90 9 ай бұрын
same !
@tyronefrielinghaus3467
@tyronefrielinghaus3467 9 ай бұрын
Generally, I actually prefer an AI voice like this - very easy to listen to. CAn;t STND HAVEING TO INTERPRET SOME GUY WITH ..SAY , , an Indian accent!
@JinTheAceStar
@JinTheAceStar 9 ай бұрын
according to that commentor we cannot write any program because the parameters of our living world may change any second...
@CoreDumpped
@CoreDumpped 9 ай бұрын
What's even funnier to me, is the fact that he was also talking about padding, which in some way contradicts his own "u8 will overflow" complain.
@matthias916
@matthias916 9 ай бұрын
@@CoreDumpped well no, while i dont entirely agree with the commenter, his comment about padding is right, the u8 could be padded when used in a structure but when incremented above 255 it'll still wrap around. padding just exists to align structures and help the cpu cache
@half-qilin
@half-qilin 9 ай бұрын
Tbh I still try to an uint16_t (C++ equivalent to u16 if I’m reading the syntax right) when possible, because I tend to bunch data together in ways where the data savings are noticeable (and I often have two 16-bit values next to each other which won’t get padded). Admittedly using a uint8_t/u8 is kinda stupid for age since a troll could very easily set their age to be 300 or something, but with a 16-bit integer you could validate to 3 base 10 digits and call it a day. Only case where I’ll use a large number of 8-bit values is a string of ascii characters, otherwise your do create potential overflow issues and the data savings typically aren’t worth it (whereas you typically won’t overflow a 16-bit value with normal-ish arrays)
@AlexSmith-jj9ul
@AlexSmith-jj9ul 9 ай бұрын
@@CoreDumppedI don’t know what that commentor was smoking but there is an actual reason to avoid using small ints. I don’t know if this is an issue with rust but with c small ints are able to be promoted which can cause errors that are very difficult to debug.
@DS-rd8ud
@DS-rd8ud 9 ай бұрын
According to them, we're already at fault for using any fixed size memory medium, because in the future, our software won't cover the case where a person/entity will leave for eons, way above our limited understanding of how long a thing can exist in the Universe.
@AntonioZL
@AntonioZL 9 ай бұрын
I'm a self taught developer, so your videos fill many gaps in my knowledge of architecture. Keep doing them! You're a gem on youtube!
@yipyipisyip7197
@yipyipisyip7197 9 ай бұрын
Excellent video. By far the most educated explanation to stack vs heap without digging unnecessarily deep to lose the point. I love the part you reiterate what “heap is slow” actually means “heap allocation is slow”. Would love to see a follow up video on how to access heap fast by leveraging cache-line alignment, packed data structure etc. from day to day i got worried about accessing the heap memory in hot path, even it is a pre-allcoated once vector to be reused for each loop - i can’t reason about for every loop whether or not pre-allocating a dynamic size vector on the heap (and perform a clear upon each loop) or use a large enough fix sized array so it’s on the stack always (although potentially waste of memory coz you can only expect the worst case size of an array at compile time) Looking forward to the next video. Greatly appreciated
@saule8860
@saule8860 2 ай бұрын
Most of malloc() implementation already have alignment management to have better cache hit You don't need to do anything
@askmiller
@askmiller Ай бұрын
Only a very small set of specialized people need to ever concern themselves with the difference between the heap and stack. Of that set, only an even smaller subset need to concern themselves with performance. For most people, this is all abstracted away. For the ones who it isn't abstracted away for, the compiler will often handle the optimization well enough that the spaghetti code isn't worth it. For the .01% of people who need to optimize their heap calls better than what the compiler can do who don't already know how the heap works, this is very helpful.
@blackbriarmead1966
@blackbriarmead1966 9 ай бұрын
After I wrote a compiler, I realized that a lot of the power comes from the fact that you can use relative references from the knowledge you have about the stack at compile time, which makes it so powerful. There is no lookup, it just knows the address of the variable you are trying to access. This was after optimizations, at the layer of code generation.
@Darkev77
@Darkev77 9 ай бұрын
F I N A L L Y! Someone that doesn't go high-level but rather goes in depth to provide low-level content that is presented very elegantly!!! SUBBED
@NeetCodeIO
@NeetCodeIO 8 ай бұрын
My new favorite YT channel. So amazing, cant wait to see more
@iyar220
@iyar220 6 ай бұрын
I also love your videos man :)
@RaphaelOkai
@RaphaelOkai 3 ай бұрын
My two favorite people. I learnt so much from you guys.
@MohitDharmadhikari
@MohitDharmadhikari 8 ай бұрын
Excellent explanation of complex concepts! I wish if you can cover Booting, BIOS and UEFI in detail along with MBR and GPT partition internals. Namespaces, CGroups and File systems deep dive
@anshumansingh2156
@anshumansingh2156 Күн бұрын
Yes, please. Even I am looking forward to these topics.
@mike200017
@mike200017 8 ай бұрын
Great video! Good explanations at a nice intermediate level! I can see a couple of things to add for a bit more depth. First, the performance problem with allocating memory on the heap is a good example of where it's more about the variance (or unpredictability) than the typical case. For most reasonable heap implementations and kernel page allocators, allocations will be really fast, but a small number of times, it's going to be really slow, and that can have significant impact on "quality of service". Second, in that vein too, I would say the overhead of requesting memory from the OS / kernel isn't really the context switch. That's pretty negligible compared to page allocation. What's really bad is the kernel lock. The point is that the kernel has to deal with multiple processes requesting memory at the same time, and so, it has to have a global lock to synchronize those allocations between processes. Clever things can be done to avoid hitting that lock too much, but it still has to be there and you will inevitably hit it. This is one of the few places where multiple processes on a system directly interfere with one another (beyond just generally sharing limited CPU/Mem resources). And kernel locks can be a big deal, I've seen wait times in the order of a few seconds when hitting a kernel lock, which can be a major disruption in the middle of an operation you expect will only take a few milliseconds.
@CoreDumpped
@CoreDumpped 8 ай бұрын
New best comment so far. This is where my channel is heading right now. Dude basically summarized my following 10 videos.
@sriramarajuchintalapati1304
@sriramarajuchintalapati1304 8 ай бұрын
@@CoreDumpped your videos are next level, i liked the way of explaintion and presentation
@Byynx
@Byynx 8 ай бұрын
@@CoreDumppedYou will be providing a huge service for us. This video thoughted more about these several different topics than months of watching videos or reading articles about the same thing.
@michaelutech4786
@michaelutech4786 8 ай бұрын
I don't know about the reality of kernel locks related to memory allocation, I never knowingly experienced one in 30+ years. But I also don't really see the necessity. The kernel knows and controls which processes are running in parallel at any moment in time, at most one per CPU core. All that would be needed to avoid contention is to assign a pool of pre-allocated memory pages to each CPU, that only this CPU (and whatever process is running on it right now) can use. The assignment can be stateless (f.e. using a hash code of page addresses). I would be surprised if something like this is not already implemented in Linux kernels in one way or another. Also, once a process requests memory, it's no longer running (bec. of system call). It's of course wrong to think of "the kernel" as if it was a single threaded thing. Multiple parallel alloc system calls running on different CPUs can well be contending. But such concurrency issues are the bread and butter of kernel land. I don't think that anything people like us can do in user space will be more efficient than battle tested algorithms running in the kernel written by people spending every working day on such topics for years.
@michaelutech4786
@michaelutech4786 8 ай бұрын
Also: how can a kernel lock possibly result in wait times in the order of seconds? This sounds like the kernel was waiting for a process to finish playing air on a g-string. Or less offensively, doesn't that smell of things like dead-locks?
@minoubrc4773
@minoubrc4773 9 ай бұрын
Heap and stack management are two of the most fundamental topics in programming languages, and understanding them can spare a lot of headaches so you can secure and debug your program easily. Thank you for your videos. Keep it up.
@OneMilian
@OneMilian 9 ай бұрын
I can not agree more. I took the last 2 months just learning stack and heap and i got so much better in debugging programms with dynamic memory systems. I also got very good with linked lists, trees, and recursion. I learned so much more in such a small timeframe that i can safely say this is really fundamental in growing as a low to mid level programmer.
@OneMilian
@OneMilian 9 ай бұрын
I can also really really recommend working with a debugger and doing objectdumps and hexdumps or hexediting for learning.
@samuraijosh1595
@samuraijosh1595 9 ай бұрын
​@@OneMilian if you want to understand linked lists, recursion and trees conceptually you cannot do so by understanding the low level stack or heap lol.
@OneMilian
@OneMilian 9 ай бұрын
@@samuraijosh1595 of course you can, look: If you understand the heap you can already think what happens with a linked list, when memory for a new Node gets allocated on the heap, like in this video. If you wouldn't then youtuber core dumped would not implement data structures in this video about the heap. Recursion is one possibility to move between the nodes. If you know the heap, you can definetly see and think what he does.
@rty1955
@rty1955 9 ай бұрын
Thank god I do t have to deal with stacks at all! I program in assembly on a mainframe where stacks dont exist
@TheDragon3091
@TheDragon3091 9 ай бұрын
Such an informative video, the visualization and commentary deserves a lot of credit. I enjoyed it thoroughly!
@mattshnoop
@mattshnoop 9 ай бұрын
This video is EXCELLENT! Like you said at the start, there's some simplifications-but it's totally accurate and very comprehensive. I'm one of those "more experienced people" you mentioned at the start (at the end of an extended 6-year undergrad in compsci), and I'm impressed by how much info has been crammed in here. I'm about to start a master's degree with a focus on pedagogy (the study of teaching), so you can imagine I spend a lot of time explaining these topics to my juniors. I think you've found an excellent level to simplify things to for someone who may be new to this sort of thing. Good examples always help, and you transition to them well and the "story" of the video flows well. Great work on this video. I'm going to go and watch the first video on the stack, too. Even if I've thought about this stuff a ton over the years, this was a great refresher on a few of the concepts I've gotten rusty on (pun not intended) or even completely forgotten about. Looking forward to the next video!! 😄
@theforeskinsnatcher373
@theforeskinsnatcher373 9 ай бұрын
6 year undergrad??
@kotfare1698
@kotfare1698 9 ай бұрын
6 years of undergrad lol wtf? 3 years of normal undergrad is more than enough. Most people could’ve gotten a masters + honours year in the time you spent dicking around
@pvt_weed
@pvt_weed 9 ай бұрын
@@kotfare1698 People have lives that can get in the way, such as having kids, having to work to survive, thus making it take longer to get a degree. Most people often quit as well. I'm happy mattshnoop kept going.
@gabrielbonfim1
@gabrielbonfim1 Ай бұрын
I rarely comment youtube videos. But this one I needed to. Man, your video is amazing! I've never seen someone explain stuff so clearly as you! Please keep up with the videos. I'm about to binge-watch your entire channel. Thank you very much!
@sprytnychomik
@sprytnychomik 9 ай бұрын
There's one more thing that can make stack faster. Instructions may use immediate addressing relative to the stack pointer. Accessing data on the heap requires loading its address to a register first (not on all architectures), which not only is an extra instruction but additionally makes that register unavailable for anything else.
@mariuslatinis6262
@mariuslatinis6262 8 ай бұрын
One more thing: there are architectures for some embedded devices, where the RAM for stack is just faster to access than the RAM for heap. Basically, those devices have two different types of RAM. For such architectures, accessing array[3] will be faster, if the array is stored on the stack, than on the heap.
@RockTo11
@RockTo11 2 ай бұрын
...but once you have that address in that register, if you've designed the program well, you'll have a nice amount of cache-friendly data to iterate through, avoiding many cache misses.
@RockTo11
@RockTo11 2 ай бұрын
...and if you've designed the data really well, you can also avoid many of the headaches with multi-threading, including performance hits which evict data in registers and L1 out to the slower shared L2 or L3 caches (i.e. false sharing).
@Kuber-n8b
@Kuber-n8b 9 ай бұрын
I feel extremely lucky to have found this video. Very informative. Please continue on making more of these ones.
@hanzofuma
@hanzofuma 8 ай бұрын
You know in the past two months I spent weeks reading and searching on these low level concepts (explained in details more or less) after losing hope on KZbin. Thankfully there is someone today 😇
@Rawbful
@Rawbful 8 ай бұрын
An amazing explanation for someone who has experience programming but not in a language or context where I ever have had to think about or learn this stuff. Thanks!
@charles-y2z6c
@charles-y2z6c 8 ай бұрын
Thank you, I am a C progammer from the 90's and have a project I need to get back into. All the bits came back in my head on Heap and Stack
@kraller7
@kraller7 9 ай бұрын
Men I've watched all your videos and I have to say it: impresive. Very well explained (even with the simplification which is 100% necessary). Keep it up, nice work :)
@isuckatthisgame
@isuckatthisgame 9 ай бұрын
1:15 hahahaha youtube channel named "ThePrimePrimePrimePrimePrimeagen"
@jorgevillalta8487
@jorgevillalta8487 9 ай бұрын
Feb 12, 2245 😂
@nXqd
@nXqd 6 ай бұрын
As a senior engineer, this is an important lesson to learn for junior. Heap is fast and can be fast, it's all about how you design your data structure. For example with linked list, one can implemented with contiguous vector as storage ( you must manage the free slot a bit ), and it can be really fast.
@widrolo
@widrolo 9 ай бұрын
0:55 bro got publicly humiliated💀
@IsmeGenius
@IsmeGenius 8 ай бұрын
Yeah, starting the video with humiliating yourself is not a good look.
@Sergiuss555
@Sergiuss555 5 ай бұрын
damn i laughed so hard at that
@Cyclically
@Cyclically 21 күн бұрын
​@@IsmeGenius🤡
@tamaskosa4456
@tamaskosa4456 8 ай бұрын
Please keep these videos coming! I'm coming from Javascript with very limited insight into the amazing world of low-level programming. I'm currently learning C and your videos got me hooked!
@switchi8663
@switchi8663 8 ай бұрын
I've been getting a lot into memory management and i gotta say this is the best video ive found. You answered all my questions and just explained everything perfectly! Also the AI voice didn't bother me much after a few minutes. Thanks for sharing this and please continue to make more!
@Xarlyle0
@Xarlyle0 9 ай бұрын
I remember learning this in college. I can imagine college professors being so relieved that this video exists and is done so well!
@hydroxa4330
@hydroxa4330 9 ай бұрын
Tysm for making these. I've been learning Rust lately, and as part of that I've been trying to learn how to best use the low level features it provides. I've gotten the hang of references and am getting to grips with lifetimes, and learning about things like the heap and stack are helping a lot with learning what Rust is doing and what it's protecting me against when it's particularly strict in a region
@joeedh
@joeedh 9 ай бұрын
The explanation at the very end is much better than the entire video, except for GC which does not protect against leaks anywhere near as much as people like to believe; there is such a thing as reference leaks.
@jeffr_ac
@jeffr_ac 9 ай бұрын
Excellent!! I’ve never watched an in-depth well explained video about heap and stack like this one!
@fern8980
@fern8980 9 ай бұрын
Learning about memories made me look at programs a lot differently. Thank you good sir for making videos like this.
@Beastintheomlet
@Beastintheomlet 9 ай бұрын
I love the level of Reddit “well actually” from that comment, the part about ages going over 256 years being a Y2K bug waiting to happen is gold because you didn’t build your software to last. Glorious.
@Leonhart_93
@Leonhart_93 6 ай бұрын
The funny part about it is that it not only requires life extensions to get to that point, but it also requires living humans being at least 256y old, which won't happen for another 150y even if we had these advancements tomorrow 😂
@williamdrum9899
@williamdrum9899 4 ай бұрын
Especially since it ignores the true issue of stack alignment which means that in most cases the other 24 bits are used as padding anyway.
@monad_tcp
@monad_tcp 3 ай бұрын
@@Leonhart_93 funny that implies human consciousness can survive for that long, I remember my old grandma just tired of living and begging for the release, she lived to 96.
@Leonhart_93
@Leonhart_93 3 ай бұрын
@@monad_tcp Hard to say why is that, it's very likely that an aging body makes you tired of life. Especially the hormones would be very low. If she lived 96y in a younger body, would it be the same? I am guessing not.
@theblinkingbrownie4654
@theblinkingbrownie4654 3 ай бұрын
​@@monad_tcpgood thing people are working on healthspan and not just lifespan now, no way id want to live to a 100 if i was incapable of doing anything interesting
@huyhanguyen5789
@huyhanguyen5789 6 ай бұрын
Please make more videos, appercitate your hardwork, you explain in a simple way and easy to understand, thank you so much!!!!!
@thunder____
@thunder____ 9 ай бұрын
The comment put on blast in this video makes me think of something John Carmack said in his appearance on Lex Fridman's podcast; I'm definitely paraphrasing, but Carmack said something about how it can be useful to include limitations in your software that will notify you when things have changed greater than you ever thought they would. He was speaking in reference to limit-removing ports of the Doom engine, but I think it's pertinent here too. It's okay to write software that addresses your current needs and your current use case using the technology currently available, and sometimes that will force you back to the drawing board to some extent in the event that something related to your needs, use case, or technology changes, but that's not necessarily a bad thing even if it causes more work, because if something has changed that much, it's quite likely that other things have also changed such that other parts of your software need to be revised or at least reevaluated. So basically, what I'm saying is that the event of maximum human lifespan more than doubling from its current state would probably be part of much broader and more sweeping changes to the world that would call for a more holistic revision of your software. But because there does not seem to be any realistic probability in any remotely foreseeable future of a human being living to age 256, it is perfectly reasonable and sensible to represent human age with a u8.
@n.w.4940
@n.w.4940 9 ай бұрын
If comments like the comment in question become the rule rather than the exception, I really don't want to live to be 256 ...
@toms7114
@toms7114 8 ай бұрын
In modern architecture the difference in memory taken up by an u8 vs. a u64 is 0, and as such the program should have just used the u64. This is because it is faster to access based on memory width than to parse a memory address as finely as 8 bits. Yet the reasons for that comment was stupid as the longest I've ever heard of a program being used without semi-regular maintenance is 10 years.
@Artoooooor
@Artoooooor 22 күн бұрын
In current state of affairs even signed 8-bit value would suffice.
@Nikoline_The_Great
@Nikoline_The_Great 9 ай бұрын
Great. You covered the heap in a lovely and intuitive way. The only thing is that I would add would be alternative allocation techniques such as arena allocators their upsides and downsides.
@typewriteraudio
@typewriteraudio 9 ай бұрын
Please don’t ever stop making videos! These are awesome!
@binzeng9793
@binzeng9793 9 ай бұрын
Best video that connects everything from top level to bottom level.
@abdelmoneimelshafei6570
@abdelmoneimelshafei6570 9 ай бұрын
i knowing every thing you explained in this video but your way to explain things is incredible, thank you keep going
@fransnagel
@fransnagel 8 ай бұрын
Thanks for this trip down memory lane. About 20 years ago a big difference between C# or C++ became a 3 hour daily commute for the latter. The linked list option is easy to forget, useful in higher level languages too.
@Not_Even_Wrong
@Not_Even_Wrong 9 ай бұрын
Alone having it spelled out that the stack is allocated at program launch and that's why it's fast and small is so valuable. Not even to speak of the rest. Great videos, thank you!
@GrantGryczan
@GrantGryczan 9 ай бұрын
I have never seen this so well-explained. Excellent job! This series of videos will be my go-to resources for teaching others these low-level concepts.
@adamhenriksson6007
@adamhenriksson6007 9 ай бұрын
Love this video. Very informational. I would even consider videos like this as complementary to even the best CS course on OSs.
@guilec06
@guilec06 9 ай бұрын
You're one of the best out there for explaining weird prgramming concepts that are obscure for some of us, your videos are of very high quality and very well explained. I am really looking forwars that arraylist video tho, that tickled my curiosity.
@Dazed_04
@Dazed_04 9 ай бұрын
Videos like these are really helpful as they help visualise the key concepts we learn in computer science. Take data structures for example, I kind of knew why we use them but seeing an animation for it really helps clear things up. I hope we get a series about the different data structures and their needs too.
@llc1252
@llc1252 12 күн бұрын
Just watched like 7 of your videos and realized I didn't hit the like button. Def had to go back and like all of them: the channel is great. I'm learning C on my own and these videos are so useful!
@agun214
@agun214 7 ай бұрын
Thank you, what an instructive video! 18 minutes well spent. ive been foggy on this topic for years
@passionforsciencel5180
@passionforsciencel5180 9 ай бұрын
we appreciate your efforts , waiting for more in depth videos
@yotest3697
@yotest3697 Ай бұрын
The sacred cows always lambast people that want to explain things or show ideas in an simple way
@franciscomagalhaes7457
@franciscomagalhaes7457 9 ай бұрын
ooooohhhh, okay NOW I understand when something goes on the stack or the heap and why. I'd watched and read other resources explaining this, but never quite got it until your explanation here. Thank you! =)
@somcho
@somcho 8 ай бұрын
This and the previous video has illuminated so much for me .. I'd be really eager to see a video on "memory leaks" as a follow up to this.
@MegaLime0
@MegaLime0 8 ай бұрын
I cant believe that I can finally understand what the heap and the stack are! Im looking forward to more videos, especially the ones about gc and threads. (I dont usually comment but this channel is just something else. im also just doing my part to help algorithm lol)
@associatedixon
@associatedixon 8 ай бұрын
Thank you, Been trying to learn some of the low-level stuff on my own and this video is amazing. Can't wait to see the next one!
@SUNNofODIN
@SUNNofODIN 5 ай бұрын
Reading through OSTEP right now, about a third of the way in and LOVE already understanding some of this video.
@rotteneffekt4416
@rotteneffekt4416 7 ай бұрын
The trip! Thanks. I learned to really program in C using macos 7. A pointer to heap was called a handle, doing your own memory management... Seemed complicated at the time, seems easy today with a hundred million layers between your program and the hardware.
@DogeOfWar
@DogeOfWar 9 ай бұрын
I humbly request a video on a deep dive into the vector data structure (arraylist) because the level of detail combined with the way you explain things would be amazing.
@autonoob
@autonoob 7 ай бұрын
I’ve studied programming on and off in many forms for a long time. This is the first time I have seen an example of how a linked list interacts with memory fragmentation. The others all just explain the big O’s and that’s it. They don’t ever encourage thinking and reasoning about runtime. Good job! Thanks for this. Liked and subscribed! (I wonder if the algo triggers on exclamation marks, let’s try that !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
@GxAxL
@GxAxL 5 ай бұрын
The best explanation on KZbin! Keep up the good work :) can't wait for more videos!
@10dragon456
@10dragon456 9 ай бұрын
Amazing video! Just found the channel but you explained everything is a very digestible format that really helped me understand concepts that i was having trouble with.
@techvigator
@techvigator 8 ай бұрын
This is an extremely well explained video or at least one of the best introduction I've ever found. Please continue with same kind of format. I've just subscribed to your channel.
@benjaminmarcelocaballero1706
@benjaminmarcelocaballero1706 5 ай бұрын
This video changed my life. This is my favourite channel.
@xcoder1122
@xcoder1122 9 ай бұрын
There are basically two kind of programmers out there: Those who are very much afraid of using heap memory, as they are told that it is slow and leads to programming errors, so they avoid the heap at all costs, and those who don't care for either issue and just use the heap for everything without even thinking about it. Both don't do a good job. The heap is nothing to be afraid of and the heap is not a slow as many programmers fear when used correctly but using the heap for everything is not a good idea either, especially when it simply is not necessary. On the other hand, stack overuse is also dangerous as the stack is often way more limited in size than the heap (I saw many programs crash because recursive implementations that only used the stack) and stack errors are far more dangerous (there are way more security flaws based on stack errors than there are based on heap errors).
@wojciechmackowiak24
@wojciechmackowiak24 9 ай бұрын
I love your content dude, this is the 3blue1brown level of simplicity and clarity combined with helpful visuals. 10 / 10
@r00ty
@r00ty 7 ай бұрын
dude, I love you. This is the best explanation I've ever found so far
@by010
@by010 3 ай бұрын
Oh wow, I found this channel as refresher of things that I mostly know and for intresting stuff I never delved into (how dram functions was intresting) and having something to send to people who I think need to know this (usually dev juniors). Who would guess I find prime in comments for like 3rd video of chanel. Anyhow very good job with that stuff.
@IncertusetNescio
@IncertusetNescio 6 ай бұрын
Stuff like this is why programming is magic/wizardry to me. I understand the logical concepts, but wielding it is another thing entirely. I also see why (in part) programming is so difficult and error prone.
@wilcollins2185
@wilcollins2185 9 ай бұрын
feels like i'm back in systems class back in university .. great work!
@jongeduard
@jongeduard 8 ай бұрын
Really great video. Some notes from my side. The heap can actually be much slower than the stack, also by just accessing it. This is mostly the case in garbage collected languages, because the GC runs additional to the actual allocator and continuously tracks every object that you reference to in code. In C# for example, there is a measurable performance improvement by using more so called value types in code, which differ from reference types in that they do not come with allocations. They are a direct value as a whole, which has the implication of copy behaviour though when assigning them to new variables. What you mentioned at 7:52 is not so debatable, but I have seen slices in Rust being referred to as "thick pointers", which do store the size together with the actual address.
@attiladren6990
@attiladren6990 9 ай бұрын
Congratulations. Fantastic visualization. May I ask what software you used to make the video?
@snickersanyone
@snickersanyone 9 ай бұрын
That was such a good explanation, bless the YT algorithm for introducing me to your channel.
@mikefochtman7164
@mikefochtman7164 8 ай бұрын
Great discussion explaining heap without being solely dedicated to one architecture. You mentioned context switching, wouldn't mind seeing some more about that. How different OS's switch (and when) between programs is an interesting area that might be worth delving into as well.
@Taddy_Mason
@Taddy_Mason 9 ай бұрын
for people like me your channel is immensely helpful for example now I understand why we need data structures like linked lists. I hope you keep on producing awesome content. This is like Nand-to-Tetris but more visual. Thanks.
@desertumvir1755
@desertumvir1755 9 ай бұрын
One of the best channels at explaining low level concepts, i have just started with C recently in hope to learn about these things more and later on go to rust, and i must say you are really good (even as a LLM haha)
@momennasr1637
@momennasr1637 8 ай бұрын
Thank you so much for the effort you're putting in those videos ❤
@RayanMADAO
@RayanMADAO 8 ай бұрын
Can't wait for your future videos! I love learning low level concepts like this
@MOOBBreezy
@MOOBBreezy 9 ай бұрын
These videos are great! I dont even mind the AI voice all that much because the quality of the content in phenomenal! Keep it coming!
@amroalhendi273
@amroalhendi273 8 ай бұрын
This is the type of video I have been looking for, great work keep up the good work!
@mazdnd
@mazdnd 9 ай бұрын
Didnt really have time for this now, but this is so well made with so few subs that I just have to let the alog know this is great!
@sneaksneak6522
@sneaksneak6522 9 ай бұрын
Bro your videos are so cool and interesting. As a CS student this is so helpful to fill in the many gaps of understanding. Thank you
@CaptTerrific
@CaptTerrific 9 ай бұрын
I showered praise on you for the Stack video... and you've outdone yourself with this one! You could easily be a required supplemental instruction to CS50, and it would actually make the course clearer and more intuitive :) Can't wait to see these other teased videos, such as vectors and other data structures!!!
@michaeldeloatch7461
@michaeldeloatch7461 Ай бұрын
I heap praise on this video, and I swear it on a stack of Dennis Ritchie books.
@Techy504
@Techy504 9 ай бұрын
LMAOOO Primeagen is going get stoked when he hears about his great great great great grand son.
@LoboAgain
@LoboAgain 9 ай бұрын
Yooooo, this video and explanation are amazing, I have been having a vague concept of thes topics for a while now, but this really helped me grasp it much better. So thanks a ton for all the effort in the animation and script!
@scottfranco1962
@scottfranco1962 6 ай бұрын
Small nits (I like the video): 1. Heaps can be implemented by the program if the time to execute heap via system call is unacceptable. Typically this means fixing the size of the heap at compile time. 2. Stacks in modern operating systems like Linux are essentially unlimited in size. This is done by placing the stack above invalid pages in memory and only allocating the stack as it executes page faults.
@ryanwilliams5499
@ryanwilliams5499 9 ай бұрын
Thanks for this video, it was quality! Shared it with fellow boot.dev'ers who really haven't heard of the Stack/Heap. Also for me it was really nice to see the inner details of a sys call, because to my own demise, I knew there was more overhead from it, but never looked up what actually was happening. 10/10 vid!
@chyldstudios
@chyldstudios 8 ай бұрын
I would not worry about the comment section. Just make the videos you want to make.
@rukascool
@rukascool 8 ай бұрын
this pure black background was a treat on oled. Thanks
@G8KEEPER
@G8KEEPER 8 ай бұрын
Thank you for the video Sir, It was great ! Can't wait for another one.
@JordanPlayz158
@JordanPlayz158 7 ай бұрын
This video is also very good for explaining why things like Java have Xms and Xmx and why it is best to set Xms to Xmx (pre-allocating all ram you want to allow the program to use ahead of time) as syscall for allocating memory takes time/is expensive
@kikirac
@kikirac 7 ай бұрын
Love the videos! Very nice animations and beautifully explained. What tools are you using for video making?
@pranaypaul6361
@pranaypaul6361 3 ай бұрын
Sos o unique way to explain the core very core of everything no matter how advanced AI even become this will remain the very core. Kudos for such effort. Can I expect a data structure series from this unique visual perspective at least? Thank you.
@Luna0wl
@Luna0wl 2 күн бұрын
These vids are insanely good, you helped me a lot!
@electrolyteorb
@electrolyteorb 7 ай бұрын
For the amount of work put into these videos, you deserve more subs
@sonluuh
@sonluuh 8 ай бұрын
This video help me to review the OS / DSA lessons from Uni back then!
@pasinduvinsuka
@pasinduvinsuka 9 ай бұрын
well explained.. thank you so much... happy to see more content explaining underlying things like this ❤. soo happy about finding this channel
@MyTechieSide
@MyTechieSide 9 ай бұрын
I wait for your explanations bro keep uploading you are one of the best cs explaining guy I ever found😇
@williamchurch8401
@williamchurch8401 9 ай бұрын
I love your series! I’m looking forward to the next one! Thank you!
@sabriath
@sabriath Ай бұрын
if your list is adjustable, instead of doing 1 element at a time and causing cache misses and such, you can do X elements at a time (X determined by the type of list you are using). In the case of simple list, maybe 16 elements is sufficient.....but if you have a sorted, maybe a double-linked with mid-node traversal for log(n) search. If you track the pointers themselves, you can program your own GC to defrag the heap in the background. If you set it up to count refs and hits during the debug, you can set a prio value to the data to ensure that the heap is defragged with higher prio data together in order to avoid misses as well when you go to production.
WHY IS THE STACK SO FAST?
13:46
Core Dumped
Рет қаралды 173 М.
Stack vs Heap Memory in C++
19:31
The Cherno
Рет қаралды 579 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 86 МЛН
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
ARRAYLIST VS LINKEDLIST
21:20
Core Dumped
Рет қаралды 76 М.
Linux Kernel 6.12 | This is Historic
1:07:22
Maple Circuit
Рет қаралды 59 М.
Faster than Rust and C++: the PERFECT hash table
33:52
strager
Рет қаралды 607 М.
What is the Smallest Possible .EXE?
17:04
Inkbox
Рет қаралды 507 М.
But, what is Virtual Memory?
20:11
Tech With Nikola
Рет қаралды 309 М.
This is the code that sent Apollo 11 to the moon (and it’s awesome)
19:09
Factorio teaches you software engineering, seriously.
21:27
Tony Zhu
Рет қаралды 1,9 МЛН
Mastering Memory: Allocation Techniques in C, C++, and ARM Assembly
17:05
How the Clock Tells the CPU to "Move Forward"
14:22
Core Dumped
Рет қаралды 82 М.
«Осень». Самая большая загадка Windows XP
14:36
Девять десятых
Рет қаралды 1,3 МЛН
Лазерная замена стекла iPhone 14 plus
1:00
Mosdisplay
Рет қаралды 3,4 МЛН
Улучшил свой айфон!
0:17
По ту сторону Гугла
Рет қаралды 4,8 МЛН
90 FPS ЗА 30.000 РУБЛЕЙ
9:06
Игорь Линк
Рет қаралды 87 М.
with the power of denden it can turn into an iPhone #shorts
0:10