Monday, November 23, 2009

Parallel computing on Windows

With the advent of the multicore world the need for parallelism increased a lot. Until now one way to improve the application performance was to increasing the CPU clock speed. Because of some hardware limitation is very hard for hardware vendors to increase the CPU clock speed but instead they can add more and more cores to CPUs. At this moment most of the laptops and desktop computers have CPUs with 2 cores at least.

A trivial e.g. of code that can be executed on more CPUs:

1. c -> a and b
2. if (c is bigger than 0)
3. foreach( i to c)
Compute(module(i))

Let's say that we have a computer with a CPU that has 256 cores. If we can use all the cores and execute Compute(module(i)) on each core at any given moment you will have a major performance improvement. Having a CPU with 256 cores can sound a bit ridiculous but let’s look at the history. In 1995 the fastest computer was an IBM machine with 512 CPUs and weights a few tons also the power consumption was very high. At this moment a high-end GPU has the same computation power like that IBM machine and this happen only in 16 years.

In the new version of .NET Framework Microsoft added new classes to have support for multicore called Task Parallel Library. This TPL exposes parallel constructs For and ForEach loops using the regular methods and delegates. Writing multithread application is quite a challenging task; the most notorious problem is the deadlock when 2 threads wait each other to release a resource.

Prior to Windows Server 2008 and Windows 7 at the OS level only 64 cores are supported and that mainly because of a "hot" lock called Dispatcher Lock. What is this lock and why is "hot"? In order for a thread to be executed by the CPU it needs to acquire this lock. When you have a relative small number of cores the CPU contention is not very high. If the number of core grows then you will have a lot of cores that they will try to acquire this lock.

If the lock is not acquired the core will spin and do nothing. The NT kernel was design by David Cutler and when the kernel was design having more the 16 cores on a CPU were more like Sci-Fi. Arun Kishan, a kernel developer, took this issue as a side project and manages to remove this lock and he replaces it with a much finer synchronization primitives and now Windows Server 2008 and Windows 7 can scale up to 256 core. This is a very good news for everyone that creates threads.

There are some cases when having multiple threads on a machine with just one core can be a good thing. Why is that? Because in some cases you can have a thread doing some IO operation that can take long if your harddrive is fragmented (there is a lot of seeking) and all this time the CPU will spin and do nothing. As a rule of thumb when you have a case like in my small e.g. with the Compute(module(i)) try to use ThreadPool or TPL. ThreadPool is able to reuse threads inside the pool, TPL is more advanced and it will be part of .NET 4.0. It has concepts like work stealing, worker thread local pool, scheduling groups of actions.


The material prepared by Stefan Tabaranu

Bookmark and Share

Tuesday, November 3, 2009

Weekly Wrap-up. Windows 7's usage jumps by 40%, but overall Microsoft's share continue to drop

According to Web measurement company Net Applications the share of new Microsoft OS has jumped by 40% in the week following its release.


While overall Windows OS's share continue to decline, dropping 0.23 of a percentage point in October, Windows 7 share jumped by more than 39% and averaged 2.66% for week after its release. The highest rate Windows 7 reached on Saturday, October 31 averaging 3.48% that represented even larger 82% increase. However, for the whole month the system ended up with a market share of 2.15%, which is 41% more than 1.52% of September figures. According to Net Applications one in every 44 PCs run Windows 7 last month.

But, such a rapid increase might be due to excess usage of spurious copies in Russia and Eastern Europe countries, Net Applications said. Of the top 25 countries by usage, 17 are in Eastern Europe. Slovenia in the lead with 7.8% of all computers ran Windows 7 last month, number 3 is Lithuania with 6.5% following by Romania with 6% of all computers used Windows 7.

According to the Business Software Alliance, an industry-backed anti-piracy organization the piracy rate in Central and Eastern Europe was the highest in global perspective in 2008. The percentage of all properly licensed software used in Slovenia averaged 47% last year, which is more than double the rate in the U.S. Lithuania, Romania, Latvia and Russia with 54%, 66%, 56% and 68% respectively.

Although, Microsoft Corp places great hopes on Windows 7, which already gained some reputation, the overall Windows share continue to drop. Microsoft's most popular OS ever lost 0.64% on average during past year, failing to 70.6% while its another product a widely-criticized Vista lost market share in September for the first time in almost two years. The main recipient of former Microsoft users is Apple. Its Mac OS X operating system share climbed by 0.15% at the end of October averaging 5.27% setting a new record for Apple.

Thursday, October 29, 2009

Microsoft offers second beta for Visual Studio 2010

Microsoft will offer the second beta of its upcoming Visual Studio 2010 software development platform and the accompanying .Net Framework 4 programming platform. The Visual Studio platform is being reduced from nine different packaging options to just three primary options.

