October 24, 2003

If I could re-write Linux

Author: Prakash Advani

If we were to re-write Linux, taking clues from various operating systems, what would we
make sure it did? Our next-generation operating system (NGOS) would be completely modular in design, aimed at 64-bit hardware, and with an interface that would change the way people compute. It would support a large number of applications and hardware devices, accepting device drivers written for other operating system, and run applications written for other operating system under an emulation mode.

Kernel: Most operating systems have a monolithic kernel whereby all the kernel
code is in a single binary. Microkernel architecture on the other
hand follows a modular approach, separating the core kernel code
from the rest of the system. With a microkernel the hardware layer can be
separate from the kernel allowing easy porting to different platforms. NGOS should use the
microkernel architecture to make it easier to port the operating
system to multiple platforms.

Even though Linux has a monolithic kernel it has still been successfully ported to more
platforms than any other operating systems. It uses modules for
device drivers and gives user an option to compile the code
into the kernel or user modules. Code in the kernel executes
significantly faster than modules.

64-bit computing: Most operating systems today were written for 32-bit processors
and are now being ported to 64-bit processors. Some older
operating systems were originally written for 16-bit processors
and ported to 32-bit processors.

Linux is a pure 32-bit operating system written from scratch for 32-bit processors. It
doesn't suffer from any 16-bit baggage code. Now Linux is being ported to various 64-bit processors. It will be a while before all the code is compiled and optimised to take advantage of 64-bit platforms.

The NGOS would be written for 64-bit processors because by the time the operating system would
ready for production use 64-bit processors will be the mainstream environment. There should also be some low-level layer which would allow the operating system to be executed on older 32-bit
architectures, but the goal for NGSO should be that it
is the fastest operating system on 64-bit processors.

Memory and filesystem: Older Linux kernels
such as 2.2.x were limited to 2GB of memory. The 2.4.x kernel is
limited only by the hardware architecture; the Intel x86 platform
supports up to 64GB.

The Linux filesystem ext2 is limited to 1TB of space and lacks journaling features. After a
system crashes or the computer is abruptly switched off it takes a
long time for the file system to recover. Journaling filesystems have automatic
rollback, which means they recover instantly from a crash. There
are four journaling filesystems under development on Linux.
ReiserFS, XFS, and ext3 are
already shipping with several Linux distributions. JFS is still a work in progress.

The NGOS should be designed in such a way that it doesn't face memory or filesystem limitations for at least a few hundred years and should offer a 64-bit or if possible 128-bit journaling filesystem.

User interface: Linux today stores files with names and extensions in directories or folders, all of which have associated permissions. It also supports NFS (Network File System)
whereby folders can be mounted over the network or the Internet and appear as
folders on the local system.

NGOS should dispense with files and folders and look at everything as an object, be it a file, a directory, a link, a Web site, an email, contact details (virtual business cards), an image, or a video. Objects would be stored in containers that users can search and browse. An application
would look for all objects with an associated tag (or identifier/filetype) within a container, which could be across a whole hard disk, or multiple disks. For example, I could have a container (similar to folder) called NewsForge within the root container (equivalent to C: or the /). The NewsForge container would have email messages, articles, and other files related to NewsForge. When I open up the email application, it would look up all the files within the root container. I could see all messages, as well as the NewsForge folder and its associated email messages. If I opened the NewsForge container in the file manager then I would all the data related to NewsForge with the file associations.

This approach allows for virtual folders, which could have files from the user's computer, from the Internet, or from other computers across the globe. To make access faster, containers would be automatically indexed in real time.

Files storage sorting: All operating systems today allow you to sort file data by date, size,
name, and extension. NGOS would allow data in addition to be sorted according to access date and number of accesses, and would have the capability to move unused data automatically into compressed containers. Compressed objects would be uncompressed on the fly when they are finally accessed. Objects would optionally be backed up to nearline media while they would still appear in the index of the file system.

For example, suppose a user has a file called "My Resume" which was created on January 1, 2000, and not accessed again. The system looks at files that have not been accessed for more than six
months and automatically compresses them. After say one year (a user-defined parameter) the system prompts the user, saying "You have 326 files that haven't been accessed in the last year. If you migrate these to a removable medium you would save 500MB of disk space. Your system is currently equipped with a CD writer. If you choose to backup on CD-R media (recommended) it would require 1 disk." Once the user backs up to CD-R media, the system reports, "Your data has been backed up on the CD-R. Please label it as backup taken on January 1, 2001, and backup number: 001."

At a later date, if a user searches for "resume," the system will show him "You have a file with that name on backup number 001 dated January 1, 2001." If the user chooses to
retrieve from the CD-R, the system prompts the user to insert the disk labeled
backup number 001, uncompresses the data, and puts the file back in the
same directory from which it was backed up.

GUI: Today's operating systems have different GUIs. Most of them have a single GUI
integrated with the core operating system. Linux has the X Window System sitting on top of the kernel. Above X sits a user interface such as Gnome or KDE. This modular design gives a lot
of flexibility but also creates performance issues. Users often find
the performance of Linux plus X plus KDE or Gnome is slower than many
other operating system. Linux has frame buffer support for a limited number of graphic cards but there are very few applications that can work on frame buffers.

NGOS would also follow a modular design but would do away with the shell prompt altogether. Its GUI would talk directly to the operating system. At the same time it would offer the flexibility to load different GUIs so that users can choose what interface they would like to see. This will also give the opportunity to develop the next generation user interface in the future and just plug it in without disturbing anything else. Users who still like a command prompt could execute a command shell such as bash and DOS on top of the GUI.

Security: Most of today's operation systems were not designed with security as a paramount goal. Linux is far more secure than operating systems such as Windows, but OpenBSD is more secure than Linux or any other operating system today. It's very difficult to have a completely secure operating system, but NGOS would be designed from scratch to be more secure than OpenBSD. It will also maintain secure identity for the users similar to Microsoft Passport but distributed. An organisation could have its own identity management tool which it could use internally as well as share with other organisations that it trusts. Linux today has LDAP, which can do authentication but is limited to certain applications, hence users have to log in multiple times. NGOS will have single signon similar to Novell's edirectory.

Those are just some ideas for operating system designers to consider. It may not be practical to re-write Linux completely from scratch, but anyone considering writing their own operating system may want to bear these ideas in mind.

What else should our NGOS offer? Please add your ideas below.

Advani, senior vice president of Netcore
Solutions Pvt. Ltd.
, has been working with
Linux since 1996. He is the the founder of FreeOS.com
and the co-founder of the IndLinux


  • Linux
Click Here!