What on earth does systemd need that it can't get from solaris/bsd, or are systemd and the gnome team just lazy?
What on earth does systemd need that it can't get from solaris/bsd, or are systemd and the gnome team just lazy?
- Many traditional init systems are based on a bunch of shell scripts with some metadata. Each service is started through a shell script that supports the start/stop/restart argument. While this makes the implementation very simple, it also makes it inefficient. To start a service the init system must create a new process (the shell script) which in turn invokes a bunch more processes (because almost anything you do in a shell script requires external commands) before finally invoking the service itself. This is expensive in terms of both CPU usage and disk I/O, and the latter really matters for boot time. Systemd accepts a bunch of service description files and handles the starting and stopping for you.
- Traditional init systems are about starting and stopping services. Systemd is also about keeping services running. For example if a daemon crashes, with most init systems you have to restart it manually or hook it to some external monitoring system. External monitoring systems usually rely on polling to check whether services are still alive. Systemd on the other hand just forks() the service, waitpids() on it, and gets notified by the kernel when the services crashes. No polling involved. Polling wastes CPU and reduces battery life. Polling also makes leaves a small time gap during which the service is temporarily dead but hasn't been restarted yet. This latter can be mitigated with a smaller polling interval but the smaller this interval the more CPU you use.
- Systemd supports on-demand starting of services. It starts a service as soon as a program needs it. This works by having systemd allocating server sockets and listening on them. When a client connects to a server socket, systemd will not accept() the client; instead systemd will figure out which service it belongs to, then starts that service, passing it the server socket. The service then accept()s the client. This is great for saving CPU, memory and disk I/O until it's really necessary. It saves battery life and reduces boot time. EDIT: It's not (x)inetd, see my reply.
Unfortunately most people slam GNOME and systemd for being NIH or crazy without understanding the reasons. I hope this post makes some people understand the rationale behind systemd.
Since you seem to know a lot about it, could you answer my question? What linux-specific features are necessary?
EDIT: I don't know, I upvoted your comment, it was very helpful.
But to answer your question: no, it's not inetd. Inetd is very inefficient in terms of CPU and memory usage and has scalability issues thanks to the fact that it spawns a new process for every client. Systemd does not do that: it waits until someone connects to the socket, then starts the service and have the service handle all clients on the socket. Systemd then waits until the service has exited. The service can use I/O events or threads or whatever efficient mechanism to handle multiple clients on the server socket, all within a single process.
This in itself does not require Linux-specific features. However the GNOME discussion is about depending on systemd which happens to be Linux-specific at the time for other reasons, not about GNOME wanting to be Linux-only (which is sensationalist headline). One of the reasons systemd is Linux-only is because it uses cgroups, which I explained here: http://news.ycombinator.com/item?id=2565801
Of these, some seem like they are linux-only features that are used, not linux-only features that are required (but I don't know specifics, maybe I'm wrong):
- get_current_dir_name()
- canonicalize_file_name()
- /dev/urandom
- /dev/char/*, /dev/disk/by-label/*, /dev/disk/by-uuid/*
- openat() and friends
- O_DIRECTORYLennart Poettering's position seems to be that it would be better for other systems to re-implement SystemD's interface than to port it, and in any case, he can't be bothered to do a port.
A more impartial assessment would be that launchd is licensed under the Apache License, which is GPLv2-incompatible.
Systemd sounds great, more distros should use it or something like it. But why would something like gnome shell want to depend on it? Systemd starts programs at startup, gnome shell is a gui. I could almost understand something like GDM needing a dependency, (but would still consider such a dependency poor engineering and against the unix philosophy)
A decision like this, and other decisions gnome has been making lately will reduce its popularity.
One thing you can say about current Linux windows managers is that they are held-back by the overall system's latency.
That is, some random script starts somewhere starts while you're in the middle of typing something and you're like "why am I suddenly crawling?"
In that sense, demanding that the graphic system have more control over services in general actually seems rational. Today, BSD, Linux and Solaris have lots of resources as server OSes but its pretty clear none of the server developers give a toss about the latency issues of the Linux Desktop. Concentrating on one OS would let them patch-to-suit so this might actually quite good.
At the same time, the reason the current Gnome panels main-menu takes umpteen seconds to appear is that they feel compelled to each time parse the pathological menus format specified by Freedesktop.org. And so there's lots of other stuff to do to go present to a desktop that "spritely".
[1] http://www.webupd8.org/2010/11/alternative-to-200-lines-kern...
If GNOME really wants some fancy Linux feature, they can ask BSD to implement it.
And the BSD developers don't have the manpower to do that.
Is there a history of such requests going unserved?
See Project Utopia, ALSA, DRM, KMS, cgroups, etc.
BSD and Solaris cannot afford to keep up with Linux. They just can't. So the question is whether Linux people should subsidize OSes that they don't use or just let them fail.
Let me elaborate. Good Programmers write Portable Code. This means checking for supported features and using them if they exist, falling back to less desirable methods otherwise. So either the systemd guys are too lazy to do this (and therefore I probably don't want to run their code even if my OS is supported) or there is something linux has exclusively, that is so damn awesome that systemd would suck if it didn't have it. To my knowledge, group scheduling is not that awesome. In fact, as far as I know, freebsd's kernel and userland apis are superior to linux's in many ways, and if this is false, I would like very much to know why.
I was tempted to call gnome and systemd lazy, but thought I should learn more first.
Full disclosure: I don't run gnome (apart from gtk) and probably never will, but only as a matter of personal preference, not philosophy.
Is there anything wrong with lazy? Remember that people have limited time and man power.
There's a very good reason for using cgroups: to completely clean up a service's process tree even in the face of abusive behavior. A service can spawn a child process that calls setsid(). By using cgroups systemd can kill that child process too. Traditional POSIX APIs like killpg() do not allow that and give processes the ability to escape supervision.
You say FreeBSD's kernel APIs are superior. It makes me wonder why you think that. There are only two things that I think are better on FreeBSD than on Linux: kqueue is better than epoll, and the OpenBSD firewall is easier to learn than iptables. As for everything else I've yet to see hard evidence that FreeBSD beats Linux.
Didn't know that about cgroups. Has anyone tried to kill a process tree on bsd or solaris and failed?
I don't know a lot about freebsd, most is just hearsay. I have been happier with their libc though, it seemed like it had fewer gotchas and unimplemented features.
[1]: http://download.oracle.com/docs/cd/E18752_01/html/816-5174/c...
[2]: http://download.oracle.com/docs/cd/E18752_01/html/816-5174/p...
Lets not forget, the programmer in question we are talking about here is the author of the 'masterpiece' that is PulseAudio.
A large portion of "good programming" is about making tradeoffs, and making the correct decision. Prioritizing portability is a decision that can be made, but that the decision is made one way or the other within the scope of one project does not mean that the decision-maker is a "good" or "bad" programmer.
Poettering.
In the long term this will be a competitive edge for *BSD over Linux.