“The feedback that we’ve heard from our customers was [nine options] was too complicated,” said Mendlen. “There were too many packages to choose from.” The three primary packages, featuring MSDN subscriptions, include:

Visual Studio 2010 Ultimate with MSDN, featuring the full suite of tools including ALM products. Testing and architecture tools also are featured. It carries a price tag of $11,924 for a new customer and $3,841 for a current customer renewing with Microsoft.

Visual Studio 2010 Premium with MSDN, featuring the Visual Studio toolset but lacking some architecture capabilities of the Ultimate edition. Some of Microsoft’s ALM suite is included. Premium costs $5,469 for new users and $2,299 for customers seeking renewals.

Visual Studio 2010 Professional with MSDN, for basic development tasks. It includes the core version of Visual Studio. It costs $1,199 for a new user and $799 for a renewal.”

Thursday, October 15, 2009

Weekly Wrap-up. While there's a lot of noise about the UI challenge between Windows 7 vs Mac OS X some claim that Windows 7 needs a universal updater.

There is a lot of speculations around new OS's from Microsoft and Apple with the intentions to identify who invented what and what ideas has been stolen. The interest significantly grow after recent story "Apple versus Microsoft" published at InforWorld. The article marked the top 20 ideas that both houses have stolen from each other during years and provides slideshows on the stolen features.

Although, the emphasis has been given mostly on two new Windows 7's features - the task bar and Aero Peek it doesn't necessarily mean that Microsoft leads in the list of stolen ideas. For example, the co-called Mac Finders's sidebar, according to the article has been taken from Navigation pane in Windows XP. The conclusion is that the borrowing process has been going for a long time and will continue to go on. A long list of major features eventually became a part of the computing landscape and it would be useless to try to find the roots.

Much more important for both Apple and Microsoft nowadays and in the future is to keep innovation on the place, as users become mature and selective, and it might be a problem even for such a popular OS as a Windows, especially when new the rival Google's Chrome comes to the market.

Although, Google many times has been blamed for stealing ideas from Apple yet it has its unique approach for user-friendliness, which might play as a main trigger for further innovation.

Apart from large-scale OS's wars let's turn to more realistic issues. Last month Apple was widely criticized for pushing the iPhone configuration utility to Windows users who have the Apple updater installed as the software was utterly useless to the majority of computer users, most of whom don't even own iPhones. That occasion proves that there is no need to have individual updater applications for Windows, Java, Apple and others as the universal updater is exactly the solution that can manage all updates for all software. As a result Mac's, Wins and other users can configure their updates, permit or restrict some particular updates and decide when the updates are allowed to occur.

An universal updater would obligate software developers dealing with it to comply with policies governing how applications is to be used. It would would remove the frustration of tediously removing updaters from each applications as well as return some control back to the user, and keep all relevant applications up to date.

According to Michael Scalisi an IT manager, an universal updater can provide a great benefits to users making Windows more flexible platform.

Monday, October 12, 2009

Microsoft creates tools for migration from LINQ to SQL to ADO.NET Entity Framework.

It is widely known that in the last release of the Microsoft.NET Framework there are two built-in object-relational mapping (ORM) solutions. One is LINQ to SQL and another ADO.NET Entity Framework. While the first one was introduced earlier in the .NET 3.5 and Visual Studio 2008, an ADO.NET Entity Framework appeared later on in the .NET 3.5 SP1 with support in the Visual Studio 2008 SP1.

Although ADO.NET Entity Framework is younger and provides more simplistic functionality than LINQ to SQL it has gained recognition and being developed very dynamically by Microsoft. Its new version will be improved and enhanced with new features in the upcoming release of the .NET framework..

Moreover, Microsoft has already released the first version of Visual Studio 2010 templates for LINQ to SQL (.dbml) metadata migration to ADO.NET Entity Framework (.edmx) models which proves their strategical intentions to abandon LINQ to SQL in favour of ADO.NET Entity Framework.

That said, it does not necessarily mean that one day all software built using LINQ to SQL will stop working, but it could cause serious obstacles for the migration of existing applications to the following versions of the .NET Framework. From this perspective ADO.NET Entity Framework is undoubtedly more attractive for cost-effective and low-risk migration solutions.


The article has been prepared by Denis Nikolayenko. The original version of this article on Russian can be found here

Tuesday, September 29, 2009

The new attack code poses a threat on Vista users, while Windows 7 and XP crack-resistant.

The Microsoft is under the pressures after hackers have publicly released the new attack code that exploits a critical bug in the line of Microsoft oprating systems, including Windows Vista Service Pack 1 and 2, Windows 2008 SP1, SP2 server.

