• Forum
  • Lounge
  • What do you think the hardest part of wr

 
What do you think the hardest part of writing a kernel would be?

Apr 12, 2013 at 9:27pm
Hey, so I thought about partaking a small kernel like a DOS-similar system with only 16-bit computing, no virtual memory, text-based graphics memory only, and input/output done all on one drop-down text screen.

In x86 Real Mode I would have to best implement a flat memory model as best as possible, since I find paging and segmentation to be overly complicating to implement such a basic nature of memory use.

But all in all, what part do you think would be the hardest to manage?

1.Drivers, data control, and/or hardware device access.

2.Memory management across and for the whole OS.

3.A filesystem.

PS: This is no multitasking system and has no "graphics", so that saves time and complexity of PITs, virtual memory managing, graphics mode set ups, and inter-process communication, along with context switches, and even bulk writing work, since a kernel of this moderation can be accomplished in less than 20,000 lines of x86 Intel "DOS/MASM" style Assembly syntax.
Last edited on Apr 12, 2013 at 9:34pm
Apr 12, 2013 at 11:40pm
Writing a kernel is the hardest part.
Apr 13, 2013 at 6:21pm
The hardest part of writing a kernel is not writing a kernel, but dealing with the native architecture, i.e., call stack, registers, data, processes/threads, memory control directly from and to RAM, I/O with interrupts, drivers, user interface from nothing, no API, etc., etc.

In application programming you virtually never deal any of that, at least not on the architecture level.

You always have an OS under your application to hold your hand.
Last edited on Apr 13, 2013 at 6:22pm
Apr 14, 2013 at 2:41pm
closed account (1yR4jE8b)
The hardest part is getting manufacturers to actually write drivers for it.
Apr 14, 2013 at 2:52pm
If your system uses basic I/O then writing drivers for basic hardware should not be terribly difficult.

The difficulty of memory management depends on whether you intend on having only a kernel running, or other programs as well (and if so how many). Over all I think most modern CPU's handle a lot of that for you, you just need to set up the memory (please do not quote me on this).

A file system is also dependent on whether or not other programs are accessing it or not. If so, you would need to set up restrictions so that not any program can access every file.
Apr 14, 2013 at 10:43pm
IMO the hardest part of writing a kernel is ensuring consistency and inter-connectivity between all of the modules so you don't end up with a huge bloated mess of code that becomes un-maintainable almost immediately.

Higher level design concepts are often times harder than low level code implementation.
Apr 14, 2013 at 10:56pm
I looked into writing an OS at one point, and I think the kernel is a hard thing to write. I have to agree with chrisname on this one.
Apr 15, 2013 at 4:08am
It depends if you're writing it in cursive or not. On average, of those characters, I think that the "K" is the hardest letter for most people. In cursive, the transition from the "k" to the "e" can be a little tricky.
Last edited on Apr 15, 2013 at 4:12am
Apr 15, 2013 at 1:44pm
I think the hardest part about writing it is remembering to spell it "kernel" and not "colonel". It's easy to get those two confused because they're homophones.
Apr 15, 2013 at 7:55pm
It's been a long time since my last attempt at kernel development. I've learned a lot more about hardware and it's interaction with software, as well as had a lot more practice with assembly. I think I'll take another stab at it soon O:
Apr 15, 2013 at 11:28pm
1
2
3
//Kernel.cpp
#include <iostream>
int main() { std::cout << "Hi!" << std::endl; return 0; }
Apr 15, 2013 at 11:44pm
closed account (3qX21hU5)
@Oria your Colonel is to bloated so I decided to take the task of rewriting it for you and after years of hard work (I got a time machine) I think I have made you a finished product.

1
2
3
//Colonel
#include <iostream>
int main() { std::cout << "Hi!"; return 0; }
Apr 16, 2013 at 11:29am
Here's my colonel's logo: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTbfsT8FwzB85slMe4wW0uLJlVso4rWybOtKA1_xmHkDg2iucD7oA

The code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
int spiderman(int x) // every OS has a spiderman function
{
    return main(x - 1, NULL);
}

int howdoi(int x)
{
    return spiderman(x);
}

int shot(int x)
{
    return howdoi(x);
}

int web(int x)
{
    return shot(x);
}

int main(int argc, char* argv[])
{
    if (!(argc))
        return 1;
    return web(argc);
}
Last edited on Apr 16, 2013 at 11:31am
Apr 16, 2013 at 2:24pm
In my 8 years as a programmer I've never once considered calling main from another function.
Apr 16, 2013 at 2:28pm
I think the hardest part would be adding support for multiple keyboard&mouse pairs that allow multiple people to use the same computer and each have their own window focus. It would be very useful with multiple monitors, too.
Topic archived. No new replies allowed.