Fog Creek Software
Discussion Board




Linux Refactoring

What does everybody think about rewriting Linux, or parts of it (such as X perhaps) in a higher-level, object oriented language such as python?

Alice
Sunday, November 23, 2003

I think that plan smells like old socks.  X is slow enough already, let's not handicap it with a language that will add to the problem.

Clay Dowling
Sunday, November 23, 2003

Which is more important:

a) The speed at which X (or the kernel) runs on the cpu

b) The speed at which a programmer writting an application for X (or Linux) can get their head around the API?

Alice
Sunday, November 23, 2003

Which is more important:

a) The speed at which X (or the kernel) runs on the cpu

b) The speed at which a programmer writting an application for X (or Linux) can get their head around the API?

For the end user a
For the developer a - because you aren't going solve the x problem with a scripting language  choice b is the developer thinking about getting x rewritten as easily as possible.  Python might be a great language, but it does not have the performance you need for a gui server.

Mike
Sunday, November 23, 2003

Besides, if Linux is going to make major in-roads on the desktop, who cares about a windowing system that can send its display on another host? This is 1970's technology :-)

Frederic Faure
Sunday, November 23, 2003

Frederic,

Well, Microsoft care for one. As Joel noted, XAML looks an awful lot like NeWS.

Sure, XFree86 might not be the ideal implementation. Better perhaps to adopt the Apple model by adding an X11 compatability layer to a native display.

But asking that Linux should abandon X11 altogether is a really silly idea, not least becuase it involves throwing away countless hours of work on windowing toolkits like GTK+ and QT.

rd
Sunday, November 23, 2003

I know that we have to stick with X because dumping it would mean rewriting just about every GUI-based Unix apps but still... it's kinda funny to see port 6000 open on a desktop host, which _no one_ will ever write too from the network :-)

Frederic Faure
Sunday, November 23, 2003

I use Linux only as an hardware abstraction layer. On top of Linux and XFree86 I run Squeak. One of the fathers of Squeak is the man who invented the term "object oriented": Alan Kay. You can download Squeak at

http://www.squeak.org

Moose
Sunday, November 23, 2003

I *totally* support rewriting the Linux Kernel in Python. That's a plain good idea whose time has come!

MS Developer
Sunday, November 23, 2003

I question whether or not the kernel needs rewriting. Is there some fundamental problem with it?

As for X, I also question that. I don't think X has problems that require a revolutionary change. The number 1 problem cited with X is the inconsistant actions of the applications. But that is not a fault with X doing something badly or being broken. It's a problem with X having never implemented something (common widget set). That can be added.

I don't think a rewrite is necessary. I also think a good rewrite is really not possible, or at least not feasible, if you wish to maintain backwards compatibility. Which you must, because there are many thousands of useful and good applications for X.

Mike Swieton
Sunday, November 23, 2003

By the way, rewriting something in another language has nothing to do with "Refactoring".

GP
Sunday, November 23, 2003

What does everybody think about refurbishing cars, or parts of it (such as the steering wheel) using lighter materials such as carbon fibres?

Slashbot
Sunday, November 23, 2003

X isn't slow. Used right, with the right drivers, it's about as fast as Win32 used right. The network transparency costs very little, and if you insist, you can use shared memory to completely eliminate the costs (losing the network transparency along the way, unfortunately).

