Page 1 of 5

What are services

Posted: Thu Oct 27, 2022 1:03 pm
by devc1
What are services ?
What are their roles ?

Are they necessary ? If they manage I/O, CPU... why there are drivers ?
Are drivers only for devices ? or they can also include a new subsystem or feature (That was my design idea, because I don't know much about OSes) ?

Re: What are services

Posted: Thu Oct 27, 2022 6:11 pm
by devc1
.

Re: What are services

Posted: Thu Oct 27, 2022 6:39 pm
by nexos
If you want responses, bumping a topic after a couple hours isn't going to win you many favors....

Re: What are services

Posted: Thu Oct 27, 2022 8:46 pm
by AndrewAPrice
The definition of a service is pretty broad (https://en.wikipedia.org/wiki/Service_( ... hitecture)).

It's basically something that runs, that isn't an end user program (a GUI application) and yes, in many ways drivers could be considered services.

Sometimes they have more concrete or custom definitions based in the context. In microkernels a service is basically a program who's purpose is not to be directly interacted with but to provide common functionality or control access to resources to other programs.

Re: What are services

Posted: Fri Oct 28, 2022 3:52 am
by devc1
So from your answer, I guess we can just replace them with kernel mode drivers ?
If you want responses, bumping a topic after a couple hours isn't going to win you many favors....
Where is the problem ? I saw that my question was hidden from other topics.

Re: What are services

Posted: Fri Oct 28, 2022 4:15 am
by iansjack
devc1 wrote: Where is the problem ? I saw that my question was hidden from other topics.
So it’s OK to hide those other topics by bumping your own? This comes across like a little kid crying “me, me, me” when their mom is talking to someone else.

If no-one answers a question it’s because people don’t have the answer, they don’t find the question interesting, or (as in this case) it’s something the OP can easily answer for themselves with a little research.

Re: What are services

Posted: Fri Oct 28, 2022 6:49 am
by devc1
I know that the answer can be simply found with a google search, however I just wanted to know if I can replace services with just drivers. That's why I asked (what are services, what are their roles) because I didn't understand what they add to an operating system, because you can just make drivers to manage I/O, File system, add features and subsystems ?
This comes across like a little kid crying “me, me, me” when their mom is talking to someone else.
What you have just said, doesn't add anything or any information to the thread, it's just disrespect and I've reported it.

Re: What are services

Posted: Fri Oct 28, 2022 7:02 am
by iansjack
You asked what the problem was with bumping your thread. I told you.

That you don't like the answer and go crying "unfair" to mom is not my problem.

Re: What are services

Posted: Fri Oct 28, 2022 7:59 am
by devc1
I see, this is what (If i say it I get banned) behind mobile phones say because they can't find respect in real life.

This is a community, and we should all respect each other.
Just pretend you are on my place, would you accept that I teach you something while swearing and trying to harm your feelings. Of course not,
I am not arrogant, but this is not a manner of speech. I've personally never tried to make fun of someone without him triggering me.

I know that you maybe angry at me because I said before that you were ridiculous, remember when you said to me that I tried to look cool or whatever !? Furthermore, I have never disrespected you in the beginning, but you did, and from now I will never reply to your messages.


Sorry, but I think this post should be locked by mods, because we cannot continue like this.

In advance, thanks to AndrewAPrice for answering my question.

Re: What are services

Posted: Fri Oct 28, 2022 8:11 am
by iansjack
devc1 wrote:This is a community, and we should all respect each other.
Just pretend you are on my place, would you accept that I teach you something while swearing and trying to harm your feelings.
Which is exactly why we should stick by normal Netiquette and not bump threads to try to give them priority over other people's threads. We should respect the fact that threads appear in the order they are posted to and not try to game the system to our own advantage.

I'm not angry at you in any way. Why should I be? I really don't care what people say online.

I rather resent your implication that I swore at you. That is just a lie. And lying is not respecting others. It's such a silly thing to do when anyone can read this thread and see that I did not swear at you.

If your feelings are hurt by a simple answer to a simple question then I'm afraid, again, that is not my problem. If you didn't want to know why bumping threads is generally considered to be bad manners then why ask the question?

End of story.

Re: What are services

Posted: Fri Oct 28, 2022 10:00 am
by AndrewAPrice
devc1 wrote:I didn't understand what they add to an operating system, because you can just make drivers to manage I/O, File system, add features and subsystems ?
Imagine two ends of a spectrum:
On one side: The most monolithic kernel, where all code (drivers and all) live in the kernel.
On the other side: The most microkernel kernel, where the kernel is very small and just about every OS functionality is implemented in many small services and drivers that run as user programs.

But it's a spectrum, so if your question is "can I build an OS where all code lives in the kernel, except for drivers?" Yes. That would fall somewhere in the middle of the spectrum.

Maybe your question is "if you can implement all logic in drivers, what is the purpose of the OS having any logic outside of drivers?"

You could build an OS that way. But, it's useful for the OS (be it in the kernel or in a service that is not the driver) to share common code and ration resources. Imagine if you had a USB driver (for flash drives) and an ATA driver (for hard drives and disc drives) and your program wants to open a file by a path. Your program could ask each driver "can I open /home/andrew/documents/tax return.pdf?" and each driver would have to:
  • Know where it's mounted.
  • Know how all of the file systems that could appear on these devices (ExFAT, NTFS, ext3, etc.) work.
  • Knows how to resolve symlinks and permissons, which could point to locations on other devices.
  • Keep up with if multiple people are trying to write to the same file.
  • On top of the above, know how to talk to the device to read and write data.
Or, you could have some common code (in the kernel for monolithic systems or a service for microkernels) that:
  • Knows at what path all storage devices are mounted.
  • Knows how to read different file systems (ExFAT, NTFS, ext3, etc..)
  • Knows how to resolve symlinks and permissions.
  • Keep up with if multiple people are trying to write to the same file.
Then all your USB and ATA storage drivers have to do:
  • Report how big the device is.
  • Know how to read and write to the device.
So, by having the common code (in the kernel or in a service) outside of the driver, the driver just has to worry about one specific thing (provide a common way to interact with this device regardless of make or model) and it makes your code more modular and easier to understand, because each service/driver just has to worry about its own job and not try to do everything.

Another example would be if the window manager (the code that draws where windows are, the title bar, handles resizing them, etc.) was implemented in the graphics card driver, and then upgrading the graphics card would completely change the look and feel of your OS. Then let's say you add a new feature your OS (such as you can theme your windows), some drivers would support theming, others may never get updated. Instead, if the graphics driver just worried about:
  • Get and set the current resolution.
  • Copy pixels onto the screen.
..you could implement the code that draws the windows, the title bar, handles resizing them, etc. into its own service. Then your OS would look and feel the same regardless of which graphics driver was being used, and it would be a lot less work for the developers of the driver.

Services in microkernels (or common kernel code in monolithic kernels) are useful and simplify things, because you put your common logic that should be shared or has to manage rationing resources into the services. Then you only have to implement the window drawing and dragging logic, the symlink resolving logic, the NTFS reading code, etc. once. Then your drivers become easier to build because they only have to worry the specifics of interacting with the hardware.

Re: What are services

Posted: Fri Oct 28, 2022 11:52 am
by devc1
So my kernel had some messed up design because I didn't know about these thing. I was mixing the window manager, usb interface, and device drivers all as drivers.

So from what I understood, a driver is the program that provides communication with the device. And the services are what provide the interface and additionnal features (window management for e.g.).

I guess now it's like creating a whole new kernel, because I like the micro-kernel design and extensibility.

Re: What are services

Posted: Fri Oct 28, 2022 12:06 pm
by devc1
So in order to create a micro kernel, the kernel should (generally) provide :

- Process Manager
- Memory Manager
- Interrupt Manager
- CPU initialization function ( if another processor is detected from a driver)
- Paging
- Object manager (handles)
- Program Loader

What makes the kernel run a specific driver, my kernel just lists pci devices and runs the driver for the device. But what about an acpi driver ? Should it run all the drivers at once, and if (for e.g.) acpi is not found the driver will just shutdown ?

What are consequences

Posted: Fri Oct 28, 2022 1:12 pm
by nullplan
iansjack wrote:If no-one answers a question it’s because people don’t have the answer, they don’t find the question interesting, or (as in this case) it’s something the OP can easily answer for themselves with a little research.
Fourth option: They live in a time zone in which the first message occurred at 9:30 pm and the bump occurred at 2:00 am. Sorry, but I'm not reading the forum while sleeping, and I'm an early bird (somewhat unusual among programmers, I know).
devc1 wrote:This is a community, and we should all respect each other.
In order to get respect, behave respectably. I do not feel respected by someone bumping a thread before I even became aware of its existence. It stresses me out that someone demands my attention to that degree. I do not feel respected by someone running to the mods once called out on their behavior. I do not feel respected by someone asking questions constantly that betray a lack of research on the asker's part. And I especially do not feel respected when someone demands an answer by only a single member. Makes me think nobody else is good enough, now.

My people have a proverb: As you call into the woods, so it calls back out again. After disrespecting me and every other member of the forum to that degree, why should we respect you?

Re: What are services

Posted: Fri Oct 28, 2022 1:27 pm
by rdos
devc1 wrote:So in order to create a micro kernel, the kernel should (generally) provide :

- Process Manager
- Memory Manager
- Interrupt Manager
- CPU initialization function ( if another processor is detected from a driver)
- Paging
- Object manager (handles)
- Program Loader

What makes the kernel run a specific driver, my kernel just lists pci devices and runs the driver for the device. But what about an acpi driver ? Should it run all the drivers at once, and if (for e.g.) acpi is not found the driver will just shutdown ?
You don't need to build a micro kernel to be able to reuse code. The issue instead is that you should define various interfaces that can be used by higher levels or implemented with lower. For the file system, you need one level that implements the user level API you want (be it Posix or something else). Next, you define a virtual file system level (VFS) that defines which functions all file systems must implement. Last, you define the disc drive interface that every disc driver must implement and that file system drivers use to communicate with disc drivers.

As for ACPI, I find that rather obsolete and use it as little as possible. The device hierarchy should not be built on top of ACPI. Rather, ACPI can be used to get global interrupt numbers for PCI devices that lack MSI and MSI-X, but that's about it.