<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>executable files Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/executable-files/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/executable-files/</link>
	<description></description>
	<lastBuildDate>Sun, 08 Jun 2025 23:06:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>executable files Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/executable-files/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How the Loader Module Works: Launching Programs in Your Operating System Explained!</title>
		<link>https://www.NeuralLantern.com/how-the-loader-module-works-launching-programs-in-your-operating-system-explained/</link>
					<comments>https://www.NeuralLantern.com/how-the-loader-module-works-launching-programs-in-your-operating-system-explained/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sun, 08 Jun 2025 23:06:41 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[computer basics]]></category>
		<category><![CDATA[CPU scheduling]]></category>
		<category><![CDATA[ELF format]]></category>
		<category><![CDATA[executable files]]></category>
		<category><![CDATA[Linux 64 bit]]></category>
		<category><![CDATA[loader module]]></category>
		<category><![CDATA[memory allocation]]></category>
		<category><![CDATA[multitasking]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[OS explained]]></category>
		<category><![CDATA[process creation]]></category>
		<category><![CDATA[program execution]]></category>
		<category><![CDATA[tech education]]></category>
		<category><![CDATA[tech tutorial]]></category>
		<category><![CDATA[virtual memory]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=144</guid>

					<description><![CDATA[<p>Discover the Loader Module’s role in your OS! Learn how it loads programs from disk to RAM in this fun, clear guide. Perfect for tech fans!</p>
<p>The post <a href="https://www.NeuralLantern.com/how-the-loader-module-works-launching-programs-in-your-operating-system-explained/">How the Loader Module Works: Launching Programs in Your Operating System Explained!</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="How the Loader Module Works: Launching Programs in Your Operating System Explained!" width="1380" height="776" src="https://www.youtube.com/embed/mfsYCiGDg8A?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Ever clicked an icon and wondered how your program starts? Meet the Loader Module, the unsung hero in your operating system! This video breaks down how it loads programs from your disk to RAM, sets up processes, and gets your apps ready to roll. Perfect for tech newbies or curious coders! Join us for a fun, easy-to-follow explanation, and stick around for more OS secrets. Subscribe, comment your thoughts, and scan the QR code to explore more tutorials on our site! Let’s geek out together!</p>



<p class="wp-block-paragraph">Introduction to Loader Module 00:00:00<br>What is the Loader Module 00:00:10<br>Role in Operating Systems 00:00:14<br>Loading Process Overview 00:00:21<br>Program Execution Trigger 00:00:44<br>Signal to Operating System 00:01:00<br>Executable Validation 00:01:43<br>Memory Allocation 00:02:31<br>Process Creation 00:03:05<br>Process Setup Completion 00:04:22<br>Operating System Scheduling 00:04:54<br>Multitasking Illusion 00:05:24<br>Process Termination 00:05:59<br>Loader Module Limitations 00:06:11<br>Conclusion and Summary 00:06:28<br>Call to Subscribe 00:07:00<br>Website and Community 00:07:56</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>
</ul>



<p class="wp-block-paragraph">Please help support us!</p>



<ul class="wp-block-list">
<li>Subscribing + Sharing on Social Media</li>



<li>Leaving a comment or suggestion</li>



<li>Subscribing to our Blog</li>



<li>Watching the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hey there! Let&#8217;s talk about the Loader Module for just a second.</p>



<p class="wp-block-paragraph">What is the Loader Module? For starters, you probably have one on your computer at home.</p>



<p class="wp-block-paragraph">Almost, I mean, as far as I understand, every major operating system has a Loader Module.</p>



<p class="wp-block-paragraph">I would be surprised if an operating system did not have one.</p>



<p class="wp-block-paragraph">The Loader Module is basically responsible for getting your program loaded from your hard disk,</p>



<p class="wp-block-paragraph">your hard disk your ssd or whatever into ram and sort of setting it up setting up an empty process</p>



<p class="wp-block-paragraph">and getting it all prepared so that the operating system can begin executing your process doesn&#8217;t</p>



<p class="wp-block-paragraph">actually execute it it just gets it set up so i mean think about it what if i click on my desktop</p>



<p class="wp-block-paragraph">here and i click on this little mouse icon this little text editor icon the mouse pad</p>



<p class="wp-block-paragraph">it launched what happened it wasn&#8217;t running before and now it is running something had to do that</p>



<p class="wp-block-paragraph">It wasn&#8217;t the desktop environment actually the desktop environment when I click this little button</p>



<p class="wp-block-paragraph">It just sent a signal to the operating system letting it know that I wanted to start executing a program</p>



<p class="wp-block-paragraph">But it didn&#8217;t actually load it up for me. That&#8217;s the loader module. The loader module is part of the operating system</p>



<p class="wp-block-paragraph">and imagine that as soon as I</p>



<p class="wp-block-paragraph">You know click this button right here a signal gets sent to the operating system or maybe even if I just execute a command like echo</p>



<p class="wp-block-paragraph">You know test or something or run get get status. Let&#8217;s say</p>



<p class="wp-block-paragraph">status let&#8217;s say or even I could run this terminal again terminator and it</p>



<p class="wp-block-paragraph">shows up in another window something like that let me exit from that you know</p>



<p class="wp-block-paragraph">anything that I exit whatever the loader module is involved so I click this and</p>



<p class="wp-block-paragraph">the first thing that will happen is the loader module will inspect the</p>



<p class="wp-block-paragraph">executable which is just kind of sitting on disk somewhere and it&#8217;ll make sure</p>



<p class="wp-block-paragraph">that it&#8217;s actually executable it&#8217;ll make sure not just in terms of you know</p>



<p class="wp-block-paragraph">That&#8217;s sort of an operating system thing, a different part of the operating system.</p>



<p class="wp-block-paragraph">But it&#8217;ll check to make sure, let&#8217;s say that it&#8217;s a binary program that needs to be executed.</p>



<p class="wp-block-paragraph">It&#8217;ll make sure that the data inside of the binary, the actual executable is correct for</p>



<p class="wp-block-paragraph">the current system that you&#8217;re on.</p>



<p class="wp-block-paragraph">Like right now I&#8217;m on Linux 64 bit.</p>



<p class="wp-block-paragraph">So it&#8217;ll make sure that the executable is in a ELF 64 format or a format that can be</p>



<p class="wp-block-paragraph">executed.</p>



<p class="wp-block-paragraph">It&#8217;ll check that it&#8217;ll make sure everything&#8217;s okay to make sure it&#8217;s got some data. It&#8217;s got like a you know an entry point whatever</p>



<p class="wp-block-paragraph">If everything looks good, then it will go through system RAM and try to find a little place in RAM that&#8217;s unoccupied</p>



<p class="wp-block-paragraph">I&#8217;m not going to talk too much about operating system concepts beyond the loader module, but just so you know</p>



<p class="wp-block-paragraph">There is a paging system that it would go through which sort of lets you have fragmented memory without too much of a penalty</p>



<p class="wp-block-paragraph">the ram stick directly but for our purposes we&#8217;ll just say it&#8217;s looking for a free spot in memory</p>



<p class="wp-block-paragraph">anyway once it finds out that there&#8217;s a free spot in memory that&#8217;s big enough to accommodate</p>



<p class="wp-block-paragraph">the program then it actually loads the program from disk from ssd from whatever into that spot</p>



<p class="wp-block-paragraph">in memory and creates a process in the operating system remember everything that&#8217;s actually running</p>



<p class="wp-block-paragraph">in your operating system is a process there&#8217;s a process for this notepad there&#8217;s a process</p>



<p class="wp-block-paragraph">for the mouse stuff there&#8217;s a process for this little widget down here there&#8217;s a</p>



<p class="wp-block-paragraph">process for the entire desktop there&#8217;s a process for probably every tab in your</p>



<p class="wp-block-paragraph">browser you know a process just means here&#8217;s a little spot in memory on the</p>



<p class="wp-block-paragraph">computer and it&#8217;s got a program inside of it and it wants to be run by the CPU</p>



<p class="wp-block-paragraph">whenever the CPU thinks that it has some time to run that process so that&#8217;s like</p>



<p class="wp-block-paragraph">a process anyway so it you know it finds a spot in memory it loads the program in</p>



<p class="wp-block-paragraph">you know checks everything it sets it up as a process which means it has to set up some data</p>



<p class="wp-block-paragraph">structures in the operating system indicating hey there&#8217;s a new process in town and here&#8217;s where the</p>



<p class="wp-block-paragraph">memory is and here&#8217;s the first instruction that you should execute and it just kind of sets</p>



<p class="wp-block-paragraph">everything up so that it&#8217;s like a like a ready process a process in the ready state that hasn&#8217;t</p>



<p class="wp-block-paragraph">been actually executed yet but it&#8217;s ready to get executed so once it does all of that</p>



<p class="wp-block-paragraph">new process you know setting everything up maybe figuring out what is the virtual memory address</p>



<p class="wp-block-paragraph">that the process is going to see and so forth then finally it lets the operating system know</p>



<p class="wp-block-paragraph">that the process is ready to run so before it was just kind of like loading it and setting it up</p>



<p class="wp-block-paragraph">marking little flags figuring out the virtual memory offset all that stuff then once that&#8217;s</p>



<p class="wp-block-paragraph">all finished it just tells the operating system now this process is ready to run the process</p>



<p class="wp-block-paragraph">I&#8217;m going to try my best not to talk too much about operating systems concepts beyond the loader module, but</p>



<p class="wp-block-paragraph">the loader module&#8217;s job is not to run the process. It&#8217;s just to load it, just to set it up.</p>



<p class="wp-block-paragraph">At some later point in time, maybe some amount of microseconds or milliseconds in the future,</p>



<p class="wp-block-paragraph">the operating system will decide, okay, now I&#8217;m ready to let that program run for a little while.</p>



<p class="wp-block-paragraph">Since the process has already been set up by the loader module, the operating system knows where</p>



<p class="wp-block-paragraph">it is in memory and it knows the next instruction address or offset address to execute. It&#8217;ll just</p>



<p class="wp-block-paragraph">set address to execute it&#8217;ll just start bringing those instructions onto the CPU and just execute</p>



<p class="wp-block-paragraph">them for some amount of time and then the operating system will decide to stop and take it off the CPU</p>



<p class="wp-block-paragraph">again you know put it back just into a into a ready state and then it just keeps switching back</p>



<p class="wp-block-paragraph">and forth between that by the way have you ever wondered how it is that maybe your CPU only has</p>



<p class="wp-block-paragraph">one core or only eight cores but there are hundreds of browser tabs that you have open</p>



<p class="wp-block-paragraph">hundreds and hundreds of processes that you have open that&#8217;s how the operating system does it it</p>



<p class="wp-block-paragraph">it simulates it provides the illusion that all these programs are running at the same time so</p>



<p class="wp-block-paragraph">this notepad process right here it&#8217;s not actually running at all times it just runs in tiny little</p>



<p class="wp-block-paragraph">slices again i&#8217;ll try to stay away from explaining that too much because i&#8217;m really here to talk</p>



<p class="wp-block-paragraph">about the loader module another thing to keep in mind is that eventually when your process terminates</p>



<p class="wp-block-paragraph">like the the program terminates itself or the operating system kills it for some reason or just</p>



<p class="wp-block-paragraph">or just, you know, something happens to where it&#8217;s just not going to be running anymore.</p>



<p class="wp-block-paragraph">It&#8217;s not the loader module that has anything to do with that.</p>



<p class="wp-block-paragraph">And there is no unloader module.</p>



<p class="wp-block-paragraph">It will just mark itself as, you know, I&#8217;m done, I&#8217;m terminated, whatever,</p>



<p class="wp-block-paragraph">or it&#8217;ll get marked.</p>



<p class="wp-block-paragraph">Then the operating system will come along and clean it up.</p>



<p class="wp-block-paragraph">So loader module is not involved in that step.</p>



<p class="wp-block-paragraph">It&#8217;s just involved in getting everything set up so that it can start to execute.</p>



<p class="wp-block-paragraph">And that&#8217;s the basic idea.</p>



<p class="wp-block-paragraph">detailed but that&#8217;s what the loader module does in general and you probably</p>



<p class="wp-block-paragraph">have a loader module on your operating system right now unless you&#8217;re running</p>



<p class="wp-block-paragraph">some bizarre operating system that has some other strange method of doing</p>



<p class="wp-block-paragraph">things okay that&#8217;s all I really wanted to say in this video thank you so much</p>



<p class="wp-block-paragraph">for watching I hope you learned a little bit of stuff and had some fun I&#8217;ll see</p>



<p class="wp-block-paragraph">you in the next video</p>



<p class="wp-block-paragraph">Thanks for watching this video again from the bottom of my heart. I really appreciate it</p>



<p class="wp-block-paragraph">I do hope you did learn something and have some fun</p>



<p class="wp-block-paragraph">If you could do me a please a small little favor</p>



<p class="wp-block-paragraph">Could you please subscribe and follow this channel or these videos or whatever it is you do on the current social media?</p>



<p class="wp-block-paragraph">It&#8217;s a website that you&#8217;re looking at right now</p>



<p class="wp-block-paragraph">It would really mean the world to me and it&#8217;ll help make more videos and grow this community</p>



<p class="wp-block-paragraph">So we&#8217;ll be able to do more videos longer videos better videos or just I&#8217;ll be able to keep making videos in general</p>



<p class="wp-block-paragraph">videos in general. So please do me a kindness and subscribe. You know, sometimes I&#8217;m sleeping</p>



<p class="wp-block-paragraph">in the middle of the night and I just wake up because I know somebody subscribed or followed.</p>



<p class="wp-block-paragraph">It just wakes me up and I get filled with joy. That&#8217;s exactly what happens every single time.</p>



<p class="wp-block-paragraph">So you could do it as a nice favor to me or you could troll me if you want to just wake me up in</p>



<p class="wp-block-paragraph">the middle of the night, just subscribe and then I&#8217;ll just wake up. I promise that&#8217;s what&#8217;ll happen.</p>



<p class="wp-block-paragraph">Also, if you look at the middle of the screen right now, you should see a QR code, which you</p>



<p class="wp-block-paragraph">QR code which you can scan in order to go to the website which I think is also</p>



<p class="wp-block-paragraph">named somewhere at the bottom of this video and it&#8217;ll take you to my main</p>



<p class="wp-block-paragraph">website where you can just kind of like see all the videos I published and the</p>



<p class="wp-block-paragraph">services and tutorials and things that I offer and all that good stuff and if</p>



<p class="wp-block-paragraph">you have a suggestion for clarifications or errata or just future videos that you</p>



<p class="wp-block-paragraph">want to see please leave a comment or if you just want to say hey what&#8217;s up</p>



<p class="wp-block-paragraph">you know just send me a comment whatever i also wake up for those in the middle of the night i get</p>



<p class="wp-block-paragraph">i wake up in a cold sweat and i&#8217;m like it would really it really mean the world to me i would</p>



<p class="wp-block-paragraph">really appreciate it so again thank you so much for watching this video and um enjoy the cool music</p>



<p class="wp-block-paragraph">as as i fade into the darkness which is coming for us all</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/how-the-loader-module-works-launching-programs-in-your-operating-system-explained/">How the Loader Module Works: Launching Programs in Your Operating System Explained!</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/how-the-loader-module-works-launching-programs-in-your-operating-system-explained/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How Linkers Work: Linking Code, Virtual Memory, and Module Jumps Explained</title>
		<link>https://www.NeuralLantern.com/how-linkers-work-linking-code-virtual-memory-and-module-jumps-explained/</link>
					<comments>https://www.NeuralLantern.com/how-linkers-work-linking-code-virtual-memory-and-module-jumps-explained/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Mon, 02 Jun 2025 13:04:50 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[assembly programming]]></category>
		<category><![CDATA[C++ programming]]></category>
		<category><![CDATA[code linking]]></category>
		<category><![CDATA[coding tutorials]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[executable files]]></category>
		<category><![CDATA[jump instructions]]></category>
		<category><![CDATA[linker]]></category>
		<category><![CDATA[module linking]]></category>
		<category><![CDATA[object files]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming basics]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[virtual memory]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=139</guid>

					<description><![CDATA[<p>Learn how linkers connect code modules, manage virtual memory, and handle jumps in this beginner-friendly guide to programming! #Linker #Coding</p>
<p>The post <a href="https://www.NeuralLantern.com/how-linkers-work-linking-code-virtual-memory-and-module-jumps-explained/">How Linkers Work: Linking Code, Virtual Memory, and Module Jumps Explained</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="How Linkers Work: Linking Code, Virtual Memory, and Module Jumps Explained" width="1380" height="776" src="https://www.youtube.com/embed/Q6B9FWCeaFs?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Hey everyone, let’s talk linkers! In this video, we unpack the general idea of linking in programming—taking your source code, turning it into object files, and stitching them into an executable. We dive into virtual memory, how programs use offsets, and why jump instructions matter across modules. Using simple assembly and C++ examples, we’ll show how linkers lay out modules, handle labels, and make function calls work. Whether you’re a beginner or a coder curious about what happens under the hood, this is for you! Hit subscribe, scan the QR code for more tutorials, and drop a comment with your thoughts or video ideas. Let’s keep learning and have some fun with code! #Programming #Linker #VirtualMemory #CodingExplained</p>



<p class="wp-block-paragraph">Introduction to Linking 00:00:00<br>Compilation and Object Files 00:00:05<br>Linker Overview 00:00:32<br>Virtual Memory Explanation 00:00:42<br>Program Memory Offsets 00:01:18<br>Jump Instructions in Modules 00:02:54<br>Module Address Space 00:03:38<br>Assembler and Label Jumps 00:04:02<br>Linker’s Role in Module Layout 00:07:15<br>Function Calls Across Modules 00:08:04<br>Marking Labels as Global 00:09:31<br>External Function Calls 00:10:23<br>Data in Executables 00:11:12<br>Conclusion and Call to Subscribe 00:12:08</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>
</ul>



<p class="wp-block-paragraph">Please help support us!</p>



<ul class="wp-block-list">
<li>Subscribing + Sharing on Social Media</li>



<li>Leaving a comment or suggestion</li>



<li>Subscribing to our Blog</li>



<li>Watching the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hey there, I want to talk to you very quickly about the general idea of linking your programs.</p>



<p class="wp-block-paragraph">In previous videos I&#8217;ve described exactly how to perform the linking stage when you&#8217;re compiling</p>



<p class="wp-block-paragraph">a program. So you write some source code, you compile the source code into object files,</p>



<p class="wp-block-paragraph">you know each file becomes one individual object file, and then when we&#8217;re done we take all the</p>



<p class="wp-block-paragraph">object files and we link them up into an executable program. So I&#8217;ve talked about that</p>



<p class="wp-block-paragraph">I just wanted to talk to you about the general idea of the linking stage in general.</p>



<p class="wp-block-paragraph">Like what is the linker? What is its job? What is it actually doing?</p>



<p class="wp-block-paragraph">So try to keep in mind for starters, each program uses virtual memory.</p>



<p class="wp-block-paragraph">It uses a virtual memory space.</p>



<p class="wp-block-paragraph">So obviously on your computer you have real memory,</p>



<p class="wp-block-paragraph">but there&#8217;s lots of layers of abstraction between the physical hardware</p>



<p class="wp-block-paragraph">the physical hardware and the program that&#8217;s running for starters the operating system uses</p>



<p class="wp-block-paragraph">a paging system the memory stick the memory circuitry might be doing something else for</p>



<p class="wp-block-paragraph">error checking or just you know transport or whatever so so try and bear in mind that each</p>



<p class="wp-block-paragraph">program thinks that it&#8217;s it thinks that itself is kind of the beginning of memory you could imagine</p>



<p class="wp-block-paragraph">it as each program thinks that its first memory location that it has assigned to it is memory</p>



<p class="wp-block-paragraph">location zero but that wouldn&#8217;t necessarily be the case on the computer</p>



<p class="wp-block-paragraph">your operating system probably would have come up with an offset let&#8217;s say</p>



<p class="wp-block-paragraph">for example you know your computer decides to launch your program it</p>



<p class="wp-block-paragraph">creates a process it finds a chunk of memory that&#8217;s available across you know</p>



<p class="wp-block-paragraph">one or more pages of free memory and let&#8217;s say for the sake of argument that</p>



<p class="wp-block-paragraph">the starting offset for the for the quote-unquote real forgetting the other</p>



<p class="wp-block-paragraph">layers layers of abstraction the real memory location of your program is going</p>



<p class="wp-block-paragraph">of your program is going to be let&#8217;s just say like a thousand I know that&#8217;s</p>



<p class="wp-block-paragraph">real unrealistically too low but let&#8217;s just say a thousand and then let&#8217;s say</p>



<p class="wp-block-paragraph">that your program then thinks that it starts at memory location zero that</p>



<p class="wp-block-paragraph">means if your program wants to access memory location 100 then under the hood</p>



<p class="wp-block-paragraph">at the last moment right before you actually hit the RAM stick or hit the</p>



<p class="wp-block-paragraph">page file system a translation has to be performed so if your program is trying</p>



<p class="wp-block-paragraph">what actually happens is you know the general offset for the entire program</p>



<p class="wp-block-paragraph">gets added to memory location 100 and then that tells the computer or the</p>



<p class="wp-block-paragraph">operating system that what you&#8217;re actually trying to do in your program is</p>



<p class="wp-block-paragraph">access memory location 1100 so keep in mind all of this memory is virtual</p>



<p class="wp-block-paragraph">and the modules themselves also need to know where to jump when I say where to</p>



<p class="wp-block-paragraph">Well, suppose for the sake of argument, you have a program that has some jump instructions</p>



<p class="wp-block-paragraph">or go to instructions or like some conditional branching instructions, anything where execution</p>



<p class="wp-block-paragraph">is not just going to go to the very next statement.</p>



<p class="wp-block-paragraph">Execution is going to go somewhere else.</p>



<p class="wp-block-paragraph">Like maybe you have an if else block.</p>



<p class="wp-block-paragraph">It&#8217;s got to maybe jump sometimes down to the else part instead of the top if part.</p>



<p class="wp-block-paragraph">And then when it&#8217;s done executing, it&#8217;s going to jump until after the whole block, you know,</p>



<p class="wp-block-paragraph">There will be lots of times in all of your programs where execution kind of has to jump</p>



<p class="wp-block-paragraph">around somewhere if the program is even a little bit complicated.</p>



<p class="wp-block-paragraph">So that could be a jump instruction, go to in a higher level language, not assembly necessarily,</p>



<p class="wp-block-paragraph">jump if not equal and so forth.</p>



<p class="wp-block-paragraph">So if you imagine writing one module, you could also imagine that the module has its</p>



<p class="wp-block-paragraph">own virtual memory address space.</p>



<p class="wp-block-paragraph">Just imagine it for now.</p>



<p class="wp-block-paragraph">And maybe it starts at zero.</p>



<p class="wp-block-paragraph">at zero that&#8217;s that&#8217;s not what we&#8217;re going to say but just like imagine the module only really knows</p>



<p class="wp-block-paragraph">about itself and so sometimes when you&#8217;re jumping for example if we&#8217;re going to jump uh when</p>



<p class="wp-block-paragraph">something is not equal to something else we&#8217;ll jump to some label and in order to jump to that</p>



<p class="wp-block-paragraph">label the assembler needs to know you know where is that label inside of your source code so pretend</p>



<p class="wp-block-paragraph">just for a moment this is not like a real assembly program but just pretend for a moment that we have</p>



<p class="wp-block-paragraph">and maybe this is like I don&#8217;t know the main label that gets jumped into from GCC and</p>



<p class="wp-block-paragraph">so then we have like a label down here outside and we&#8217;ll do stuff and then jump back to the</p>



<p class="wp-block-paragraph">original point so we probably have to do a label here main finish this is this is bad form but I&#8217;m</p>



<p class="wp-block-paragraph">So if we jump, let&#8217;s compare, I don&#8217;t know, one with two or something.</p>



<p class="wp-block-paragraph">Let&#8217;s compare RAX to RDX and we&#8217;ll just move RAX the value one and move RDX the value two</p>



<p class="wp-block-paragraph">so they&#8217;re not actually equal.</p>



<p class="wp-block-paragraph">And then we compare them and then we say, all right, jump if they&#8217;re not equal to this label.</p>



<p class="wp-block-paragraph">So definitely now we know, oh, we are going to jump down to that label.</p>



<p class="wp-block-paragraph">So execution is going to go directly down to here.</p>



<p class="wp-block-paragraph">we&#8217;ll do something and then eventually maybe we want to jump back so we&#8217;ll say uh</p>



<p class="wp-block-paragraph">maybe let&#8217;s do it again let&#8217;s do let&#8217;s do like a whole set of statements again we&#8217;ll say jump</p>



<p class="wp-block-paragraph">if it is equal and we&#8217;ll just like load those two registers so one and one and then compare</p>



<p class="wp-block-paragraph">them and then say jump if it is equal to main finish this is not a video about conditional</p>



<p class="wp-block-paragraph">branching or jumping i&#8217;m trying to make this as simple as i can but i hope you understand the</p>



<p class="wp-block-paragraph">but i hope you understand the point is just basically we&#8217;re jumping around within the same</p>



<p class="wp-block-paragraph">module right so it&#8217;s easy for the program to understand where to jump if it&#8217;s in the same</p>



<p class="wp-block-paragraph">module or i guess the the object file when we&#8217;re assembling it it&#8217;s easy to understand where to jump</p>



<p class="wp-block-paragraph">because if we&#8217;re at line 8 here when we start to jump and then the actual label here has its first</p>



<p class="wp-block-paragraph">instruction at line 17 well then it you know the amount of instructions to move is just the</p>



<p class="wp-block-paragraph">the difference you know so it&#8217;s easy to say all right if our virtual address is you know this</p>



<p class="wp-block-paragraph">when we jump and we&#8217;re going to jump this much of a difference based on where the label is then now</p>



<p class="wp-block-paragraph">we can just compute the new virtual address to jump or the absolute address or whatever you want</p>



<p class="wp-block-paragraph">to whatever you want to do on that particular run but how does it know where to jump in another</p>



<p class="wp-block-paragraph">module because when we assemble this module as an object file the assembler is only running one pass</p>



<p class="wp-block-paragraph">one pass on just this object file it doesn&#8217;t really know the addresses in the other modules</p>



<p class="wp-block-paragraph">it doesn&#8217;t know their offsets of its labels even if it&#8217;s a c plus plus or a c module it doesn&#8217;t</p>



<p class="wp-block-paragraph">really know the offsets it doesn&#8217;t know where the functions start and end doesn&#8217;t know anything</p>



<p class="wp-block-paragraph">because right now if we assemble this one source code it&#8217;s only going to know about this one source</p>



<p class="wp-block-paragraph">code right and the same goes for the other modules if we compile a c plus plus program to an object</p>



<p class="wp-block-paragraph">a function or you know do a go to statement or something into one of these labels from this</p>



<p class="wp-block-paragraph">module the c plus plus program won&#8217;t really know where it is it won&#8217;t know what address it&#8217;s at it</p>



<p class="wp-block-paragraph">won&#8217;t know the offset right so that&#8217;s the job of the linker the linker looks at all of these labels</p>



<p class="wp-block-paragraph">and all of these uh conditional branching statements and jump statements and everything</p>



<p class="wp-block-paragraph">and it just decides for starters it decides where each module is going to start in memory so maybe</p>



<p class="wp-block-paragraph">I don&#8217;t know if your C++ module starts up here somewhere and then it&#8217;ll say this assembly module</p>



<p class="wp-block-paragraph">starts right after it and then another module right after that and it&#8217;ll just kind of decide</p>



<p class="wp-block-paragraph">where every module will start in the final executable that we&#8217;re actually linking together.</p>



<p class="wp-block-paragraph">Once it decides the layout then it knows the offset of all the different modules and therefore</p>



<p class="wp-block-paragraph">it can compute the additional offset that it would take to get to all the labels. So then at that</p>



<p class="wp-block-paragraph">Your C++ module will make a function call inside of, you know, some assembly module like the one we&#8217;re looking at, assuming it was written a little bit differently.</p>



<p class="wp-block-paragraph">Main finish return.</p>



<p class="wp-block-paragraph">I guess the way it&#8217;s written down here, it&#8217;s returning to main if we just kind of execute it as we&#8217;re looking at it.</p>



<p class="wp-block-paragraph">But another module could could call main finish as a function and still get a return statement.</p>



<p class="wp-block-paragraph">That would actually work, even though it&#8217;s probably bad design.</p>



<p class="wp-block-paragraph">that your assembly sorry your C++ program wants to call a function called</p>



<p class="wp-block-paragraph">main finish inside of this module the linker having already laid out the</p>



<p class="wp-block-paragraph">modules and and being aware of all their offsets it knows okay so you know this</p>



<p class="wp-block-paragraph">assembly module it was underneath the C++ module so it&#8217;ll just take that offset</p>



<p class="wp-block-paragraph">and add it to the offset of the label itself within the module and then also</p>



<p class="wp-block-paragraph">add that to the the virtual address or I guess the operating system will do the</p>



<p class="wp-block-paragraph">address. But you know, the point is the linker coordinates all the jumps and the conditional</p>



<p class="wp-block-paragraph">branches where the functions start, lays out all the modules, gets all the offsets,</p>



<p class="wp-block-paragraph">and then starts replacing all of the conditional branches and jumps and things with the real</p>



<p class="wp-block-paragraph">offsets that make it actually doable. Like let&#8217;s jump to exactly this memory location</p>



<p class="wp-block-paragraph">in code exactly in quotes, because we&#8217;re still using virtual addressing.</p>



<p class="wp-block-paragraph">idea of the linker it knows how to jump between modules um wants to link or discuss okay that&#8217;s</p>



<p class="wp-block-paragraph">all i really wanted to say don&#8217;t forget if you want a label to be available to jump into or to</p>



<p class="wp-block-paragraph">call as a function from outside the module you got to mark it as global so if i actually wanted</p>



<p class="wp-block-paragraph">somebody to be able to call main finish as a function i just have to mark it as global same</p>



<p class="wp-block-paragraph">thing for some label if i say global some label then now at this point another module could call</p>



<p class="wp-block-paragraph">call this as a function or jump into it probably bad form to not put a return a return statement</p>



<p class="wp-block-paragraph">at this point which means when i&#8217;m calling it up here instead of jump not equal to i probably have</p>



<p class="wp-block-paragraph">to add more complicated logic so i can use a function call that gets jumped around if it is</p>



<p class="wp-block-paragraph">equal but so i&#8217;m not going to go that far right now kind of complicated just for this video</p>



<p class="wp-block-paragraph">and then also of course if you intend to jump somewhere else remember that you have to mark</p>



<p class="wp-block-paragraph">So let&#8217;s say there&#8217;s a function in your other module, your C++ module or your C module or your assembly module.</p>



<p class="wp-block-paragraph">You just have to mark it as extern in the text section, in the text segment, like some other function somewhere else, something like that.</p>



<p class="wp-block-paragraph">And then once I do that, now I could actually call it, I could say, call, you know, this.</p>



<p class="wp-block-paragraph">Actually, that&#8217;ll never get reached because the jump equal thing is at the bottom.</p>



<p class="wp-block-paragraph">equal thing is at the bottom but I could do this I could say call it if it was actually a function</p>



<p class="wp-block-paragraph">or I could say jump if it was just a jump point or I could say you know jump not equal to</p>



<p class="wp-block-paragraph">the other function instead of some label something like that so lots of stuff you can do and now you</p>



<p class="wp-block-paragraph">kind of understand the idea of linking is taking all the modules stuffing them inside of the final</p>



<p class="wp-block-paragraph">executable and also putting data inside of the final executable you know like if you&#8217;re creating</p>



<p class="wp-block-paragraph">So, you know, like if you&#8217;re creating a string variable in your globals area of your assembly</p>



<p class="wp-block-paragraph">program or hard coding, any kind of string anywhere in your C++, then it&#8217;s got to be</p>



<p class="wp-block-paragraph">inside of the executable.</p>



<p class="wp-block-paragraph">Otherwise, it wouldn&#8217;t be anywhere when we ran the program.</p>



<p class="wp-block-paragraph">So, yeah, it sticks the data in there.</p>



<p class="wp-block-paragraph">It sticks the segments in there.</p>



<p class="wp-block-paragraph">It, you know, calculates the jumps and all that stuff.</p>



<p class="wp-block-paragraph">I just want to point out you could put strings in a configuration file.</p>



<p class="wp-block-paragraph">of a vanilla C++ or assembly program you probably are making strings directly in the program.</p>



<p class="wp-block-paragraph">Anyway, so I think that&#8217;s the gist of everything that I really wanted to say about what is the</p>



<p class="wp-block-paragraph">general idea of the linker. Thanks for watching this video I hope you learned a little bit and</p>



<p class="wp-block-paragraph">had some fun. I will see you in the next video. Hey everybody thanks for watching this video again</p>



<p class="wp-block-paragraph">it i do hope you did learn something and have some fun if you could do me a please a small little</p>



<p class="wp-block-paragraph">favor could you please subscribe and follow this channel or these videos or whatever it is you do</p>



<p class="wp-block-paragraph">on the current social media website that you&#8217;re looking at right now it would really mean the</p>



<p class="wp-block-paragraph">world to me and it&#8217;ll help make more videos and grow this community so we&#8217;ll be able to do more</p>



<p class="wp-block-paragraph">videos longer videos better videos or just i&#8217;ll be able to keep making videos in general so please</p>



<p class="wp-block-paragraph">and subscribe. You know, sometimes I&#8217;m sleeping in the middle of the night and I just wake up</p>



<p class="wp-block-paragraph">because I know somebody subscribed or followed. It just wakes me up and I get filled with joy.</p>



<p class="wp-block-paragraph">That&#8217;s exactly what happens every single time. So you could do it as a nice favor to me or you</p>



<p class="wp-block-paragraph">could troll me if you want to just wake me up in the middle of the night, just subscribe</p>



<p class="wp-block-paragraph">and then I&#8217;ll just wake up. I promise that&#8217;s what will happen. Also, if you look at the middle of</p>



<p class="wp-block-paragraph">the screen right now, you should see a QR code, which you can scan in order to go to the website,</p>



<p class="wp-block-paragraph">is also named somewhere at the bottom of this video and it&#8217;ll take you to my main website where</p>



<p class="wp-block-paragraph">you can just kind of like see all the videos I published and the services and tutorials and</p>



<p class="wp-block-paragraph">things that I offer and all that good stuff and uh if you have a suggestion for uh uh clarifications</p>



<p class="wp-block-paragraph">or errata or just future videos that you want to see please leave a comment or if you just want to</p>



<p class="wp-block-paragraph">say hey what&#8217;s up what&#8217;s going on you know just send me a comment whatever I also wake up for</p>



<p class="wp-block-paragraph">I wake up in a cold sweat and I&#8217;m like, it would really mean the world to me.</p>



<p class="wp-block-paragraph">I would really appreciate it.</p>



<p class="wp-block-paragraph">So again, thank you so much for watching this video and enjoy the cool music as I fade into</p>



<p class="wp-block-paragraph">the darkness, which is coming for us all.</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/how-linkers-work-linking-code-virtual-memory-and-module-jumps-explained/">How Linkers Work: Linking Code, Virtual Memory, and Module Jumps Explained</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/how-linkers-work-linking-code-virtual-memory-and-module-jumps-explained/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
