Memory allocation functions like malloc and free manage memory through a multi-layered system where malloc calls operating system APIs to obtain memory, then subdivides it into usable blocks. Freeing memory twice causes undefined behavior because the memory manager may attempt to access already-freed memory, potentially crashing the application. The memory allocator always attempts to coalesce freed blocks to prevent fragmentation, regardless of available RAM. Windows handles are opaque references to memory locations that can be moved by the OS, preventing programs from relying on fixed addresses.
Approfondir
Prérequis
- Pas de données disponibles.
Prochaines étapes
- Pas de données disponibles.
Approfondir
Windows: What's Really Happening Under the Hood? | Shop Talk #82Ajouté :
Hey, I'm Dave. Welcome to Shop Talk, where we answer all the best user comments and questions from this week's episodes and any content we had going on this week. So, we'll jump right into the first topics, which I think are going to be Malik, Printf, and probably Bit Locker are going to be the big ones, but there are other stuff in there, too. So, stay tuned to find out what all we're going to talk about today. Glenn, what do you have for us to start with? We are going to start with a question from Alex Kelly Dave and he says uh at what point do you decide to write your own allocator or memory manager over just using Malo and free?
I would say almost never if you get the instinct think really hard about it but you might have a case where let's say as a really simple case you're writing a database and it's got to read in the records at the beginning and so you look and it says hey the records are a thousand bytes each and there's a thousand of them so you could allocate a thousand records of a thousand bytes or you could have a suballocator make your own little arena of one megabyte because you know in advance how much total memory is going to be used and every time you read a record just go bang bang bang bang here's a thousand bytes every time directly out of your pile that's really easy to manage because you know everything about how the records are going to get allocated and when they're going to be released and so on. So when you have a very specific memory situation that you think you can really optimize better than what the general mallet can do and you'd be surprised because they're pretty well optimized by this point but it's worth testing to see if that really is a bottleneck for you I would guess is the way to handle it.
Test it, time it, find out for sure.
Okay, that uh there's a couple of people made comments. I didn't they didn't make it into this round of questions, but um you mentioned uh you can put it into an arena, and a couple folks are saying, "Whoa, what's in the between an arena and a pool." So, I'm not sure if that's >> pool is very similar to an arena or the pool is probably all of the memory that is available in the various heaps. And an arena is one section of that memory set aside for private allocations. So, a good example of that would be the 1 megabyte pool that I set aside because I know I'm going to read 1,000 1K records.
>> And then that's going to be my arena.
And I'm going to arena. Hold on. Did we just >> It's arena cuz it's part of the pool.
>> Uh, right.
>> Arena is a part of the pool.
>> Gotcha.
>> And I'm sure I don't know if I'm, you know, 100% on this terminology or if it's used consistently throughout the industry, but >> in my usage, pool was the greater pool of memory. Heaps were the various heap piles of it in various places. And an arena was a section of a heap that you set aside in order to suballocate on your own.
>> Wow. That's why it's best just let Malik do it.
>> For the most part, yeah.
>> Yeah. Uh, brother Tyler says, uh, who is Malik and what gives him power over memories?
>> Uh, Malik comes from memory alec. Memory memory allocate. So that's where you get Malik as a term.
>> And other people were in there like, "What you mean it doesn't stand for magic allocation?" And yeah, magic sort of uh which I think is kind of funny too that a lot of those comments. So yeah, it's a >> mau from OC California.
>> Yeah, those two guys.
>> That's a reach. That's a stretch. But >> Alli Mciel Mali, I don't know. Anyways, isn't she isn't she's >> okay back to the question.
>> All I know too. That's everything I know about her.
>> Yeah. Yeah. Alex Setsu, uh, I always wondered why trying to free something twice was bad. I was thinking, well, if it's already free, trying to free it again does nothing, right? But he says, unlike other code where I can see the obvious bug with simple code when someone gives me the x86 assembly. So, I couldn't make heads or tails on a malo.
Yeah. So, if you do a malik and then you do the free, it's going to go through and mark that block as free. But then, let's say you call free again, it's got to go back and look. And there are two cases. one is it can recognize that this was a heap tag but it's since been freed so I'm just going to fail the double free or maybe it goes back in memory from a pointer that isn't really valid for free and then it crashes or it trashes memory or reads bad memory. So yeah, passing nonsense to free is a sure recipe for crashing. It won't bring the system down unless you're in a driver but it will bring your application down.
>> Uh in which case you might have to fire up task manager. So Rain bro says, "So does Task Manager use Malo to tell how much RAM is being used?"
>> No. So Malo actually winds up calling RTL something allocate heap and NTE heap and or NT I don't even remember the Nallocator stuff anymore but there's several layers and they would just call the base one in in the library and Malo is built on top of that. So there might be cases I can't say that task manager does not use malo because I'm using C++ but even my new operator I think goes to RTL something heap >> and then he goes on to say also let's say you have plenty of RAM does Malo care about fragmentation at that point or does it only worry about that when memory's low >> no it matters at all times it tries to keep the large largest blocks large so it's always trying to recoales blocks that get freed back into larger your blocks and manage it that way cuz it's not something you don't want to wait till the last minute to do.
>> And then I think in our last shop talk we talked about sort of why is Windows built like this? We got some Windows comm and sort of questions here. 3D Trucker says why doesn't Microsoft make a version of Windows that is not backwards compatible built on new code then keep a second version that has legacy code and device support like Windows XX Pro with legacy support. Home version has newer kernel code security.
Well, that would imply that doing so would produce a better system. And I'm not sure that it would. You might produce the same system faster, but it's not clear to me that backwards compatibility is what makes Windows fragile in any sense that it is or isn't. Um, it's more work for Microsoft to keep things working backwards compatible, but I don't think the user pays much of a tax on that one. I could let me know in the comments where the user gets burned by Microsoft being backwards compatible.
And I'd be curious to see what the situations are >> and the other thing is at what not just financial cost but what overall cost sort of hassle or administration or otherwise to have two separate operating systems one that are both similar but one's backwards compatible the other one isn't you're sort of then you're you're basically I mean they have multiple products right I mean they have different versions of operating system for different things but that seems I'm not sure what advantage that is to >> or help for Microsoft either. Yeah, I mean they could hypervisor it off and you could have old windows and new windows running side by side on the same machine and even do integration between them and all kinds of stuff. But again, why are you doing that? And what's better about the nonbackwards compatible part? Is it faster, better, stronger, more resilient? I'm not sure why it would be those things, but maybe it is.
So, so and Billy Guthrie then pipes up and says, "Uh, what do you say to users who also reply to every Windows issue by claiming installing Linux fish fixes that?" Well, sometimes it does. A lot of the time though, guy says, "I got a problem. I'm running Windows. I'm going to install Linux. Now I got two problems." And now you got a third problem, which is none of your apps work, right? And the popular apps you like to use don't work. And I use Linux all the time. I just don't try to run Photoshop on Linux. I do sort of Final Cut and Photoshop and stuff on a Mac and I do all my uh console programming on a Linux machine. So, depends what you're doing.
>> There you go. Ice cream stick model.
Regarding memory allocation, how does the Windows API efficiently manage ANC and Unicode versions of the same API method?
>> Ah, so what you'll do is say you have two functions. One's called function, the actual function just called function. Then you got function A which is the antsy version of it that takes eight bit strings and returns 8 bit strings. And you've got function W which is the wide version. And then there may be a function T which is mapped to either W or A depending on what your current environment is. So you can go back and forth. And so normally like a Windows 95 if you called into an A API with a Unicode string it would have to convert it to ANIE because the actual operating system only dealt with an MBCS and other things but not Unicode. And so on NT it was the other way around.
Everything was implemented internally in Unicode. So if you passed an ANIE string it had to be upconverted to Unicode, processed and downconverted and handed back. And I wrote a ton of those APIs to do that kind of thing.
>> Uh Mark Wel says you might have covered it before. He says, "But a deep dive into open fop uh with the append flag would be a value." Says, "Append mode comes with a kernel level guarantee that includes multi-thread and multiprocess function."
I didn't know it was thread safe. Uh yeah, it's pretty advanced topic. I guess maybe start with F open and then get to append as one of the more advanced topics within it. So yeah, I'll keep that in mind.
>> And other people are asking where do you have courses and stuff? So yeah, there's there is an audience for deep dives on little things, how much it appeals to the broader contest. Yeah, >> there's been some moderate response. So if you like those episodes, share them with a friend or something.
>> Yeah. John Wallace uh says, "Interesting. So you pronounce guid.
So how do you pronounce gui?" Gui instead of guey.
>> We say guided. Yeah, I do say guey and I do say guided, but I can't imagine saying giid, so that ain't going to happen.
>> Ranjen sing, incredible video. So all that logic is built into the binary of my program by my compiler.
>> Yeah. Or it's shared in a library that all the programs use on a on some systems, but otherwise, yeah, it's built right into your application if it's statically linked. And so he says and it's the compiler's malo logic or is this part of some standard library that gets linked in?
>> Yeah, it's a standard C library implements the new and so on. Now malo is going to be an operating system call but all the new operations and sometimes malo itself will be done by the compiler depends like if the operating system provides a malo that it can just pass through as an API it will likely do that but say you're on you know n and there is no malo in the operating system there's nallocate heap or something so you've got to go through and map those calls to the system heap allocator and so that's what malo is doing in those cases but it's a standard interface so if you call it on Mac or windows or Linux you know it's the same interface everywhere.
>> Okay. So, so then he says, "Yeah, if I have two different programs running, compiled by different compilers, possibly different languages, would their maloc be different?"
>> No, but they'd probably both exact same thing, getting a bigger block of memory from the operating system, and then subdividing it into little chunks for the program, each program that's using it.
>> Um, and now we get into some of this uh uh it looks like yellow key stuff here.
He says, "I'm super wrote.
I'm super confused on how this exactly works. How does the exploit make the TPM module release the decryption key without a valid password?"
I don't actually know, but I know that the system is able to in certain select cases, and it's like a back door, but it's an intentional backdoor to allow you to do it. so that if you don't set a TPM PIN code um for whatever reason, they allow the recovery path to get access to the drive and in an unc unencrypted state and this exploit leverages that. So if you have a PIN code, as far as I know, at that time at least, you were still safe. But >> yeah, he says that this says that um from what he can piece together, it feels more like a Buddha recovery environment escape rather than a Bit Locker defeat.
>> Well, it is, but it defeats Bit Locker.
So it's yeah it's an escape or an escalation of the recovery environment which is used to defeat Bit Locker by getting unencrypted access to it.
>> But in order to get access to it, you already have to have access to the PC in its decrypted state, right?
>> Nope.
>> No.
>> No. So I can come to your office which has a drive which is protected by Bit Locker. And if you guys have a PIN on it, you're fine. But if you don't, I can just boot that machine, stick my USB key in, and read your drive.
>> Hence it was a big deal.
>> Yeah. Ex not excellent. Yeah.
>> No. Especially on a laptop. Leave your laptop on the bus or on an airplane. You used to be like, "Well, get a new laptop and they can't get at my data." Well, now they can.
>> Uh, Mr. Dave Blue Flamco, I don't know of any applications where user data is being stored in the registry, but certainly config data is. I thought that's what Microsoft designed it for.
>> Well, yeah, but if you put depends what you define as user config data. If it's your thumbnail image, that's a pretty big piece of data. If it's 24bit, then it's 1K by 2K size. That's not what the registry was designed for in the day.
I'm not saying it can't handle it, but that kind of use of the registry saying, "Hey, that's user data. That's config data. It's just their preferences." And so I'm storing their preferences in the registry, and now I'm spewing video into it. Well, maybe not video, but I think that's where we run into problems. So, some stuff probably should be file-based for that kind of thing as opposed to a pure registry model. I think a hybrid model would probably be best. I haven't watched it yet, but uh I think Mark Rasanovich came out with a video this week on the registry and then what he would do if he were doing it today. He didn't do the original, but you know what would be the way to do it now that we know what we know. So that probably a good video to watch.
>> Uh Ligh, how can you trust a system when there is no need to input a password to decrypt the key? Blackbox TPM convenient? Yes. Safe? Hell no.
>> Exactly.
>> So back in the old days when I was on Windows using Veraracrypt or discryptor was the way to go.
>> Yeah, I used True Crypt a lot before that got deprecated or when they said we can no longer guarantee there's not a back door in here a couple years ago. I was using True Crypt all the time for that. And uh I certainly wouldn't want to use a product that had a default mode that could unencrypt my drive without a password. So now you can get around it by using a PIN, but I don't think everybody knew that. I didn't know that.
Uh, some more Windows stuff here. Bob Shuan says, "Hey Dave, I have a question. I get why the path link was limited in early Windows, but why does it persist to this day?" Says, "Even with turning on longer paths, copying files from say Linux servers, you can routinely end up not being able to get them into Windows folders because of path length limitations."
>> Well, there has to be some limit, and it's normally 260. And I think it's 260 anyway. And uh the problem is the shell is compiled with a a static variable pound defined max path 260.
>> And so they've probably changed that since then and now it may be dynamic or it might just be a larger constant if you turn on long paths. But um how long is long enough when programs have to allocate static buffers? Should it be 512 bytes, 1K, 2K, 4K, 8K? How big should these things be?
>> Well, just a little bit more is the right amount. Yeah, I trade a lot more than what I might need.
>> Exactly.
Um, so it's a trade-off. And I think the reality is I don't know. I I have never been burned by short paths because 260 is long enough for anything I do, but I could see situations where you're grafting systems together or building larger file systems where you could absolutely hit that. Or putting gueids in your pads, that kind of thing makes them really long. So >> gides >> gedies >> uh the other thing he tags on says then add on to that Windows ignoring capitalization only when it feels like it and trying to move files back and forth to other operating systems becomes a real issue. Do what do you know anything about the sensitivity or selective sensitivity of capitalization with regard to Windows file names or paths or >> No, I don't know anything about the the challenges of upcasing paths automatically and stuff. I mean they're just not file not case sensitive as far as I've ever managed to treat them. But >> so are other oses case sensitive then?
>> Um well even NTFS is case sensitive it keeps track of paths but if you ask for bar you know give me the file bar and you have uppercase B lowerase r uppercase whatever. I can't spell bar by myself. I have to write it down but uh however you're spelling it and whatever capitalization you use it'll match as long as the letters are in the same order. Right? So, um, it keeps track, but when you go to match a path, it gives you the literal either way. So, >> park reverse neutral drive. Park reverse neutral drive. Park reverse neutral drive. I don't know what the L stands for. Low. That's what it's print. Ple.
Can you explain why when exiting from a program written in assembly, I think the exit process, it takes like 3 seconds for the function to actually finish, but it does so immediately if you align your stack pointer to I think eight bytes beforehand. Come on.
>> No, but I'm going to guess it's an alignment trap happening that causes a bunch of faults that some for some reason have to be handled, but it' be have to be a lot of faults to take, you know, several seconds. So >> I I get that Windows requires it because it's needed for some instruction, but I wonder why the function still works regardless but just delayed. Is it >> Well, maybe it crashes, faults, and then exits. And since you were trying to exit, it works in that sense. But it's a very, you know, it's like >> it works >> leaving the house by burning it down.
>> Oh, >> I'm standing outside now.
So it worked. by ibo. Uh oh, Ivo and Donov. Ivo and Donovan. There we go. Uh, what I always appreciated about Windows NTbased, just in case anyone thinks otherwise, is Microsoft's quite successful attempt or commitment if you would like to preserve backward compatibility. Simma goes with business expectations blah blah blah.
says, "Can anyone name a single OS which would allow you to compile or run an app written in 1999? Example, Deli5 in 2026 on Windows 11."
>> Well, 211 BSD. I build stuff on that all the time and it still works. But of course, and it probably would work on a current I bet it would if I compiled it on NetBSD11. It would still work. But, uh, there's an example. So, there there's the answer to your question.
BSD.
>> Yeah. Yeah. Go use that. Corky Benson says, "Why did Microsoft APIs use the Pascal calling convention back in the day?" Says, "I haven't done Windows program in about 20 years, so I don't know if it's still the case."
>> Yeah, I don't know. Everything I I remember Pascal calling convention. Um, does Pascal calling convention give string lengths? Pascal strings have their length built in, so they can be more efficient in some cases, >> but I don't know if that goes into the, you know, they're not passing strings as Pascal strings. So it's strictly the calling convention. Why it's superior, I don't know. It's more verbose than the C calling convention. But now we have so many more registers that the modern calling conventions tend to just stuff everything into registers. But in the olden days, maybe that's why the Pascal one was we're just going to pass everything on the stack because we only had three registers. Well, there more than three, but >> Stedium, where do handles fit into all of this?
seem to remember pre-OSX Mac uh user interface references all being moved around with handles. Never figured out how to dreference those properly. That's what pushed me into using Metro Works, he says.
>> Ah, well, you don't want to dreference a handle because a handle is really just an opaque number that represents a pointer in memory where the actual object is stored. And sometimes it's not good for you to know where the actual object is stored. and you probably can't see it and couldn't write to it anyway because it's in kernel protected memory.
But why even give that information to you? So it used to be you would just get back either an index into a table which is what file open probably gave you or f open probably gave you which is where it had all the open files and so hey you're the third open file your answer is three. Or it could be here's the structure in memory that describes the open file and I'm going to give you the address back. So when you ask me again I go I know where that is. That's this address in memory. I look there and I got all my information. And then to prevent it from being locked to an address so that it can move around because you don't want to assume the address can't be changed, um, they went to handle. So there's going to be an indirection that handle is the number 18 and that gives you the memory address of where the structure actually lives. So they can update the handle table and move the structure around in memory. So that's kind of why handles exist as opposed to just giving you the address.
But no, wait, but to be clear, sometimes they probably do just give you the address because they don't care. But handles should be generally treated as opaque. So even if it is the handle works out to be the memory address, try not to be too clever with that. Think of it like a street address. Let's say that I say Glenn's house is Q instead of saying Glenn lives at 45 Rididgerest Hill.
>> Oh.
Yeah.
>> 1 2 3 Main Street. Yeah.
>> Yeah. 1 2 3 Main Street. Um, so let's say I assign letters to ABCD EF down all the and your house Q, >> right?
>> Well, I look at my table and I can make Q point to any of the houses now just by changing what my table says for letter Q. But so Q is the handle and 45 whatever Main Street or 123 Sesame Street is your actual address. I could just give out your address, but you might move and then how would they find you? If I have the handle in the intermediary, I can go through and update the address there and then everybody just uses Q and it gets to you, >> right?
>> Does that make more sense?
>> Yeah, I think so. Yeah.
>> Okay.
>> Uh AIM 54A uh says what this demonstrates is that Bit Locker can never be secure. Says if they can simply write a program to do what this flaw does, um then anyone can access a Bit Locker driver at any time.
So his question is how is this flaw getting the keys?
>> I don't know. And and that's fascinating to me because somehow it's getting past the encryption which either means the whole TPM or the whole Bit Locker state can be forced that way through hardware mechanism or through some magical API call that only the protected operating system that's trusted is supposed to be able to do. That's going to be my guess.
Um, and that's concerning to me that there's a a backdoor way to get at the encrypted data. So, I wouldn't trust it is my answer. I would certainly use a TPM key at this point and perhaps for sensitive data find other alternate alternate means. See Malu Sevalu, what books would you recommend for learning bitwise math stuff? says, "I recall Hacker's Delight was interesting and mildly impractical."
>> Unfortunately, I don't know of a good reference book for that kind of thing. I don't have one. Used to be, you know, various programmers reference manuals.
Even the Commodore 64 book would have that kind of information in it. But I would go down to your local uh book sale library or computer science place and look for an old book because it's going to have more information the older it is and it'll be cheap and that information hasn't changed in ever. So >> it's gonna some print f stuff here, Dave.
>> All right. Uh weakness boss say printf is from the world of C where you programmer assume to know what you are doing. It does only what it is told to do and doesn't doublech checkck or try to guess your intentions. Quite liberating isn't it?
>> It is. But it's built for a time when you were the customer and so you were going to take the pain when you screwed up and passed the wrong arguments to print. Now you're going to write a ton of code and ship it and force it onto somebody else. they're going to get burned by it. And so you want maybe some better practices with print f and you might want to use numbered arguments and you know dynamic links and some of the stuff I cover in the episode to make it you know a little safer. So and never pass user data to print f.
That's the big one.
>> Yeah, that's right.
>> Here's my string.
>> Yeah. Uh is that s percent s >> percent s and then percent n is the dangerous one. And that's where you tell it to just, hey, put that the how many bytes you're into the string right now.
Write that into memory.
>> Yeah. Yeah. Yeah. Cuz it >> cut out the middleman. I trust you.
You're >> Yeah.
>> Yeah. Connecticut Aggie loved print f actually sprint f or sprint f. I'm not sure how. Yeah. So the question is uh was it the first function to implement the dynamic number of arguments in a function call? And if not then what was?
>> I bet it was. I bet variatic or variable arguments were added for print f. Um, what else was in the basic system other than string stuff?
That's a good one. Let me know in the comments what else used variable numbers of arguments in old C other than like sprint f and scan f and the other formatting functions. But I can't think, but there had to be something. I I still the first, but >> because printing is pretty basic. So, >> uh, Velzac says, "Ironically, oh, and this is so the nibble thing. Um, we're talking about the spelling of it. My understanding was it's typically n I ble, but some people like to go ny in reference to the bite."
>> That feels very British. The NY bbbl.
>> Yeah, I think it was sort of a thing for bites or b y. So, nibble with y was kind of a homage to that maybe. Anyways, uh Bell's Cat says, "Ironically, saying nibble takes us long to say halfbite or four bits. So why bother even using the word?"
>> It's a weird word. I guess it's from a small bite, a nibble.
>> I don't think I actually Yeah, I think I some I must have known that before. I didn't just think of that now. But >> uh Oh, this might be a repeat of an earlier question here. Not going crazy.
Says, "If you freeze something and it just gives it back to the mem allocator, why is it so dangerous to touch the address you just freed? Wouldn't you just access memory that is owned for your process?
>> Usually, it will still be mapped into your process. Um, touching it is one thing. Writing to it is another thing.
And, uh, handing it back to free again is probably the worst thing. No touch.
But yeah, he's right in that it's still probably mapped into your system unless it happened to be part of a page that could be released. So, let's say you were free. You know, pages are 4K. So if you were freeing one bite at a time and yeah that page is probably still in memory every almost all the time. But if you're freeing big blocks of like 64k at a time, those pages might be getting flushed right out by the operating systems virtual memory manager and then you go to touch it and it burns your finger because it's not there anymore.
>> So something that's not there can burn your finger.
>> Yeah, it causes a uh access violation.
Ouchie. Oh violation. Ouchie. That's an AVO, isn't it?
Uh, AVO access. No, just AV.
>> Oh, the ouchie just implied. Okay.
>> The program did a blah blah blah. The address could not be read. Remember those dialogues? Oh, yeah. That's an access violation reading. And you can get them writing.
>> Uh, Dorsy, we'll give them credit for it. Says, "If Malik isn't magic, then why does it stand for magic allegation?"
So, there you go. There's the credit for the one I was thinking. Uh we're going to go into a few sort of the last little question I could take on at the end of a little bit of miscellaneous kind of stuff maybe. Um and speedox 125 says but what allocates the memory for the memory allocator?
>> Uh end mapap or virtual map. What that does is you you'll be able to say give me a physical address for this range of memory put it in 64-bit address space somewhere and give me a pointer back to it. It's kind of the cheap version of what's going on there. So, uh it's just getting the memory visible in the address space and then it can carve it up from there. But that's the preamble step. Yeah. And NT work hand in hand. The virtual memory manager and the heap manager and the cache manager are all kind of in bed with one another because they are all doing related work.
>> How do they communicate with each other?
>> I don't know. That's a colonel problem.
Those guys get a lot of money to worry about post problems.
Uh Ronald D Jr. uh awesome video Dave.
Could you do more of these tech type things uh delivered a nice bite size?
Says does memory allocation and freeing strategy differ among the operating systems.
>> It shouldn't technically but it might. I bet it does because they're all different implementations. So it depends. If you're using the GNU C compiler on Windows and you're using it on Linux, I bet they're very similar because the C compiler is going to run much of the allocation. But if you're talking to the operating system for allocation, it's going to be a completely different strategy. So, yeah.
>> Okay. GED1234.
This really is an excellent lesson. Um, can anyone maybe you recommend other books or websites that'll help reinforce low-level memory?
>> Um, what would be a good book? uh inside windows I think or the Rasanovich and Dan Solomon books would be good. They explain that whole relationship between the heat manager virtual memory and so on. The older book by Helen Kuster I read it I didn't it was a good book but I didn't feel like I learned a lot about there's no code in the book if that helps. Okay.
>> Lot of concepts, no code. I want to see the code. I want to see the API >> in its own font. The special color. I'm a child of the 80s.
>> Feliz Enolin says, "Dave, you said unrolling the grid loop could expand the code to the point where it causes a page fault. Are you sure you didn't mean instruction cache miss? Can't believe the OS would page out a crucial bit of code like that.
>> How does it know? It' probably be one of the most recently used pages. So, it would be unlikely. much more likely would be that your growth of that function pages out something else that you later wish was still in memory. So, you're right. It's probably not going to page out the page you were just touching unless it's really a lot of memory pressure. But, uh, and Sorbus had a time stamp here says, "I'm now singing my hat. It has three corners in my head.
Great videos ever, Dave. A question for shop talk. Outside of your logging and console examples, what's the most missionritical use of printf in modern IT?"
Well, it used to be the creation of grids in Windows, but then I came along and changed that.
I don't know. Logging is the big one.
Um, I think sometimes programs will have interfaces like JSON interfaces and all the REST API stuff and that's all created probably with print f at some point. So, all of the uh web 2.0 and 3.0 and 7.0 O stuff is predicated on text going back and forth and that text is probably at the base level laid out and formatted by print f at some point. So the world runs on print f.
>> It should and it still does. Yeah.
>> And malo >> and malic. Yeah. That's just magic though.
>> True.
>> Magic is full magic.
>> Yeah. Uh David Pimento is the guy who said registry of things roing my butt off over that one. So there he gets his credit for that. Thought it was in there somewhere. Gavin M throws down the gauntlet here and says, "Autor Run was a terrible idea."
Speaking of dark IT related conversations, Stonith was new to me until recently. Wasn't it MS DOSs' roots in CPM that started the uppercase only thing? If you do, if you do do the NTP video, would you make sure to include PPP also, please?
That's a whole host of randomly different questions.
>> Yeah.
>> Again on that. What was this first question?
>> He said auto run was a terrible idea.
>> Oh yeah. What was the alternative? Just putting a disc in and having to tell your kid now double click on the my computer. Now double click on C colon.
Now go into program file. You know you don't want to have to teach kids that.
They just want to put a disc in and have the game come up. So I can see where where the impetus to actually have that feature came from. Uh >> that was a while ago.
Yeah, it is. And it took a bad actor to, you know, actually exploit it. So, don't buy discs from bad actors. I guess you're holding a >> And if you do an NTP video, would you make sure to include PTP also? Are you going to do an NTP video?
>> Yeah, probably at some point. That's a good point. I should I've written NTP so many times and then I find out write that down in there. So, at least it looks >> I don't remember. Yeah.
>> Excellent.
>> Uh, Klovski, Dave, how often, hypothetically, were you approached by NSA to plant back doors? Don't answer that, Dave.
>> I can't talk about either time. I mean, Oh, >> yeah. Tell them my address. Tell them my address. Yeah. Q. I live at Q. One of my favorite stories with my daughter is that when I was at my own company, um, the CIA came to visit me. We had a big closed door meeting.
That's all I can say about that.
>> So, she always wants the details and I I can't say anything. I mean, even with it's let's assume it's completely not interesting. First thing you do is probably sign a piece of paper, right, that says I'll never talk about what happened in this meeting. So, um, yeah, let it drive >> hypothetically. That's the first thing you do.
>> Yeah, I I wouldn't know.
>> You're you're guessing.
>> Joshua Baker, Bible Man, is Bit Locker something you only have if you know you have it. Or is it something everybody has whether they know it or not?
>> I don't know. I haven't set up Windows Home or, you know, any of these systems from a disc in a long time or and I haven't bought an OEM system. If you buy an OM system from Dell, is it preconfigured with Bit Locker? And if it is, it probably doesn't have a PIN code.
So, um, maybe that's another reasons why it has to be unlockable. I don't know, but for OEM cases, >> Mr. Strathol would love to get a Dave video on non-blocking processes like Select when doing synchronous IO multiplexing, for instance, network programming. How does select know to wake up when something drops in the bucket?
>> Yeah, it is an interesting topic. I've used select kind of abusively too where on the PDP11 I needed to delay for less than a 60th of a second or less than a 30th of a second and I couldn't figure out a way. So I'm like, oh, I know I'll just do a select with a timeout. But on the PTB11, the hardware is not capable of doing anything more often than every 30th or 60th because it comes off of power line cycle unless you have special clock hardware in addition. But um so yeah, it's kind of like when I was a kid, I was over my parents were visiting and I got stuck in the basement playing with the other parents kids and I found a phone. And these are in the days of Saskatchewan when their phones were just bare wires on the end and they would screw into a modular terminal of some kind, but wall plastic cover that would always fall off.
>> Yeah. And so I didn't know that part yet. So I took it and I plugged the phone into the power outlet and it went ding. And then all the lights went out.
So I'm terrified, right? Cuz I'm about five at this time. And I go, "Oh, there's a fridge down here, man. I know how to solve this." So I run to the fridge and I open the fridge and there was no light in the fridge. And that blew my mind.
>> I thought there was always light in the fridge. So >> Well, that's where light comes from, right?
>> It's how they make it.
>> Light is born in the fridge, isn't it?
That's Yeah.
>> Yeah. And then every now and then you open the fridge, it escapes, lights the rest of the house, returns the light circuit, >> runs around and makes a little little light. Okay. John Wine Rob uh really another awesomely informative video on a topic I thought I knew well but never thought the parsing magic occurred. Said Ben's code 404 said, "Did he take it offline? Can you possibly share it with me?" Thanks.
>> No, it should still be there. Just search for Ben Sliffka GitHub. That's how I find it.
>> Carlos Mercus. Uh hello Dave. Do you think programmers should experiment um purposely limiting their machine resources through some virtual environment to try to learn those forgotten skills that value thinking about all those limitations?
>> I don't know. That's kind of like wearing shoes that are too tight in order to really appreciate having good shoes.
That analogy is not perfect, but you don't want to make it painful for yourself. So I would set goals, you know, try to limit the memory use of your program and your process without it making it painful for you if you fail.
Trust yourself a little bit. Yeah.
>> So a bunch of every time people always scatter little comments in there about, oh, it's AI. It's AI. Your script is AI.
So X RER popped in here said, do you not know who Dave is? He's one of the OG Microsoft programmers. He might sound like an AI because he invented a lot of stuff before you were probably born. So >> you're absolutely right. Dash Dash.
Did he say M Dash? M Dash.
>> Dash Dash. Yeah.
>> Yeah. Uh Grody Boots. Uh oh, we're talking about Canadian Tire Money.
Guilty. I passed out some Canadian Tire money when I was in Brazil, Argentina, India, and maybe in Bahrain. I'd love to see what happened to those bills. Does anyone else miss the physical notes? I used to enjoy watching that stack of bills growing, planning uh what I was going to buy next. But now it's just points in an app and that just doesn't cut it. So yeah, I don't collect the points either. No app for me. It's paper Canadian Tire money or nothing.
>> If I were a crueler man, I would get a stack of Canadian Tire money for the next time I go to Vancouver. And as I'm walking and being, you know, kind of annoyed by pan handlers, I could hand out >> just like Paul Getty or whatever.
>> I'm like Carnegie handing out the big 50s.
>> Yeah. In Vancouver, you could hand it out outside the Carnegie Center, which is at the heart of Hastings and Maine, the downtown east side in Vancouver.
There'd be some uh irony in that Carnegie reference there. Yeah. Maybe not in a good way though.
>> You know what kind of breaks my heart?
Carnegie, whose name is Carnegi, so it's Andrew Carnegie, right? And he wants to be remembered. He wants to be remembered for good things. So he builds all these things, names them after himself like Carnegie Hall and then we say his name wrong for a century. Nobody says Carnegie Hall or you know uh down to the last uh maybe two three year. Uh K West I hope this is a good question which hasn't been covered on a previous shop talk. What is the difference between meantime and in between time?
H I don't know.
>> You know where that came from? Oh, that's from >> from Ed McMahon. Yeah. Yeah. Stampede wrestling. Yeah. No, no, not Ed McMahon.
Sorry.
>> It's something like that.
>> Yeah, it is McMahon though.
>> Who's the guy from Stampede Wrestling?
Yeah.
>> I got to look this up. Jim. Yeah. Ed McMahon is the guy from the WWF or WWE.
>> Oh, yeah. I know what it is now. I looked it up. Are you ready? It's Ed.
>> But it's Ed Whan.
>> Ed Whan. Yes. Stampede Wrestling. Looks like a rally.
>> My sister-in-law Jackie got married by his widow.
>> Wow. So his widow is a ordained minister of some kind and she performed the service at my sister-in-law's wedding.
So >> excellent. And that wedding lasted in the meantime and in between time. Is it meantime? In the meantime, in between time is about 3 years in that case, I think.
>> Okay.
>> Uh and then Andrew Poland uh piped it.
Oh, and we should say, so when we recorded our last uh Shop Talk episode, the first two or three minutes, um you talked about the yellow key exploit and then we decided after, oh shoot, we're just going to chop that off and we put it out on I think you put it on Dave's garage. So >> yeah, >> it made more sense contextually within the whole thing cuz you go, are you afraid, Glenn? And so this whole thing ended on Dave's garage with you afraid.
A whole bunch of people, Glenn, who's Glenn? What's Glenn? Why would Glenn be afraid? Who is Glenn? What is this Glenn he's speaking of? So Andrew Poland pipes up here. He says, "Glenn, be afraid. Be very afraid." He says, "Hey Glenn, how's that 51st date thing doing?" So you got another slide in there. So I'm Glenn.
Most of the people that watch that aren't subscribe to this channel, and they should be.
>> There you go.
>> So subscribe to both. We be twice as big.
>> That's right. And it's subs and likes, man. No ads, none of that garbage. So yeah, it's just us goofing around answering questions. Question mark in the comments. Dave's garage. Dave's attic. We answer him weekly here the best we can.
>> Yeah. Yeah. So now we're pimping for manscape here.
>> Yeah.
>> And I think last time that >> from the three episodes of Dave's Garage and the Shop Talk, there were about 397 comments with question marks in them.
>> So I'm I'm going through 397 to try and pull out 50 or so and hit and miss on some of them, but that's all right. So, we do our best >> because now when I go through comments, I tend to give less attention to the ones with question marks because I know we'll get to them on the show, but we can't always do that.
>> Yeah, you can't hit them all. That's for sure. And then the last one will go to Bill J5645. He says, "Bourbon. I was drinking bourbon last time cuz I was in the US of Aces. Are Canadians allowed to drink bourbon? Canada makes their own version of pretender bourbon?"
It's we call it rye whiskey and it's quite fine. And I sort of grew up on that stuff. So yeah, Ryan Coke is a Saskatchewan tradition for sure. So >> you got to use it to wash down your maple donut.
>> That's right. Yeah. And your Timbits with your Double Double, eh?
>> I'm not a Tim. Tim is a new thing. Tim was like a Toronto store when I lived in Canada. It didn't even exist on the West Coast or >> Robins Donuts was the one that I remember. Well, I think didn't Karen Zimmerman's dad owned one, >> possibly. I thought I thought her dad owned a Robin's Donuts franchise or two or something, but I don't know.
>> But in those days, you didn't go to a donut place for coffee. You would go to a pizza place or A&W or something like that.
>> You went anywhere.
>> Yeah.
>> Cuz every little cafe and restaurant, there was just the the lady walking around with the blackandled one and the redandled one if you want to decaf. And you just they kept filling your cup.
>> Yeah. You know, that was a huge growth time for me as a person with autism because that socializing for 2 or 3 hours pointlessly, needlessly every night, but learning the social banter and how people insult each other playfully and all that stuff, you know, it was not new, but it was a lot of good practice. So, and I met my wife doing it. So, there you go.
>> There you go. Okay, that's all we got for you this week. Dave, um, we Yes, we missed last week cuz you were at the Dell thing. You want to say anything about the Dell?
>> Yeah, it was a lot of fun. Uh Dell treated us really well. They got some cool hardware coming out. The GB300 was interesting. I got to play with that.
Unfortunately, the uh Perf specs on the machine differ from production enough that I can't release the benchmarks.
They're going to rerun them and give me the new numbers. Um but I did get to play with the machine for quite a while.
Run Tempest on it and everything else.
and saw their new giant racks and we saw Keith Urban did a little private concert for us. So that was kind of fun. Not that I knew any Keith Urban songs, but you seemed talented and energetic. So >> it didn't convert you cuz you're not wearing a cowboy hat tonight. So >> no, they were had everybody had RGB cowboy hats on except for me and I felt really left out. I don't know where they got them. I must have got there late.
>> Yeah. Anyways, that's it. Uh come back next Friday. We'll have another episode out.
>> All right. Please make sure you're subscribed to Dave's Addict so you get these again if you've not seen one before. If you're already subscribed, thank you very much. But if not, maybe give it a click and let us know how it goes. If you don't like it, post your question with a comment and a question mark at the end and let us know why.
>> And subscribe anyway. You don't have to like it. Just subscribe.
>> Yeah, subscribe anyway. But until then, in the meantime, it's all about the metrics, baby. It's all we care for.
We're just junkies for the numbers.
Pressing S5 on the keyboard. Refresh.
Refresh. How many more subscribers? two.
Okay, thank you. Good night everybody.
See you.
>> Uh, this is why my Linux install. This is why my Linux install.
Okay, let me try this again.
>> Undo momentum port 4. I don't know.
>> He ain't going to get a video on that from you then, is he?
>> Not from me, but I'd watch one.
>> Do not put that in the outings.
>> Yeah, >> that's going to be the way I go. If you're from Quebec, we'd say W.
>> No, we >> you say W.
>> W.
>> It's not we for yes, it's >> okay.
>> That's an accent thing. Some people from Quebec will think I'm being ignorant.
Couple other ones to >> Yeah, we'll cut this out because this is garbage. Okay.
>> Well, David Suzuki would tell you that if you had built more green buildings, you wouldn't have the heat crisis in the beginning. So you made your own bed. So too bad for you.
>> Yeah. Die in it.
>> Exactly.
>> Yeah. Yeah.
>> Focus because of your face. Your face gets Oh. Oh jeez. You close your eyes and it's still too close your hand now.
But hammer and chice. Except I think they changed it for other reasons.
>> Hammer and chisel.
>> Chisles in the hizzle.
>> Chisles in the hizzle.
>> I made that carpet taste the back of me hand.
>> Yeah. whether it wanted to or not.
>> All right, we may not record until I get hot.
>> Oh, you're hot already, Dave.
>> Oh, thank you.
>> You're efficient for that, right? That's why you said that. Is that That's the correct column response expectation.
>> Yeah, I think so. I'd pout, you know, otherwise.
>> Oh, we don't need any more voting. Yeah.
>> Woo.
Ready?
Here we go.
Hey, I'm Dave. Welcome to Shop Talk, where we answer all the week's best user questions and comments from the channel.
Let me start over from the something.
Where do we answer them from Boink?
This little chair will be waiting for one of you and a rocking chair for another who likes to rock and a big armchair for two to curl up in.
All next time right here on Shop Talk.
Vidéos Similaires
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
🚀 BCS613C Compiler Design | Module 1 to 5 Schema Evaluation 🔥 | VTU 6th Sem 💯 #VTU #bcs613c #exam
Pranavaa-y4y
104 views•2026-06-02











