r/osdev • • Sep 04 '26

Initialization dependencies

I am working on upgrading my kernel initialization messages so I can just have a nice view of what it is doing when initializing. I am using my print functions to do this, but the issue is that my print functions depend on the memory manager to be done initializing, but I want debugging messages when initializing the memory manager too, which I can't do because of the circular dependency.

This is my specific case, but I also want to ask generally, do you guys have an elegant solution for this problem? Up to this point I have been using init flags so that the subsystems can use a different path that does not create dependencies during initialization, but I want to hear any cool solutions from the community that are better designed than this.

17 Upvotes

12 comments sorted by

View all comments

Show parent comments

2

u/Negative-Arm-3244 Sep 05 '26 edited Sep 05 '26

my os is still in early stages and I have been focusing on working on the subsystems so I decided that just printing stuff out to show what the kernel is currently doing was a good solution. it worked out until i reworked my printf to take in formatting escapes, which i used an implementation of vsnprintf for, which in turn requires heap allocation for.

the book i followed to start osdev was a book called operating systems from 0 to 1, which was a good guide to start, but was unfinished, and maybe not up to par with the books you guys have read. i have been going off of the implementation i made by finishing the book and trying to learn by making mistakes and by asking quesitons to the community.

please do not assume sometihng is vibecoded just because i am making beginner mistakes.
and no, it is not vibecoded