Tuesday, February 19, 2008

Linux vs UNIX

Linux miss some features that make it a sophisticated modern operating system for advanced computer hardware.

POSIX
The IEEE's Portable Operating Systems based on UNIX (POSIX) and X/Open's Common Applications Environment (CAE) specify only an application programming interface (API). However, the standards do not impose any restriction on internal choices of a compliant kernel. The kernel of the Linux version 2.6 aims to complaint with the POSIX. This means that most of the existing UNIX programs can be compiled and executed on a Linux system with little effort or even without the need for patches to the source code.

Linux
Linux was initially developed by Linus Torvalds in 1991 (1990 4.3BSD-Reno, 1991 NET/2, 1993 Linux, 1994 4.4BSD Lite-1). After many years of development, Linux includes all the features of a modern UNIX operating system, it is compare to the other UNIX kernels with the following differences:
  • Monolithic kernel - Mach and its variants use the microkernel approach
  • Use of modules - Linux is able to automatically load and unload modules on demand (i.e. device drives). Among the commercial UNIX variants, only SVR4.2 and Solaris kernels have a similar feature.
  • Kernel threading - Linux uses kernel threads in a very limited way to execute a few kernel functions periodically; however they do not represent the basic execution context abstraction. UNIX kernels of Solaris and SVR4.2/MP are organized as a set of kernel threads.
  • Multithreaded application support - A multithreaded user application could be composed of many lightweight processes (LWP), which are processes that can operate on a common address, common physical memory pages, common opened files, and so on. While all the commercial UNIX variants of LWP are based on kernel threads, Linux regards LWP as the basic execution context and handles them via the nonstandard clone() system call.
  • Preemptive kernel - When compiled with the "Preemptible Kernel" option, Linux 2.6 can arbitrarily interleave execution flows while they are in privileged mode. Solaris and Mach 3.0 are fully preemptive kernels.
  • Multiprocessor support - Linux 2.6 support SMP for different memory models including NUMA: the system can use multiple processors and each processor can handle any task. However, a few parts of the kernel code are still serialized by means of a single "big kernel lock".
  • Filesystem - Linux object-oriented Virtual File System technology allows porting a foreign filesystem to Linux easily. Linux comes with the standard Ext2, Ext3 and ReiserFS, AIX's JFS, and IRIX's XFS filesystem.
  • STREAMS - Linux has no analog to the STREAMS I/O subsystem which is used in writing of device drivers, terminal drivers, and network protocols.
Note on STREAMS
Original work on the flexible configuration of IPC processing modules was done in UNIX V8. The V8 stream I/O system was adopted in SVR3 as the STREAMS system. The Streams I/O System was based on UNIX character I/O system. It allowed a user process to open a raw terminal port and then to insert appropriate kernel-processing modules, such as one to do normal terminal line editing. Modules to process network protocols also could be inserted. Stacking a terminal-processing module on top of a network-processing module allowed flexible and efficient implementation of network virtual terminals within the kernel. Therefore, it is possible to connect kernel-resident modules dynamically in a stack-oriented fashion, and to have these modules process data sent and received on an I/O stream.

A problem with stream modules is that they are inherently linear in nature, and thus they do not adequately handle fan-in and fan-out associated with multiplexing in datagram-based networks; such multiplexing is done in device drivers, below the modules proper. The design of the networking facilities for 4.2BSD took a different approach, based on the socket interface and a flexible multilayer network architecture. The 4.4BSD release made small extensions to the socket interface to allow the implementation of the ISO networking protocols.