Although this vulnerabilty issue has been known since Spetember the publicly available programs that can use that bug haven't been able to do anything except crash the operating system. However, a new attack code developed by Harmony allows to run unathorized software on cracked PC making it much more serious problem for Microsoft. The attack code was added to the company's open-source Metasploit penetration testing kit making the code widely available.

From other side, a software company called Immunity recently developed its own attack code for the bug, but that code is available only to the company's paying subscribers. And although the atack code is claimed to potentially work on both Windows Vista and Windows 2008 (Service Pack 1 and 2) the code may not be completely reliable, according to Immunity Senior Researcher, who stressed that he could get the Metasoft Attack to work only on the Windows Vista operating system running within a VMware virtual machine session. He added "When he ran it on native Windows systems, it simply caused the machines to crash."

In turn a Metasploit developer said that the attack definitely worked on at least some physical machines, but looks like it could use more testing.

Either way, the public release of this code should put Windows users on alert. Security experts worry that this code could be adapting to create a self-copying worm attack, much like last year's Conficker outbreak. It might seems strange but unlike Conficker, this attack would not affect older Windows XP, Windows Server 2003,or Windows 2000 systems. That's because the underlying flaw that all of these programs exploit lies in the SMB (server message block) version 2 system, introduced firstly in Vista.

Microsoft has confirmed that Immunity's attack works on 32-bit versions of Vista and Windows Server 2008, but did not have any immediate comment on the Metasploit code.

According to Immunity Senior Researcher the flaw has been patched in Windows 7, yet Microsoft released a Fix tool that disables SMB 2, and the company said that it is working on a fix for the software.

Thursday, September 24, 2009

Weekly Wrap-Up. Summary of some top stories in the past week.

In the search war Bing grabs 11% of search market, while Microsoft introduces new tools for secure application development.

According to recent results from analyst company Nielsen, Microsoft Corp's Bing continues to strengthentening its position on the search engine market and demonstrated steady growth by 9% in July and 10.7% in August. Such performance has made Bing the fastest growing search engine on the market, where still three major competitors, with Google long ahead are trying to take their stakes. Although, Bing still far behind Google, its verges towards Yahoo Inc.'s search engine position, that showed 4.2% decline from July. However, the emphasis might shift once Microsoft and Yahoo enter into a partnership after passing an antitrust muster. The agreement allows Bing to power Yahoo's Web sites, while Yahoo will drive sales of premium search advertising services for both companies. That movement
could unite two giants and give them a needed leverage in ongoing battle against the leader.

On other side, Microsoft continues to show its commitement to making Security Development Lifecycle (SDL) process real for developers and presented new testing tools to help Windows programmers build better security into their C and C++ applications. Symbolically the tools offered at no cost enablig implementation of Microsoft's SDL process, for injecting security and privacy provisons into the development lifecycle as opposed to testing during pre- and post deployment of application.

One of the tools, BinScope Binary Analyzer, analyzes binary code to validate adherence to SDL requirements for compilers and linkers. By checking a variety of SDL requirements like GS flag, which is used to prevent buffer overflows it also verifies use of strong-named assemblies and up-to-date build tools. The tool requires symbol files, providing security against hackers potentially using the tool to analyze software on the Web for weaknesses.

A Microsoft representative said many of the checks featured in BinScope Binary Analyzer are inherently built into .NET coding. Microsoft previously has released a threat management tool and process management template based on SDL.

The second tool, Microsoft MiniFuzz File Fuzzer implements the fuzz testing technique. Testers check application behavior by parsing files that have been deliberately corrupted. Security tests are applied to take code through different flow patterns and identify whether resulting crashes should be investigated as potential application security risks.

Microsoft has recently released a paper entitled "Manual Integration of the SDL Process Template," to guide Microsoft Visual Studio Team System users through a manual process to incorporate elements of the SDL process template into Team System projects.

Thursday, September 10, 2009

Microsoft starts to work on Windows 8

With approaching of Windows 7 on the offer there are some questions arise whether Windows 7 will be the last Microsoft traditional operation system. And will the next version of Windows be completely cloud-based?

So what's the next? Windows 8, of course, and Microsoft has posted several job listings for developers to help with work on Windows 8, however in can have another naming by the time its launched. There is an example of those listings:

“For the upcoming version of Windows, new critical features are being worked on including cluster support and support for one way replication. The core engine is also being reworked to provide dramatic performance improvements. We will also soon be starting major improvements for Windows 8 where we will be including innovative features which will revolutionize file access in branch offices.”

It looks like Microsoft already works hard on the new storage technology "Distributed File System Replication", which is focused on keeping data synchronized across multiple servers. And another Windows 8 job posting focusing on Windows file system tells that Windows 8 Server will also show up.