Thứ Sáu, 12 tháng 3, 2010

Introduction of Programming with C# Threads -C# Programming

This paper provides an introduction to writing concurrent programs with “threads”. A threads facility allows you to write programs with multiple simultaneous points of execution, synchronizing through shared memory. The paper describes the basic thread and synchronization primitives, then for each primitive provides a tutorial on how to use it. The tutorial sections provide advice on the best ways to use the primitives, give warnings about what can go wrong and offer hints about how to avoid these pitfalls. The paper is aimed at experienced programmers who want to acquire practical expertise in writing concurrent programs. The programming language used is C#, but most of the tutorial applies equally well to other languages with thread support, such as Java.
Almost every modern operating system or programming environment provides support for concurrent programming. The most popular mechanism for this is some provision for allowing multiple lightweight “threads” within a single address space, used from within a single program.
Programming with threads introduces new difficulties even for experienced programmers. Concurrent programming has techniques and pitfalls that do not occur in sequential programming. Many of the techniques are obvious, but some are obvious only with hindsight. Some of the pitfalls are comfortable (for example, deadlock is a pleasant sort of bug—your program stops with all the evidence intact), but some take the form of insidious performance penalties.
The purpose of this paper is to give you an introduction to the programming techniques that work well with threads, and to warn you about techniques or interactions that work out badly. It should provide the experienced sequential programmer with enough hints to be able to build a substantial multi-threaded program that works—correctly, efficiently, and with a minimum of surprises.
This paper is a revision of one that I originally published in 1989 . Over the years that paper has been used extensively in teaching students how to program with threads. But a lot has changed in 14 years, both in language design and in computer hardware design. I hope this revision, while presenting essentially the same ideas as the earlier paper, will make them more accessible and more useful to a contemporary audience.

A “thread” is a straightforward concept: a single sequential flow of control. In a high level language you normally program a thread using procedure calls or method calls, where the calls follow the traditional stack discipline. Within a single thread, there is at any instant a single point of execution. The programmer need learn nothing new to use a single thread.
Having “multiple threads” in a program means that at any instant the program has multiple points of execution, one in each of its threads. The programmer can mostly view the threads as executing simultaneously, as if the computer were endowed with as many processors as there are threads. The programmer is required to decide when and where to create multiple threads, or to accept such decisions made for him by implementers of existing library packages or runtime systems. Additionally, the programmer must occasionally be aware that the computer might not in fact execute all his threads simultaneously.


C# is a language developed by Microsoft that is similar to Java. C# Custom Programming has the power of C++ which is combined with the simplicity of C#. This language is supposed to be the best language for Microsoft’s .NET programming for some applications.

Advantages of C# Custom Programming

* The language is similar to C++, C and Java and thus helps to increase the readability.
* Features such as object inheritance and class declarations available with .NET are more advanced and smooth in C#
* C# is a simple and involves less typing as it is less verbose
* As compared to the VB.Net code, C# code executes faster in some cases, which leads to speeding up of the whole application’s performance.
* Unlike VB, C# does not allow un-typed variables, undeclared variables along with un-typed methods.
* As the language is flexible it is preferred by Microsoft
* C# compilers are available in every platform such as Windows, Linux, Mac, Solaris etc.
* C# syntax is cleaner than VB. Net and also allows embedding of blocks of pure C++ code as per requirement.
* As compared to C++, C# Custom Programming is simpler, safer and is more productive.
* As C# has the ability to interoperate with other .NET codes the overall process of development gets a lot easier.
* C# helps in XML documentation that is generated from other source code comments.

Paladin Consultants has been offering custom software development services to its customers for last 20 years. We have a vast variety of software for different businesses such as accounting, CRM applications, and robotics, industrial and financial engineering programs. We have expertise in software development in Visual Basic, C, C++, .Net Technology, Java, FoxPro, dbase, SQL Server, JavaScript, etc.

Paladin Consultants is a .Net programming consultant that provides customized solutions & services as per the client’s requirement and project need. We follow the principles of rapid application development (RAD) along with object oriented programming (OOP) techniques along with libraries with reusable code. Programs are developed in standard platforms such as C++, Java, VB and .NET platform languages.

Find Programmers VietNam and more useful information about outsourcing, offshoring on Software Outsourcing.

Không có nhận xét nào:

Đăng nhận xét