Sunday, May 24, 2009

CONCURRENCY AND WINDOWS DO NOT MARRY !

THE UNFAITHFUL MARRIAGE !

WINDOWS does not support multithreading concurrent and real-time structures. What an irony !.The most popular OS does not allow systems and structures which can control the most breathtaking technologies of the day. Aerospace , trains, nuclear power plants and other state of the art embedded technologies cannot use WINDOWS !

When I learned about Real-Time and Concurrent Systems ,it was not very acceptable that Microsoft would make such a redundant OS. A bit of dabbling on the internet led me to
Article Number 22523 in Microsoft knowledge base.

Fig1. Article 22523
Which clearly stated that ,

"In no sense can Microsoft Windows be considered a "real-time" system. It is a message-driven, event-polling system, with nonpreemptive scheduling".

Being initiated in Windows and using it for about ten years , did make me stubborn and I tried to look for other alternatives which would
allow to construct real-time structures in Windows.

Cygwin came to my rescue ! However on running threads in POSIX and tasks in Ada, I realised that it is only a cheap makeover.

Python and Ada however worked in windows , Ada because it is a concurrent language and platform is not an issue. Python did execute the threads , though on a closer inspection it revealed that Python reduces the concurrent codes to their sequential evil twin brother.

A simple code which which prints out 'Hello World' and the thread number ;

Fig 2. The threading code

gives slightly different results with different OS. When run on Ubuntu Linux ,

Fig 3. Execution in Ubuntu

The order of execution of the threads is 3,4,1,5,2 then 1,2,3,4,5 and then 5,4,3,2,1. Thus the order of execution is non-deterministic , typical of real-time systems.

However on Windows ,

Fig 4. Execution in Windows, 'evil twin brother'

the order of execution is deterministic , as seen above. Thus windows prevents the real-time characteristics of non-determinism and reduces it to sequential processes.

Linux confirms the standard characteristics of concurrency as nondeterminism and preemption , hence a joy for all concurrent programmers. Seems Bill Gates got it wrong this time !



No comments: