Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,183,280 members, 7,920,047 topics. Date: Tuesday, 13 August 2024 at 06:29 PM

Rant On Operating System Stuff. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Rant On Operating System Stuff. (518 Views)

The Man Who Created An Operating System / Can I Learn Programming With A 32-bit Operating System? / Reasons Why RAM Is So Important To A Computer Operating System (2) (3) (4)

(1) (Reply) (Go Down)

Rant On Operating System Stuff. by Nobody: 6:10pm On Aug 14, 2020
Yah it's just a rant. Have you ever wondered, how the hell does an OS work? What the hell is happening under the hood of all those nice apps? If you were wondering, I'm a little jobless so I decided to just post about it a little, because I have a deep love for teaching, too bad I'm still an undergraduate who has no hope of entering the university (I'm a pessimist by the way) well let's begin.
First when you hit the power button (or rather tap the choice is yours) the system does something called a POST (Power On Self Test) which checks all the drivers and normal stuff wired to your system then after that the CPU starts running code at a fixed location on the RAM and that fixed location happens to have the BIOS (Basic Input Output System) which does some setup like starting up disk drives and the rest, it is actually located on a ROM chip either hardwired/soldered on to your motherboard or just fixed into a socket (not sure if this is still done) that chip is directly wired to a location in the RAM memory. Now after everything the BIOS sees all is well, no spoilt hardware and all, the BIOS searches the drives for a good bootloader, Now what is a bootloader you might ask? It's just a small program that loads the kernel (the heart of the operating system) on to the RAM. Now that so called good bootloader must confirm to a certain standard which is small, that is it must be a) a flat binary b) it's 511th byte must be equal to 170 (0xaa in hexadecimal) and 85 (0x55), it checks the disk in the CD drive, then the floppy disk (if you have one) then the hard drive (note that this is not the correct sequence), if it found one it loads it, if not it prints a "No bootable disk found..." error and leaves the choice up to you to reboot or throw your system away, your choice (though seeing this error when you know you have your os on your hard drive can cause a heart attack, take heart if that ever happens).
Let's say it finds one it loads it at the location on the RAM 0x7c00 (do the conversion yourself) and uses a jump instruction to direct the CPU to start executing from that location. This is where responsibility transfers to the OS developers, if your bootloader or kernel which will be loaded later has an issue, the best thing that could happen is a reset, the worst undecidedundecided maybe a dead hard driver (still one of the best possibilities) or even worst of all a dead chunk of metal for a computer, it won't be able to boot again. Now the bootloader also has one more standard I forgot, it must be 512 bytes sucks right, and it must be written in assembly (a nice but still arcane form of machine code, 0s and 1s) gringringrin. This is why bootloaders usually have two parts, the first is just there to transfer control to the second part. The bootloader switches the CPU to protected mode (which I will touch in another post if I feel motivated to write one) and activates the a20 line (which I will touch too in that post) I won't go into detail though, I will just scratch the surface in all posts about this stuff (believe me it's ugly underneath).
So you've got it, a little about OSes, hope you feel a little smarter now, but don't be fooled, OS development is really hard, it's not easy to try to write code that actually works on hardware straight which is why companies that write OSes should be commended for the hard work (except Windows for making OSes that love wiping out hard drives undecided ). See you in another post, maybe.

EDITED:
This only applies to Intel x86 systems, back when Intel started this tradition of booting, they hadn't signed a Warsaw pact with AMD, it does not apply to AMD or any other CPU out there. And most definitely it doesn't apply to a phone.

3 Likes 1 Share

Re: Rant On Operating System Stuff. by vheckthor1: 11:18pm On Aug 14, 2020
Nice write up, Linux OS is still my favourite
Re: Rant On Operating System Stuff. by Nobody: 10:05am On Aug 15, 2020
vheckthor1:
Nice write up, Linux OS is still my favourite
Yah thanks me too.
Re: Rant On Operating System Stuff. by valzey(m): 3:05pm On Aug 15, 2020
I acknowledge that Linux is useful but I cannot put it in my personal computer as a daily driver, not even dual boot. If I have any use for it, I use a vm since wsl is far from perfect yet.
Every problem you encounter in your installation will definitely be a pain. You'll be forced to learn a whole lot of stuff just to solve the problem.
From UEFI/Bios - > boot order -> Grub bootloader -> kernel headers - > apt-get update && upgrade - > dkms driver loading - > Gnome/Xfce -> ntfs-3g... It never truly ends.

