Sunday, April 17, 2016

A Few Pros and Cons of UNIX

I don't like pros and cons discussions on operating systems, since the people who need to read it won't, but as the old sage said: Why do you have a mind, if you cannot change it?

USB Support

The Windows device names of USB serial ports keep on changing.  I have seen a machine in our lab using COM57:.  That means that half a hundred times, some poor engineer sat in front of that machine and wondered why on earth his serial port wasn't working.

Trying to deploy a system that uses USB serial ports on Windows is a nightmare, since each and every machine has a different setup and it changes at a whim, so you need to open up low level configuration to the end user and try to explain to him how to change it in the manual and have a technician on standby to support all the users who won't read the manuals.

IT services also like to disable USB mass storage support, since Windows suffers from a 25 year old security bug that Microsoft is unable to fix.  So whenever an engineer captures data on an oscilloscope/network analyzer/ spectrum analyzer/camera system on a USB memory stick, he has no way to view the data on the PC and has to go and find a Linux PC.

Now multiply all that wasted engineering time by all the other Windows machines in your lab.

File Systems

UNIX is a Rosetta Stone of file systems.  It has specialized storage solutions for everything: Large block flash chips, small block flash chips, spinning metal, big files, small files, redundancy, logical volumes, RAID, compression, encryption, snapshots, deduplication...

Windows has only two file systems, NTFS and ReFS.  No, that other one isn't really a file system.

With deduplication on Btrfs or Zfs, if you copy a file, it doesn't use any more disk space.  Just think about that one for a second, then go and read up on snapshots and then hold a moment of silence for the Windows users.

Windows NTFS can do deduplication in 32KB chunks on server versions, but it cannot handle large files >200GB.   A large file can cause the whole file system to get corrupted.  So if you need to store video, then you are out of luck.

Real-Time Operation

Linux has been a real-time OS for more than ten years - since 2002 - fixed by Ingo Molnar while in Calgary, Canada.  On single processor machines, the spin locks compile away.  On multi-processor machines, spin locks are pre-emptable.  The latest Completely Fair Scheduler excels at distributing the work load over the machine cores and it consistently reacts to interrupts in a few microseconds.  BSD and OSX are not bad either.

Windows Vista and 7 have an old fashioned priority scheduler with coarse time slices of 15 ms and slow, non-preemptible interrupt handlers. The result is that whereas an interrupt is usually handled in 10 us, it could sometimes take 500 ms.

Some programs, notably .Net and Chrome, change the Windows 7 time slice to 1 ms, same as on Windows 8 and 10, but it doesn't help significantly.  The Windows debugger and latency measurement tools do not provide an accurate picture, which indicates to me that the tools are starved too and therefore cannot measure time accurately.  This is probably due to contention and non pre-emptable spin locks.  

The Windows scheduler is strictly priority based.  As long as there are processes with a higher priority than yours, then your process will get scheduled ZERO processing time.

Contention and deadlock is handled very inefficiently on Windows.  Processes that are blocked, will periodically have their priority raised to a very high level and will get a big time slice.  This can result in very irregular execution of other time sensitive processes.

.Net has a garbage collector that is really bad on Windows.  When it runs, everything else stops.  This causes bad artifacts when playing real-time video with .Net on a Windows system.  MS is working on porting .Net to Mac OSX and Linux, where it should work much better, but it is still early days.

Windows does not handle multiprocessing properly.  Threads stick to the processor core that it first ran on.  When many processes start up and some shut down after a while, the remaining ones will not be redistributed to even the work load.  They even invented a nice sounding name for this mis-feature, called processor affinity, as if that is a good thing.

If your medium priority process is stuck on a core with high priority tasks, then your process will not run, despite there being idle cores, or cores loaded with low priority tasks.

The whole mess is described here:

In order to maintain smooth video playback on Windows, you need to maintain very large buffers of 1.5 to 3 seconds.  Therefore, Windows can play streaming television, but it cannot play video from a real-time observation camera with a hand controller properly.

Windows doesn't scale.  Due to the bad scheduler, adding processor cores and memory, does not make a Windows machine significantly faster.

Link Aggregation

Windows desktop OS doesn't support more than one ethernet port properly.  To do any 'advanced' routing, you need a server version and support from a third partyAlso note that 'Teaming' doesn't increase your bandwidth, it just creates multiple redundant routes - do not confuse it with Link Aggregation on UNIX.

LAGG and advanced routing is of course a native part of any UNIX/Linux/Mac OS and many (most?) fancy switches and routers actually run Linux.

Mandatory Access Control

Windows by default allows any program to overwrite or delete anything.  This is the reason for the scourge of viruses/malware/macroviruses/ransomware on Windows systems.  Windows Access Control Lists and Mandatory Access Control don't really work.  If it did work, then we would not have these plagues of malware.   

MS Windows is the Street Urchin of computer systems.  An administrator has to scrub his hands up to his elbows after touching a Windows system, to prevent spreading malware infections.

On UNIX systems, there is strong separation between users, administrators, services and application programs and their data of all kinds.  The security configuration is strongest on Red Hat systems with SELinux and Novel systems with App Armor and weakest on Ubuntu, but even Ubuntu doesn't suffer from the MS scurvy.


Linux runs on anything, from embedded computers to super computers.  There are billions of servers, cell phones and routers that run Linux.  It is the most popular OS ever and for many good reasons.  One being ease of installation.

It is a simple matter to make a mirror server with a complete Linux distribution, including all the source code and then install new machines from there, completely automatically, with no user intervention, in about 20 minutes.  After that, you will have a fully functional computer with all the tools and applications that you could possibly want, all set up and ready to go.  This way, you can roll out thousands of computers that will all be configured identically, even if the hardware is not identical, since Linux is smart enough to install the correct device drivers.

Installing Windows is a whole different matter.  There are about 12 different types of Windows, but mainly you need to decide whether you need a server or a desktop.  If you subscribe as a Beta tester, then you can download Windows for free.  Installing it will take a few hours and after that, you will have a completely useless system with no applications to do anything productive.  Well, unless you think that Notepad and Calc are useful and please don't blame me for the spyware.


Well, I got to mention one or two, otherwise I have to change the title.

UNIX isn't unfriendly.  It is just very choosy about who exactly its friends are. 

Or as Denis put it:

UNIX is simple and coherent, but it takes a genius (or at any rate, a programmer) to understand and appreciate its simplicity.

Dennis Ritchie (1989) "Unix: A Dialectic".
UNIX can be rather complicated.   You may even have to read a book or three, but once you got it working, it will keep working, it will not get infested with malware, it will not slow down over time and it will be very low maintenance.  I first studied UNIX postgrad in 1985.  It really hasn't changed much since from a user point of view, so the time spent reading books and man pages was a good investment.

. -.-. .-. .- ... . --..  .-.. .  .. -. ..-. .- -- .


No comments:

Post a Comment

On topic comments are welcome. Junk will be deleted.