Check out FLTK [ http://fltk.org ] - It's a graphic toolkit, that works on both Win32 and X. It makes full use of the features of both systems, and is fast and crispy on both. It's faster than any other toolkit I've tried on both Win32 and X, (except, perhaps, the K GUI).

Ori Berger
Sunday, November 23, 2003

I'm right with the idea that loads of programmers should spend their weekends and evenings rewriting the kernel in Python. For free. Do it.

CEO On the Take
Sunday, November 23, 2003

Scripting languages are great for lots of things. Kernel programming isn't really one of them.

Beth
Sunday, November 23, 2003

Don't rewrite the Linux kernel in Python. Start from scratch.

Slashbot
Sunday, November 23, 2003

I totally agree.  Scrap linux code and start anew.

Bill Gates
Monday, November 24, 2003

Okay. Maybe that was a stupid idea then :-P

The reason I suggested it is because python is so much *easier* than c. I can actually understand quite a lot of code written in python, but code written in c often goes over my head. Perhaps if I keep practicing I'll get better at it, but Python really is *easy* - you have to admit.

Linux's greatest strength is that its open source. So it makes sense to make the source as comprehensible as possible (to encourage people to take a look).

Linux works great but only 0.01% of the population can get their head around it, so the source is only *really* open to that 0.01%. If by rewritting it in a more comprehensible language we could open the source up to %1 of the population, wouldn't that be a small price to pay for a little loss in speed?

Maybe a scripting language isn't such a good idea for a kernel, but firstly how much slower is it? CPU's are like speeding up exponentially aren't they?

Secondly, how about a language that is both interpreted and compiled? If you want you can precompile (and end up with something faster) or if you can't be bothered compiling and speeds not your #1 priority you can just interpret.

Alice
Monday, November 24, 2003

About X:

Even though most people rarely make use of X's networking compatibility at present, I think it will turn out to be increadibly useful eventually.

For example, if you're chatting with somebody over the net, and you really need to draw a diagram to explain what you mean you could just pop up a window on their X server and draw away.

Or if you're giving a lecture to a huge audience, you could display everything on multiple screens so that everybody gets a clear view.

It will probably be really useful for online multi-user virtual reality games, when they take off....

Alice
Monday, November 24, 2003

We've had VRML for a while, and there are large scale worlds out there with actors and the like.  Introduce your kids to Habbo Hotel.

X is basically a raw server and client, what you really see is the Window Manager and widget set operating on top of that.

Simon Lucy
Monday, November 24, 2003

You know, in some respects, this site is getting as bad as Slashdot.

Everytime someone asks a question or tries to start a discussion about Linux, it devolves into slagging off X11.

X11 *WORKS*. It's installed. It has flaws.
Windows works, is installed and has flaws.

Somehow, for Windows the conclusion drawn from that is that Windows is OK, but for X11 it's that it needs replacing.

Frankly I think the Windows GUI sucks and we should tear it out and start again. That's not practical or realistic. Instead, we get to make the best out of the installed base.

The same is true of X11. So could we please stop these conversations about how to make the best of X11 devolving into "tear it out and replace it"  ? Because it's getting very dull, and very Slashdot.

Katie Lucas
Monday, November 24, 2003

Katie, you can't be serious!

The Windows GUI, and most applications written to its conventions, offers a consistent, effective user interface which is smooth and responsive on hardware back to the oldest Pentium 150Mhz (yes, *M*hz) processors I still have in use.

Compare that to X. It is slow, definitely unresponsive, and applications written for an X environment seldom offer even a fraction of the consistency of the Windows environment.

Now compare the X API with the Windows API.  I won't bother to re-state the comparison, it was spelled out with maximum effect in The Unix Haters Handbook, referenced frequently in this forum.

I'm not a Linux hater, nor a BSD hater, I just recognise the vast user interface superiority of the Windows, Macintosh, or even QNX/Photon user interfaces.

X holds back the Linux desktop. Get rid of it!

HeWhoMustBeConfused
Monday, November 24, 2003

If you'd  like to rewrite the kernel in Python (or whatever language you fancy) because:

• you want to learn more about the kernel
• you want to explore Python
• it might be fun
• it's Monday morning and you just damn well *feel* like it

then you can with the blessing and encourgement of that nice Mr Thorvalds.  Don't expect to make any great innovations  or to set the world alight for all the usual boring technical reasons.  Do it for fun and if you do manage to make dramatic improvements and *he* feels like it , then Linus will merge your work into the main tree.  Even if he doesn't then other people may pick up your work for their trees.

Think of it as evolution in action.

A cynic writes
Monday, November 24, 2003

"(Windows) is smooth and responsive on hardware back to the oldest Pentium 150Mhz"

Sorry, but I have X running on a 100MHz 486 and it is perfectly adequate. The reverse cannot be said of Windows 95.


Monday, November 24, 2003

I should know better than to get sucked in by the trolls, but anyway...

I've been using X since the Windows 3.1 days, and it was as responsive then as it is now.  Back then, X on a DECstation (which was about as powerful as PCs of the time) was as responsive as Windows.  X circa 1992 is as fast as Windows circa 1992, on equivalent hardware.  The same can be said now.

As far as consistency is concerned, comparing Windows to X is like comparing apples with oranges.  Instead, compare Windows with GNOME or KDE, which are desktop environments, not unlike Windows.  The X API is rarely used when working within KDE and GNOME.  In particular, KDE has a wonderful API, much more clear and consistent than Win32, IMO. 

In summary, X does *not* hold back the Linux desktop, rather it provides a hardware abstraction for desktop environments, such that they do not need to include things like device drivers.  This, IMO, is a major drawback of the Windows API, in that applications have far too much direct control over low-level system resources.  It's good to see that even Microsoft recognizes this, given the CLR and .NET.

Joe V
Monday, November 24, 2003


"Linux works great but only 0.01% of the population can get their head around it, so the source is only *really* open to that 0.01%. If by rewritting it in a more comprehensible language we could open the source up to %1 of the population, wouldn't that be a small price to pay for a little loss in speed." (Alice)

Rewriting Linux would be prohibitively expensive for many reasons (including, among many others):

- People would still have to support Linux and make improvements to it while others rewrote it.
- Some portion of linux kernal developers would have to be diverted to the new-kernel work (meaning improving the current Linux would slow down).
- It's effort devoted to solving solved problems instead of moving on.
- Making Linux more accessible might mean an increase in submissions from the "great unwashed". Being difficult to understand provides some measure of qualification.

njkayaker
Monday, November 24, 2003

Alice,

Don't confuse your inability to understand C with a general inability to understand C.  It's a language that has a lot going for it.  A shallow learning curve doesn't happen to be one of them.

I would also like to note that understanding the source code of an application is not necessary for making good use of it. I'm pretty sure that the source for Internet Explorer would leave me scratching my head, since the whole COM interface really bewilders me at the C source level.  I still find it incredibly useful.

Clay Dowling
Monday, November 24, 2003

The separation in X11 between the window system, the window manager, and the application widgets is what holds back Linux.

On Mac OS X, the WindowServer manages rectangular areas of the display (as in X) but all drawing is handled by client applications.  (The WindowServer double-buffers windows; their back buffers are memory-mapped into the client address space, and periodically flushed.)  Client applications all use the same set of high-level application widgets through only two primary APIs (Cocoa and Carbon), and there's no separate "window manager."

This model sacrifices network transparency but it gains a lot of inter-application consistency.  And that's what really makes Mac OS X such an attractive operating system that can actually compete with Windows on the desktop: The vast majority of Mac OS X applications look similar, work in similar fashions, and work together well.  This is not the case on Linux, and won't be until the Linux world settles on a single primary API and widget set.

I suggest GNUstep, because then the Linux world might be able to convince some Mac OS X developers to ship their applications for Linux as well.  Plus any OpenStep-derived framework has a huge advantage in terms of development speed over pretty much anything else.

Chris Hanson
Monday, November 24, 2003

*  Recent Topics

*  Fog Creek Home