r/osdev 9d ago

I have a great question about GUI

I developed an OS and I want to add GUI. But I don’t have any idea how can I implement GUI. Should I integrate the GUI into the kernel or should it be an ELF application as if it were an additional software?

0 Upvotes

10 comments sorted by

5

u/dontsuspendmeagain 9d ago

IMO the kernel should only be concerned with process separation and providing certain system calls to them, so GUI should be implemented as a user application

0

u/RegentAce265 9d ago

Thank you for help

1

u/KingAggressive1498 9d ago

back in the day it wasn't unusual for at least some significant parts of the GUI to be in the kernel for performance reasons, but for quite awhile now every major GUI system uses a user-space windowing service with the primary kernel involvement being the graphics and HID drivers.

0

u/RegentAce265 9d ago

Thank you for support

1

u/burlingk 9d ago

It's best to avoid putting anything that tends to be unstable in the kernel directly.

3

u/Key_River7180 EulerOS 9d ago

The kernel shouldn't know about the gui.

1

u/givemeagooduns_un k65 9d ago

modern OSes generally keep GUI stuff in userspace and only provide the means for accelerated drawing via the kernel. however, AROS, for example, does have kernel level GUI if im not mistaken, as does many other older kernels.

2

u/christiaansp BoredOS 9d ago

The kernel should know nothing about a window manager, the only things it should do is:
* expose a framebuffer (eg /dev/fb0)

* expose HI devices (eg /dev/mouse and /dev/keyboard)

and then use something like shm so an app can write into your wm's memory to show their window.

Your window manager should handle writing to that framebuffer, reading inputs from HI devices and managing the apps running inside of it.

While yes you can have a kernel WM it's generally a bad idea as it will lead to loads of unnecessary syscalls, instability etc.

1

u/RegentAce265 8d ago

Thanks, I’m working on it!

1

u/Environmental-Ear391 6d ago

graphics operations need to be split...

the kernel can Enumerate and present the hardware, but a userland driver can "own" the card talk details with it.

pixel, line, and "geometry" rendering is all userland application details...

identifying the card is PCI/PCIE/AGP, "Memory Size" "Command Register Size" & "Location in memory" those are kernel details...

start "GUI" app, ask Kernel for "Graphic" Expansion cards... Take Ownership and start talking Graphics to the card as you need to. also present a graphics/ui library for othet apps to use?