Measuring the progress of my OS

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
coderTrevor
Posts: 10
Joined: Fri Mar 22, 2019 12:34 pm

Measuring the progress of my OS

Post by coderTrevor »

Recently I took an operating systems class which rekindled my interest in my hobby OS. I managed to port Doom, implement multitasking, and started writing a GUI and getting programs to display their output in windows.

I've been feeling pretty good about that. :mrgreen:

With all this progress, I was wondering how big my OS has gotten, as I do on occasion. I would usually look up some PowerShell command to count lines but I didn't want to keep doing that. Plus we all know lines of code isn't a good metric. But it IS a metric. I mean, I think it's safe to say an OS with a million lines of code is doing a lot more than an OS with a thousand lines of code.

That got me thinking, what IS a good metric for OS development? Lines of code can fluctuate; sometimes when I'm improving something my number of lines actually decreases. So is there any metric that's reliable?

Then it hit me: the more my OS progresses, the more I add "TODO" and "HACK" to the comments of my code. So I decided to write a little AutoHotKey script that counts these very reliable metrics. The script is far from perfect but I thought I'd share what it finds anyway.

Here's how my OS measures up:
Image
So my fledgling OS has 205 TODO's and 21 HACK's. Not bad!


Just for fun, I thought I'd compare that to some other open-source operating systems.


First up is an OS I can't pronounce but have been watching for a while:
Image
Only 13 TODO's? I was really surprised; I thought toaruos was further along than that! I guess Klange has some work to do.


Next is another OS I've seen on the forums here:
Image
Fun fact: managarm is an anagram for managram. With 583 TODO's, this OS clearly has potential.


If you're not aware of Serenity you really should be. The momentum this project has is incredible!
Image
but with 561 TODO's it's only about three times as good as my own OS. It's good to know that I can catch up!


Now for the poster-child of open-source operating systems:
Image
1,355 TODO's is not too shabby at all!


Finally, my personal favorite, ReactOS:
Image
A whopping 4,996 TODO's demonstrate that ReactOS is easily the most advanced open-source OS, nearly four times as advanced as Linux!


Well I hope you had fun as much fun as I did analyzing some projects. :)

Management-types take note: TODO's is the new hot metric you should all be using!
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Measuring the progress of my OS

Post by nexos »

That system is great! The only issue is that some OS developers (myself included #-o ) don't put TODO comments in my code. I think the same goes for Toaruos. But that is a great system! By the way, where can I get that line counter app of yours?
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Rhodez
Member
Member
Posts: 33
Joined: Tue Jun 30, 2020 2:09 pm
Location: Langeskov, Denmark

Re: Measuring the progress of my OS

Post by Rhodez »

I also love what you did there. Nice script. :D
Quite funny to measure in that way. I still think it is hard to say what is a good metric, but certainly this gives an idea of the progress. :D
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: Measuring the progress of my OS

Post by bzt »

coderTrevor wrote:I think it's safe to say an OS with a million lines of code is doing a lot more than an OS with a thousand lines of code.
That's a bad assumption. I've spent a year to drop SLoC around 6000 in my kernel for example. I often refactor and rewrite parts to use less lines (because K.I.S.S.). This doesn't mean my OS can do less, on the contrary. I often find that rewritten code can be reused more places (thus further shrinking the code and the SLoC) and even places that I haven't implemented before.

Take a look for example my bootable disk image writer, USBImager. It has very minimal SLoC, the compiled file is about 256 KILObytes, yet you can't say it does less than balenaEtcher which is 400 MEGAbytes in size (haven't checked the actual number of lines, but I'm pretty sure 400M has magnitudes more source lines than my 256k code). Both support raw images, zip, gzip, xz etc. compressed images. And my lot smaller code can actually do more: it can also send images through USB serial ports, something that the other imager can't do, and mine has a lot more translations (17 languages at the moment) in that 256k...

Or another example, my udisasm. It can disassemble ARM8v2 in 65k (about 2100 SLoC), while Capstone even in "diet" mode is more than half a megabyte (and with bigger code size goes lot more SLoC too. According to github, only the two files cs.c and AArch64/AArch64Disassembler.c are more than 3000 SLoC, and there are about 20 source files more for that arch only). Yet, you can't say that Capstone is doing more, actually it does less in "diet" mode than my disassembler.

You probably heard this before: "Simplicity is the ultimate sophistication".
coderTrevor wrote:Then it hit me: the more my OS progresses, the more I add "TODO" and "HACK" to the comments of my code.
This makes no sense. The more an OS is closer to its final stage (more progressed that is) the less TODO it should have. Ideally a fully progressed and ready to use OS should have exactly zero TODO lines left.

Just for the records, these are not useless, both TODO list and SLoC are very useful, just not good for measuring the progress. For example my build system automatically generates TODO.txt (currently I have 8 ), and I also have an SLoC calculator.

Cheers,
bzt
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: Measuring the progress of my OS

Post by klange »

- Line counts are a dubious measurement of anything, and language and code style must be considered when comparing them even for a base level of "how much work went into this". The best engineer I ever knew had a net negative line count during her tenure at the company we worked for.
- I use XXX a lot for "TODO/HACK" comments, you'll find 77 of those if I've done my counting right, a bit more than the 13 TODOs. Also I use an issue tracker and a physical notebook to track projects. TODO comments aren't great, and the idea of using the number of them as a positive indicator of progress seems a bit paradoxical to me. If you have a lot TODO you must not have done much.

Progress should better be measured in features and capabilities.
mrosdev
Member
Member
Posts: 28
Joined: Mon Jun 01, 2020 8:15 am

Re: Measuring the progress of my OS

Post by mrosdev »

Amazing!
Last edited by mrosdev on Sun Oct 18, 2020 7:34 am, edited 2 times in total.
User avatar
bloodline
Member
Member
Posts: 264
Joined: Tue Sep 15, 2020 8:07 am
Location: London, UK

Re: Measuring the progress of my OS

Post by bloodline »

Fascinating metrics, but unfortunately they don’t tell us very much, and certainly can’t be used to compare projects.
One would need to use proper project management tools and techniques for that.

Apologies for butting in, I am an Analyst in my day job.

Great work on your project though, that’s worth a drink :)
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Post Reply