TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

I'm 17 and wrote this guide on how CPUs run programs

1337 pointsby archmasteralmost 2 years ago

77 comments

archmasteralmost 2 years ago
Hi! I&#x27;m Lexi, I wrote this article&#x2F;mini-book.<p>There&#x27;s a classic question of &quot;what happens when you load a website?&quot;, but I&#x27;ve always been more interested in &quot;what happens when you run a program?&quot;. About 3 months ago, I was really annoyed at myself for not knowing how to answer that question so I decided to teach myself.<p>I taught myself everything else I know in programming, so this should be easy, right? NOPE! Apparently everything online about how operating systems and CPUs work is <i>terrible</i>. There are, like, no resources. Everything sucks. So while I was teaching myself I realized, hey, I should make a really good resource myself. So I started taking notes on what I was learning, and ended up with a 60-page Google Doc. And then I started writing.<p>And while I was writing, it turned out that most of the stuff in that giant doc was wrong. And I had to do more research. And I iterated and iterated and iterated and the internet resources continued to be terrible so I needed to make the article better. Then I realized it needed diagrams and drawings, but I didn&#x27;t know how to do art, so I just pulled out Figma and started experimenting. I had a Wacom tablet lying around that I won at some hackathon, so I used that to draw some things.<p>Now, about 3 months later, I have something I&#x27;m really proud of! I&#x27;m happy to finally share the final version of Putting the &quot;You&quot; in CPU, terrible illustrations and all. I built this as part of Hack Club (<a href="https:&#x2F;&#x2F;hackclub.com" rel="nofollow noreferrer">https:&#x2F;&#x2F;hackclub.com</a>), which is a community of other high schoolers who love computers.<p>It was cool seeing some (accidental) reception on HN a couple weeks ago while this was still a WIP, I really appreciated the feedback I got. I took some time to substantially clean it up and I&#x27;m finally happy to share with the world myself.<p>The website is a static HTML&#x2F;CSS project, I wrote everything from scratch (I&#x27;m especially proud of the navigation components).<p>I hope you enjoy, and I hope that this becomes a resource that anyone can use to learn!
评论 #37063390 未加载
评论 #37067101 未加载
评论 #37063112 未加载
评论 #37064335 未加载
评论 #37066739 未加载
评论 #37068971 未加载
评论 #37064143 未加载
评论 #37065983 未加载
评论 #37064737 未加载
评论 #37066667 未加载
评论 #37062883 未加载
评论 #37065812 未加载
评论 #37063533 未加载
评论 #37064815 未加载
评论 #37065947 未加载
评论 #37067217 未加载
评论 #37066234 未加载
评论 #37063620 未加载
评论 #37064340 未加载
评论 #37085162 未加载
评论 #37066649 未加载
评论 #37064416 未加载
评论 #37070898 未加载
评论 #37066571 未加载
评论 #37070612 未加载
评论 #37075521 未加载
评论 #37065902 未加载
评论 #37064516 未加载
评论 #37065504 未加载
评论 #37068311 未加载
评论 #37067344 未加载
评论 #37063557 未加载
评论 #37071691 未加载
评论 #37066650 未加载
评论 #37065076 未加载
评论 #37068151 未加载
评论 #37073894 未加载
ggambettaalmost 2 years ago
Very nicely written, and congrats on doing such a deep dive on this kind of topic.<p>These days 17 year olds can get away with &quot;programming&quot; by gluing things they don&#x27;t understand, but I think they&#x27;ll eventually hit a ceiling. So what you&#x27;re doing is super valuable, not for yourself, but for everyone else who will learn from your materials.<p>Well done :)<p>EDIT: now go write an emulator if you haven&#x27;t already, it&#x27;s a ton of fun :)
评论 #37062587 未加载
评论 #37062835 未加载
评论 #37064972 未加载
评论 #37065030 未加载
评论 #37062979 未加载
评论 #37063033 未加载
评论 #37064776 未加载
js2almost 2 years ago
Congrats on completing this guide.<p>&gt; There aren&#x27;t many comprehensive systems resources if you aren&#x27;t going to college, so I had to sift through tons of different sources of varying quality and sometimes conflicting information.<p>The absolutely best resource you will find is Charles Petzold&#x27;s <i>Code: The Hidden Language of Computer Hardware and Software</i>. The 2nd edition was just released.<p><a href="https:&#x2F;&#x2F;codehiddenlanguage.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;codehiddenlanguage.com&#x2F;</a>
评论 #37064952 未加载
评论 #37072577 未加载
评论 #37062985 未加载
评论 #37064670 未加载
diarrheaalmost 2 years ago
This is on my reading list. This little bit sold me on it in the past:<p>&gt; <i>The bottom of every page is padded so readers can maintain a consistent eyeline.</i><p>Such a <i>tiny</i> and, in hindsight, obvious detail. It&#x27;s surprisingly pleasant. When I noticed that, I knew I had a passion project in front of me.
评论 #37063437 未加载
alaintnoalmost 2 years ago
I&#x27;m almost 40 years old, and I&#x27;ve never accomplished something like this. I was just about to cope about my impostor syndrome. Well, I guess I need to cope more!<p>Great job :p
评论 #37067879 未加载
ranting-mothalmost 2 years ago
OP, don&#x27;t excuse your work by prefixing it with your age. Your write-up is better than most people will ever do. Nice work!
评论 #37067211 未加载
评论 #37069264 未加载
评论 #37065073 未加载
评论 #37071999 未加载
评论 #37066640 未加载
评论 #37069548 未加载
brunoolivalmost 2 years ago
Damn. If you&#x27;re producing this type of content at 17, I can&#x27;t even imagine the amazing things you&#x27;ll be able to do it you choose to pursue the field professionally. Absolutely amazing!!
评论 #37071708 未加载
GuestHNUseralmost 2 years ago
OP, you should take a look at Casey Muratori&#x27;s course at computerenhance.com<p>The first part of the course&#x27;s homework creates a simulator of the 1978 intel 8086 (which modern x86_64 assembly still closely resembles). You will learn a lot of things about computers that are really difficult to find elsewhere.
评论 #37066435 未加载
needlesslygrimalmost 2 years ago
As a fellow (very nearly) 17 year old, good job! :^) Just 20 minutes ago I was trying to figure out how to extract the first byte of a 16 bit integer and finding out about Endianness, and you&#x27;re writing a whole book about CPUs! I&#x27;ll make sure to read this once I&#x27;ve finished Crafting Interpreters, although it may take a while since progress with that has certainly slowed down (as it does with many of my other projects lol).
t0b1almost 2 years ago
That‘s a very nice writeup, I like the style. The mix of text to illustrations&#x2F;memes was really pleasent. I have my reservations about the RISC&#x2F;CISC nomenclature but I guess that‘s „each to their own“ &gt;.&gt;<p>As someone who has spent some time figuring out how parts of the kernels work I can sympathize with the pain it probably was (but well worth it given the article imo).<p>For NT, I think that Windows Internals covers a lot about the stuff one wants to know and Microsoft‘s documentation is also not bad (certainly better than Linux‘s kernel docs imo); it‘s a really good starting point.<p>For more info about Windows I can recommend gamehacking forums&#x2F;resources. There‘s a lot of filtering needed but they are a pretty good source of info for niche things sometimes.<p>As a last note, I noticed that the font of some code blocks are pretty large when viewed on my smartphone making them hard to read (e.g. Ch. 6&#x2F;main.c)<p>P.S.: &gt; If you are a teenager and you like computers and you are not already in the Hack Club Slack, you should join right now<p>Way too remind me that I‘m getting old lol
nrabulinskialmost 2 years ago
As someone who has worked a bunch with debugging Linux itself, debugging qemu, and vulnerabilities in kernel and userspace, I really struggle to appreciate stuff like this because my initial reaction is “well, duh, of course that’s how it works” but looking back at myself getting into those fields I really applaud you and thank you for creating this great content
HocusLocusalmost 2 years ago
You are a very skilled technical writer. One way to discern this is asking at a given point, &quot;What question just likely popped into their mind after what they have read?&quot; (you don&#x27;t have to be right, just close) ... and importantly, &quot;Do they need a little break from the main outline?&quot; Your brief tangents in light blue are a perfect answer to both questions. Your terminal examples show what things really look like, or how they appear to people who work with the code every day. Your narrative glue shows impeccable grammar and flow. Don&#x27;t try to change your style one bit, let it change itself over time.<p>Never went to college or high school. When I was 17 in 1981 and had been already been deep diving into several different types of computer systems over 3 years, I would have died to read what you have written, just the way it is written. It would have answered so many questions directly, fortunately I sometimes had other peoples&#x27; code to look at (and Vector Graphic actually included commented Z80 assembler for their entire BIOS in the manual, many pages!) but when you are short on examples to look at, that&#x27;s when the real disillusionment sets in. I love today&#x27;s world, one is only a few keywords away from great examples. The challenge is to present them in a way that someone reading puts it all together and becomes excited about understanding.<p>Great work!
评论 #37088231 未加载
评论 #37105488 未加载
spepsalmost 2 years ago
Actual guide link: <a href="https:&#x2F;&#x2F;cpu.land&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;cpu.land&#x2F;</a>
评论 #37062666 未加载
alargealmost 2 years ago
This is so cool! And I&#x27;m dismayed that you have been subjected to the typical Hacker News cynicism.<p>By looking through some of your other project and interests, I can see that you likely have a healthy sense of your own capabilities and certainly don&#x27;t need my validation or approbation. But I&#x27;m going to give it anyway.<p>Piffle on anyone who knocks you on tone! It is not trivial to make this level of technical information available in such an approachable fashion. When we first start our careers, detailed technical knowledge and the ability to solve low-level problems are super important. But the way you &quot;crawl up the value chain&quot; in software engineering is to become a &quot;force multiplier&quot; - someone who can make other people more productive. And the ability to communicate well (both <i>what</i> to communicate and <i>how</i> to communicate it) becomes a more and more important skill. This work clearly demonstrates your communication skills.<p>I hope you make software engineering your career choice. The field could use more people like you.
dghughesalmost 2 years ago
Going down the Rabbit Hole is fun for any subject you learn a lot. For electronics I went down the hole power, current and voltage, EMF, magnetism, ferromagnetic metals, domains (as in magnetic area no networking i.e. electron alignment), virtual electrons, physics, quantum mechanics...<p>Similar for computers you see the high level stuff but then you can go right down to the wire level where bits are voltages +5&#x2F;-5&#x2F;0V and clock timing.<p>Although being too curious can be bad thing. You have to know when to stop or where to start. I think we&#x27;ve all heard stories of people troubleshooting who are very intelligent. They&#x27;re tearing into a problem down to the hardware level or going over code line by line when all they needed to do was reboot.
评论 #37064770 未加载
评论 #37064649 未加载
ChrisArchitectalmost 2 years ago
[dupe]<p>The other link for this is cpu.land -- stick to your &#x27;official&#x27; urls! -- shared and discussed a few weeks ago<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36823605">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36823605</a>
kazinatoralmost 2 years ago
The guide is stuck in some false then versus now thinking.<p>A preemptible kernel isn&#x27;t &quot;modern&quot;. Cooperative multitasking isn&#x27;t &quot;old&quot;.<p>These are just choices in the design space that can be relevant at any time.<p>Fully preempted real-time operating systems existed many decades ago.<p>Meanwhile, today, there seems to be a renewed interest today in coroutines and fibers and such, and they are showing up in programming languages. Those mechanisms are forms of cooperative multitasking.<p>If you need an embedded system to do a few simple things, why would you threaten its stability with preemptive, interrupt-driven task switching?
not_the_fdaalmost 2 years ago
This is really great. There are many developers with decades of experience that don&#x27;t understand these things.
评论 #37065442 未加载
linux2647almost 2 years ago
&gt; The envp argument contains another null-terminated list of environment variables used as context for the application. They’re… conventionally KEY=VALUE pairs. Conventionally.<p>TIL! It seems a lot of (newer) programming languages make this assumption.<p>&gt; …I love computers.<p>Me too, kid. Me too.
hotsauceroralmost 2 years ago
Hey. Nice work! I really enjoyed reading this. This is the kind of sensible, from-the-beginning writeup that I wish I&#x27;d had way back in the day when I first got started. It&#x27;s a nice synthesis of a large amount of complicated information, and builds a good mental model for someone who isn&#x27;t looking for a PhD-level understanding. I remember not truly understanding how, when I would load a program on my Commodore 64, &quot;yeah but how does it actually know to run? All I did was read some data from disk and then it just, like, went.&quot; This would have provided exactly that kind of understanding.<p>Anyway, good on you. Your article was a real pick-me-up, it makes me happy to see this out there, from young folks. I enjoyed the hell out of it, and I hope you enjoyed creating it.
评论 #37076039 未加载
lagniappealmost 2 years ago
This is great work :) thanks for sharing it with us. Unexpected Linkin Park bit at the end was nice, but now I&#x27;m wondering if Linkin Park is now considered &#x27;oldies&#x27;
评论 #37062582 未加载
评论 #37062588 未加载
评论 #37062637 未加载
评论 #37062708 未加载
hgharalmost 2 years ago
This is a really cool project, kind of touches a point about the history of computers as we know them now, a wealth of information can be found on classic books such as “The art of computer programming” by Knuth, this is more related to how things work now which has changed a lot over the years but the basics are still there.
keithnzalmost 2 years ago
Great effort, but really still needs a bunch of work. In some places the sentences just don&#x27;t make sense. I think in terms of CPU, a good starting point is the Von Neumann architecture which most computers are designed around.<p>The current description of CPUs mix things up with OS concepts. You may want to look into things like memory management units ( MMU ) that builds on the basic Von Neumann architecture to provide &quot;virtual memory&quot; such that an OS can use it to provide process isolation that OS&#x27;s can use. Also the more capable CPUs have what are often called &quot;modes&quot; (protected mode in x86, ARM have a similar thing) to isolate running programs from each other and be able to create rings for things like kernels and device drivers.
评论 #37100941 未加载
评论 #37070958 未加载
asynchronousalmost 2 years ago
Would just like to comment that the presentation is top notch, really appreciate the level of detail put into it.
charcircuitalmost 2 years ago
This site doesn&#x27;t explain how CPUs run programs. It only explained the instructions that CPUs will run and some abstractions on top of that, but not how CPUs typically run those instructions.
jack_rimintonalmost 2 years ago
Nice one. You&#x27;ll go far. Especially if you ignore the cranky resentful people on here
dreamcompileralmost 2 years ago
Great job! I&#x27;m an expert but you were right: I learned some things from Chapter 3.<p>A couple of very minor points:<p>&quot;The first mass-produced CPU was the Intel 4004, designed in the late 60s by an Italian physicist and engineer named Federico Faggin.&quot;<p>The first <i>microprocessor</i> (CPU on a single chip) was Faggin&#x27;s Intel 4004, but mass-produced CPUs existed before that. Earlier CPUs were built from multiple chips, and before that multiple individual transistors, and before that multiple vacuum tubes, and before that multiple relays (although it&#x27;s fair to say that relay computers were never mass-produced).<p>&quot;The CPU stores an instruction pointer which points to the location in RAM where it’s going to fetch the next instruction.&quot;<p>This is also called the Program Counter or PC outside the Intel universe. This is confusing as &quot;PC&quot; also stands for &quot;Personal Computer&quot; but people who learned computing in the days before Intel became popular still call it the PC register.
评论 #37076096 未加载
lordnachoalmost 2 years ago
What&#x27;s your advice on how to teach programming to my kid? Curious to hear what another young person thinks. Kid is 11, has all the basics, knows how to type, knows how to open a terminal.<p>What things did you think were important to learn, what kinds of things motivated you most? What did you do when you got stuck?
评论 #37062818 未加载
评论 #37062841 未加载
评论 #37065068 未加载
nklymokalmost 2 years ago
Hi! Great job! I really enjoyed reading this mini-book and I&#x27;m recommending my friends in college to read it. It mentions a lot of topics that we studied during an &quot;Operating Systems&quot; course.<p>We don&#x27;t have HackClub here where I live, thus I never heard of it, but what they do sounds awesome and inspires me to promote it or even start it here (especially since there&#x27;s no HackClub in Ukraine).<p>Thank you for sharing this experience, it was one of the best reads I had in a while!
rvzalmost 2 years ago
Fantastic work by the author. The best part:<p>&gt; I talked to GPT-3.5 and GPT-4 a decent amount while writing this article. While they lied to me a lot and most of the information was useless, they were sometimes very helpful for working through problems. LLM assistance can be net positive if you’re aware of their limitations and are extremely skeptical of everything they say. That said, they’re terrible at writing. Don’t let them write for you.<p>Good. Thank you for disclosing this.<p>Great to know that even teenagers like the author know the limits of LLMs and know where and when to use them and haven&#x27;t fallen into the hype and mania in blindly trusting them, unlike the millions of so-called new wave of <i>&#x27;AI startups&#x27;</i> out there.<p>Once again, fantastic work and keep it up.
bfay1almost 2 years ago
I was about halfway through chapter 3 and thought to myself, &quot;I haven&#x27;t listened to In the End by Linkin Park in a while, let&#x27;s spin that up&quot;. my reaction when I scrolled down ten seconds later...XD
wkjagtalmost 2 years ago
The best resource I&#x27;ve found so far that helped me understand how computers &#x2F; CPUs work, is Ben Eater&#x27;s work. Both his 6502 computer, and 8-bit CPU series are amazing.<p>Looking forward to reading your guide. Thanks for sharing!
asdefghykalmost 2 years ago
&quot;... run programs ....&quot; can be considered at a number of (abstract) levels, until the lowermost level is reached , which is machine language. ( Actually, the preceding statement is not correct , since there is often, [ but not all ways] CPU micro code , below Machine language. Machine language is assembly language translated into ones and zeros , that is loaded into the CPU. CPU microcode is a language used to control the internal CPU logic to execute the machine language.
JSavageOnealmost 2 years ago
Wow this is amazing. The writing is actually really good too, I love how personable it is, in contrast with a dry boring textbook.<p>Love it, and wish I had this drive at your age.
kaycey2022almost 2 years ago
This is awesome with such good presentation. Well done!<p>I would also recommend the linux programming interface book for those looking for a very in depth introduction to this topic.
878654Tomalmost 2 years ago
What a lovely guide and the best part is that it is a genuine guide.<p>Many articles posted on the internet are meant for one thing, guide a user to buy a certain service or product. But after reading the whole guide I only had the feeling of someone wanting to share knowledge.<p>The hackclub also seems to be a very interesting organisation and I hope more and more teenagers will join you guys and contribute to society as you have contributed by making this guide.
rrr83almost 2 years ago
Very nice work and I am going to save this copy for my 6 years old daughter! Keep it up with your creative skills and deep learning!
Dweditalmost 2 years ago
Then there&#x27;s the OTHER side, Flipflops, MUXes, ALUs, register files, combinational logic, yadda yadda, then you have your CPU.
WC3w6pXxgGdalmost 2 years ago
This is fantastic. Great job! I like the easier to comprehend language than what you typically find when reading information about this stuff (wikipedia is one of the worst...).<p>You&#x27;d probably like Nand2Tetris. To be frank, I never finished it (it&#x27;s so long!), but building a CPU from scratch was insightful (at the time - I don&#x27;t remember much now, sadly).
randombits0almost 2 years ago
I love this! Maybe dive a little deeper? Like, what happens from power on to login prompt. Like, power good &gt; get instruction from predetermined address &gt; execute (BIOS code) &gt; init hardware &gt; change to protected mode &gt; load OS, etc.<p>Different cpus are different, of course, but they all go through a similar start up sequence. Again, nicely done.
phkahleralmost 2 years ago
&quot;After executing an instruction, the pointer moves forward to immediately after the instruction in RAM so that it now points to the next instruction.&#x27;<p>What is a pointer? How does it &quot;move&quot; inside the computer? This is low level stuff, but still probably somewhat mysterious to the layman.<p>Never mind the obscurity of the word &quot;syntax&quot;.
评论 #37071199 未加载
tornato7almost 2 years ago
Halfway through part one and I&#x27;m hooked! Thanks for writing this. It&#x27;s something I didn&#x27;t know I needed.
scubboalmost 2 years ago
Very nice guide! I love your writing style, and your research skills are clearly top-notch. Great stuff!<p>You might enjoy reading some articles by Julia Evans (<a href="https:&#x2F;&#x2F;jvns.ca&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;jvns.ca&#x2F;</a>), who has a similar informal, conversational, exploratory style.<p>Stay curious!
评论 #37071776 未加载
adam_oxlaalmost 2 years ago
Amazing article. I have not seen such a comprehensive guide yet. Although when I have seen the title I was expecting it would be focused more on CPU inner workings: superscalar pipelines, frontend, backend, instruction fusing, memory banks, instruction cache, branch prediction, instruction reordering etc.
scovettaalmost 2 years ago
I read through the first couple parts, this is exceptionally well written, clear, and AFAICT, accurate. Nicely done.
max23_almost 2 years ago
Recognize OP is the same author for water.css. Thank you for this good writeup on how things work internally.
yakkomajurialmost 2 years ago
This is awesome, and so is your website. Programming, writing, flying, music, that &#x27;s wild. Congrats!
评论 #37063412 未加载
globular-toastalmost 2 years ago
Looks like a cool guide. Something seems off about this, though. Can&#x27;t quite put my finger on it.
nemo44xalmost 2 years ago
I thought it’d be lower level as it’s still very abstract and more of an operating systems guide than a guide on how CPUs physically run programs. Like how a string of current representing 1s and 0s allows the CPU to do certain things, etc.<p>But well organized none the less!
demizeralmost 2 years ago
Kid, first of all great job! Second of all I am jealous you understand this as such a young age. I was pounding 40 ounces of Old English in the hood at 17, but should have doing something like this. Granted, the internet was just a baby when I was 17.
bedersalmost 2 years ago
I like that Gen-Z. Back to the basics! Listening to 80s music! Go younglings, go!
morjomalmost 2 years ago
I wish I was taught these things in my basic degree. Thank you for the writeup
lakomenalmost 2 years ago
When I was 11 I coded in assembly and machine language, what do I win?
评论 #37072233 未加载
评论 #37069660 未加载
rohinbhargalmost 2 years ago
Seriously impressive, I&#x27;m 27 and I didn&#x27;t know half the stuff you put in this guide.
Southworthalmost 2 years ago
This is really, really awesome. Excellent work. You’ve a bright career in front of you, I reckon.
0x978almost 2 years ago
Wow, found your github from this and getting insane imposter syndrome haha, very impressive work
评论 #37063989 未加载
tails4ealmost 2 years ago
Nicely done, congrats. A really good reference, and the style and flow is very nice.
tech_kenalmost 2 years ago
Wow what incredible timing, I was just looking for something like this yesterday!
osclartoalmost 2 years ago
wow 17! excellent work. You&#x27;re going places for sure if you keep this up. I would guess even most working Devs don&#x27;t have any real concept of how things work at the CPU level let alone during high school.
hughesjjalmost 2 years ago
This is legit, nice work! I&#x27;m going to link this to some friends
NuSkooleralmost 2 years ago
I&#x27;ve only skimmed so far, but this looks really great. Good work!
petecogalmost 2 years ago
Very nicely written. Great work! I&#x27;m passing it around. Thanks
stodor89almost 2 years ago
Awesome! All I could do at 17 was chase skirt and get drunk.
xivusralmost 2 years ago
You&#x27;ve found your calling! Keep up the amazing work.
yveezyalmost 2 years ago
Yo this is fantastic! Keep doing work like this :-)
racl101almost 2 years ago
Very cool.<p>What a novel way to show your skills to employers.
bityardalmost 2 years ago
I&#x27;m 43 and wanted to say nice work.
jononomoalmost 2 years ago
How much help did you get from GPT-4?
评论 #37071278 未加载
fredfoobaralmost 2 years ago
Where did you hear Linkin Park?
评论 #37066332 未加载
ec965almost 2 years ago
computers are _so cool_ :)
elSidCampeadoralmost 2 years ago
Nicely done!
headlinealmost 2 years ago
Great work!
1letterunixnamealmost 2 years ago
:x86:<p>Apart from the drawing boards at Intel when the 80286 was designed, can anyone find any evidence or have first-hand experience that rings 1 and 2 were ever used in any specific commercial purpose? (I haven&#x27;t heard or seen of it.) 286 protected mode was generally a flop (outside of OS&#x2F;2), while 386 protected mode was significantly better. The LDTR (-&gt; LDT) and hardware task switching (reloading TR) aren&#x27;t typically used. GDTR (-&gt; GDT), TR (-&gt;TSS) and IDTR (-&gt;IDT) setup are essential.<p>The TSS includes where to find the 6-7 stacks, and for a permissions mask for port I&#x2F;O.<p>Double fault handler (in the IDT -&gt; INT 8) is typically what leads to a colorful screen of death. When the double fault handler fails (or the IDT or was overwritten), a triple fault happens and the CPU halts or the virtual machine does it own impression of a colorful screen of death without (usually) actually killing the host machine.<p>An invalid opcode handler permits handling CPU-unknown opcodes in the OS such as using emulation or other hardware.<p>Note that generally most PCs prior to UEFI&#x2F;EFI booted in real mode with 1 core running, so writing a parallel and concurrent OS typically involves setting up protected mode structures, switching to protected mode, and then talking to the APIC for every other core.<p>Resources:<p><a href="https:&#x2F;&#x2F;sandpile.org" rel="nofollow noreferrer">https:&#x2F;&#x2F;sandpile.org</a><p><a href="http:&#x2F;&#x2F;ref.x86asm.net&#x2F;geek64.html" rel="nofollow noreferrer">http:&#x2F;&#x2F;ref.x86asm.net&#x2F;geek64.html</a><p><a href="https:&#x2F;&#x2F;cdrdv2.intel.com&#x2F;v1&#x2F;dl&#x2F;getContent&#x2F;671200" rel="nofollow noreferrer">https:&#x2F;&#x2F;cdrdv2.intel.com&#x2F;v1&#x2F;dl&#x2F;getContent&#x2F;671200</a><p><a href="https:&#x2F;&#x2F;www.intel.com&#x2F;content&#x2F;www&#x2F;us&#x2F;en&#x2F;docs&#x2F;intrinsics-guide&#x2F;index.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.intel.com&#x2F;content&#x2F;www&#x2F;us&#x2F;en&#x2F;docs&#x2F;intrinsics-guid...</a><p><a href="https:&#x2F;&#x2F;www.amd.com&#x2F;en&#x2F;support&#x2F;tech-docs&#x2F;amd64-architecture-programmers-manual-volumes-1-5" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.amd.com&#x2F;en&#x2F;support&#x2F;tech-docs&#x2F;amd64-architecture-...</a><p>SVGA&#x2F;VGA&#x2F;EGA<p><a href="https:&#x2F;&#x2F;wiki.osdev.org&#x2F;Expanded_Main_Page" rel="nofollow noreferrer">https:&#x2F;&#x2F;wiki.osdev.org&#x2F;Expanded_Main_Page</a><p><a href="http:&#x2F;&#x2F;www.osdever.net&#x2F;FreeVGA&#x2F;home.htm" rel="nofollow noreferrer">http:&#x2F;&#x2F;www.osdever.net&#x2F;FreeVGA&#x2F;home.htm</a><p><a href="https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;gpbb20&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;gpbb20&#x2F;</a><p><a href="https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;programmersguidetotheegavgaandsupervgacardsbyrichardf.ferraro19943rdedition&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;programmersguidetotheegavgaandsu...</a><p>System management<p><a href="https:&#x2F;&#x2F;wiki.osdev.org&#x2F;Symmetric_Multiprocessing" rel="nofollow noreferrer">https:&#x2F;&#x2F;wiki.osdev.org&#x2F;Symmetric_Multiprocessing</a><p><a href="https:&#x2F;&#x2F;pdos.csail.mit.edu&#x2F;6.828&#x2F;2018&#x2F;readings&#x2F;i386&#x2F;s09_08.htm" rel="nofollow noreferrer">https:&#x2F;&#x2F;pdos.csail.mit.edu&#x2F;6.828&#x2F;2018&#x2F;readings&#x2F;i386&#x2F;s09_08.h...</a> &lt;- CPU fault handlers<p><a href="https:&#x2F;&#x2F;ctyme.com&#x2F;rbrown.htm" rel="nofollow noreferrer">https:&#x2F;&#x2F;ctyme.com&#x2F;rbrown.htm</a><p><a href="https:&#x2F;&#x2F;wiki.osdev.org&#x2F;UEFI" rel="nofollow noreferrer">https:&#x2F;&#x2F;wiki.osdev.org&#x2F;UEFI</a><p>USB<p><a href="https:&#x2F;&#x2F;beyondlogic.org&#x2F;usbnutshell&#x2F;usb1.shtml" rel="nofollow noreferrer">https:&#x2F;&#x2F;beyondlogic.org&#x2F;usbnutshell&#x2F;usb1.shtml</a><p>Emulators<p><a href="https:&#x2F;&#x2F;www.qemu.org" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.qemu.org</a> (qemu-system-x86_64 or qemu-system-i386 for very retro)<p>You&#x27;ll usually want to create an ELF32x64 binary kernel image that&#x27;s a bit of real mode, ia32 and then switches to 64-bit registers mostly (ia32e [amd64&#x2F;x86_64]).
skizmalmost 2 years ago
Meta point: I&#x27;m curious of people&#x27;s thoughts when OPs in general post &quot;I&#x27;m N years old...&quot; or &quot;I&#x27;m a blind programmer who...&quot; before posting something unrelated to their life situation. Personally I think this falls into the &quot;girls do not exist on the internet&quot; rule of thumb. No reason to state that you&#x27;re a girl (or 12 years old or whatever) other than to prime people to look upon your writing with lower standards. I think it is fine to mention your situation in passing or as a footnote if it is interesting, but unsure it really adds anything to lead with it (personally I think it detracts).<p>That&#x27;s just my opinion. Anyone else have thoughts?<p>FWIW this seems pretty well written from just skimming the intro and a bit of chapter 3.<p>Edit: sorry I did not mean for this to be the top comment and push OP down so far. The writing here is really good and folks should definitely click through and at least give it a skim if they&#x27;re interested. I was just curious what people&#x27;s thoughts were on this topic.
评论 #37062974 未加载
评论 #37063108 未加载
评论 #37062884 未加载
评论 #37063393 未加载
评论 #37063081 未加载
评论 #37062971 未加载
评论 #37062854 未加载
评论 #37063281 未加载
评论 #37062912 未加载
评论 #37062995 未加载
评论 #37063096 未加载
评论 #37063196 未加载
评论 #37062873 未加载
评论 #37062844 未加载
评论 #37064745 未加载
评论 #37063287 未加载
评论 #37062988 未加载
评论 #37063407 未加载
评论 #37063303 未加载
评论 #37063374 未加载
评论 #37063545 未加载
评论 #37062870 未加载
评论 #37063049 未加载
评论 #37062984 未加载
评论 #37063248 未加载
评论 #37063342 未加载
bobboiesalmost 2 years ago
The only thing is I hate titles like this—the title is bragging a bit too much.<p>Maybe a title more like:<p>“How I’m helping my high school peers learn about CPUs”.<p>That way it implies you’re young, smart, and care about others—all of which I imagine are true :)
评论 #37065039 未加载
评论 #37064826 未加载
评论 #37062981 未加载
评论 #37063512 未加载
ChrisArchitectalmost 2 years ago
What happened to the Show HN: on this?
评论 #37065223 未加载
lfkdevalmost 2 years ago
Wow, so because you&#x27;re 17 we should click on this article? I was 17 also some time ago
评论 #37065245 未加载
评论 #37063195 未加载
评论 #37063092 未加载