Restart does not solve problems there.

I'm just a simple guy who wants to live a simple life without unnecessary complications.
Re: Rant On Operating System Stuff. by Nobody: 3:09pm On Aug 15, 2020
valzey:
I acknowledge that Linux is useful but I cannot put it in my personal computer as a daily driver, not even dual boot. If I have any use for it, I use a vm since wsl is far from perfect yet.
Every problem you encounter in your installation will definitely be a pain. You'll be forced to learn a whole lot of stuff just to solve the problem.
From UEFI/Bios - > boot order -> Grub bootloader -> kernel headers - > apt-get update && upgrade - > dkms driver loading - > Gnome/Xfce -> ntfs-3g... It never truly ends.

Restart does not solve problems there.

I'm just a simple guy who wants to live a simple life without unnecessary complications.
Get an Ubuntu distro nah. It's just like windows on top of Linux you won't have to go through all those.
Re: Rant On Operating System Stuff. by valzey(m): 5:54pm On Aug 15, 2020
SegFault:

Get an Ubuntu distro nah. It's just like windows on top of Linux you won't have to go through all those.
It's just that I don't have any reason to go there. It was excitement and adventure then, now I'm older. I need a simple life and my games.

I even looked the hackintosh direction, dualbooted mac os yosemite, el capitan and Sierra on my laptop with clover bootloader. Found no value in them and wiped them. Though I learnt how mac operates during that time. C/C++ binaries I compiled using gcc and cmake on mac worked directly on Linux.
Re: Rant On Operating System Stuff. by Nobody: 9:44am On Aug 16, 2020
valzey:

It's just that I don't have any reason to go there. It was excitement and adventure then, now I'm older. I need a simple life and my games.

I even looked the hackintosh direction, dualbooted mac os yosemite, el capitan and Sierra on my laptop with clover bootloader. Found no value in them and wiped them. Though I learnt how mac operates during that time. C/C++ binaries I compiled using gcc and cmake on mac worked directly on Linux.
I understand, just hope windows doesn't fvck you up one day. Remember my windows 10 PC back then, the shit completely fvcked my hard disk up, had to delete everything. Stupid thing crashed every two weeks.
Re: Rant On Operating System Stuff. by Grandlord: 1:46pm On Aug 16, 2020
This stuff feels like cocaine to my brain cool
Re: Rant On Operating System Stuff. by Nobody: 3:29pm On Aug 16, 2020
Grandlord:
This stuff feels like cocaine to my brain cool
grin

1 Like

Re: Rant On Operating System Stuff. by hardebayho(m): 9:04pm On Aug 16, 2020
Wow, I enjoyed this, thank you so much!. Don't go just yet ooo... You cannot just come here and dump a bunch of weird stuff on us and expect somebody not to ask questions (especially dumb somebodys like me)

Please elaborate on what flat binaries are ooo, that's like one of the major things in the post I didn't understand. I've heard (or read) it from somewhere, but I don't know what it (or they) is.

And, please write that second post. It's informative, refreshing and makes me wanna rip my head off cause I didn't know some of these things. Plus, you become a better writer as you go.

I'm waiting for the answer to the first question and the second post...
Re: Rant On Operating System Stuff. by hardebayho(m): 9:08pm On Aug 16, 2020
And by the way, what's a leftist? I'm not meaning to troll or anything. I just wanted to follow you ni and I saw the word. I probably should've just searched Google...

Nah, it'll be too boring to be a learning experience. I'll just wait for you to answer me smiley
Re: Rant On Operating System Stuff. by Nobody: 9:43pm On Aug 16, 2020
hardebayho:
Wow, I enjoyed this, thank you so much!. Don't go just yet ooo... You cannot just come here and dump a bunch of weird stuff on us and expect somebody not to ask questions (especially dumb somebodys like me)

Please elaborate on what flat binaries are ooo, that's like one of the major things in the post I didn't understand. I've heard (or read) it from somewhere, but I don't know what it (or they) is.

And, please write that second post. It's informative, refreshing and makes me wanna rip my head off cause I didn't know some of these things. Plus, you become a better writer as you go.

I'm waiting for the answer to the first question and the second post...
A flat binary is simply a binary file, you remember those useless formats that you have to learn and understand like PE and ELF, they aren't in flat binaries, simply put they contain bare machine code and data simple.
Re: Rant On Operating System Stuff. by Nobody: 9:50pm On Aug 16, 2020
hardebayho:
And by the way, what's a leftist? I'm not meaning to troll or anything. I just wanted to follow you ni and I saw the word. I probably should've just searched Google...

Nah, it'll be too boring to be a learning experience. I'll just wait for you to answer me smiley
A leftist is a person who believes an egalitarian society and social equality. That is everyone should have equal rights and opportunities in the society, they believe that social hierarchy (classes) should be scrapped out of the society. Opposite of leftist is a rightist which is opposite of everything a leftist is. Leftism has different schools like communism, socialism and others. I was a hardcore communist but now nah I'll just call myself a leftist because I don't believe in collectivism (nah you must google this one I know you love learning but this one check it yourself).

1 Like

Re: Rant On Operating System Stuff. by hardebayho(m): 10:07pm On Aug 16, 2020
SegFault:

A flat binary is simply a binary file, you remember those useless formats that you have to learn and understand like PE and ELF, they aren't in flat binaries, simply put they contain bare machine code and data simple.

Oh, now I get it. Programmers Sha? They Sha will want to make simple things complicated so that we beginners will not be able to understand. If you had just said binary file from the beginning without the "flat", I probably would've understood what you meant. Anyway, thanks for the explanation cool
Re: Rant On Operating System Stuff. by hardebayho(m): 10:18pm On Aug 16, 2020
SegFault:

A leftist is a person who believes an egalitarian society and social equality. That is everyone should have equal rights and opportunities in the society, they believe that social hierarchy (classes) should be scrapped out of the society. Opposite of leftist is a rightist which is opposite of everything a leftist is. Leftism has different schools like communism, socialism and others. I was a hardcore communist but now nah I'll just call myself a leftist because I don't believe in collectivism (nah you must google this one I know you love learning but this one check it yourself).

Yeah... I just checked out the collectivity thing. It's simply prioritising some group over the members forming such group.

I'm a fan of the social equality thing, buh as you know, all fingers are not equal.

I don't like to call myself any of these names (probably cause I never heard of 'em, but I know who a pessimist is and I ain't one. I wonder what your cup of tea is with that one ), but if I'm to pick a side, I'll call myself a middlist angry cause I'm like stuck in the middle of all these things leftist and rightist. I don't believe there's a right and wrong way to do things. Things are just the way they are, and we're better off not judging them by categorising them as right or wrong.

Anyway, enough ranting. Thanks for the explanation, I'm grateful
Re: Rant On Operating System Stuff. by Nobody: 8:48am On Aug 17, 2020
hardebayho:


Oh, now I get it. Programmers Sha? They Sha will want to make simple things complicated so that we beginners will not be able to understand. If you had just said binary file from the beginning without the "flat", I probably would've understood what you meant. Anyway, thanks for the explanation cool
Yah no problem.

1 Like

Re: Rant On Operating System Stuff. by Nobody: 8:48am On Aug 17, 2020
hardebayho:


Yeah... I just checked out the collectivity thing. It's simply prioritising some group over the members forming such group.

I'm a fan of the social equality thing, buh as you know, all fingers are not equal.

I don't like to call myself any of these names (probably cause I never heard of 'em, but I know who a pessimist is and I ain't one. I wonder what your cup of tea is with that one ), but if I'm to pick a side, I'll call myself a middlist angry cause I'm like stuck in the middle of all these things leftist and rightist. I don't believe there's a right and wrong way to do things. Things are just the way they are, and we're better off not judging them by categorising them as right or wrong.

Anyway, enough ranting. Thanks for the explanation, I'm grateful
Don't worry I understand.

1 Like

(1) (Reply)

In Need Of A Web Developer / How To Create A Mobile App / Partnership On Building A Software development And Design Firm .

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 59
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.