|
Its a feature of modern operating systems with which we can run multiple programs at
same time example Word,Excel etc.
|
|
|
Multi-threading forms subset of Multi-tasking instead of having to switch between programs
this feature switches between different parts of the same program.Example you are writing
in word and at the same time word is doing a spell check in background.
|
|
|
A thread is the basic unit to which the operating system allocates processor time.
|
|
|
While VB6 supports multiple single-threaded apartments, it does not support a freethreading
model, which allows multiple threads to run against the same set of data.
|
|
|
One or more threads run in an AppDomain. An AppDomain is a runtime representation
of a logical process within a physical process.Each AppDomain is started with a single
thread, but can create additional threads from any of its threads.
|
|
|
Systems.Threading has all the classes related to implement threading.Any .NET application
who wants to implement threading has to import this namespace.
|
|
|
Thread Priority can be changed by using Threadname.Priority = ThreadPriority.Highest.In
the sample provided look out for code where the second thread is ran with a high priority.
Following are different levels of Priority provided by .NET :- √ ThreadPriority.Highest √ ThreadPriority.AboveNormal √ ThreadPriority.Normal √ ThreadPriority.BelowNormal √ ThreadPriority.Lowest |
|
|
The AddressOf operator creates a delegate object to the BackgroundProcess method. A
delegate within VB.NET is a type-safe, object-oriented function pointer. After the thread
has been instantiated, you begin the execution of the code by calling the Start() method
of the thread.
|
|
|
"Thread.CurrentThread" refers to the current thread running in the
method."CurrentThread" is a public static property.
|
|
|
Thread's execution can be paused by calling the Thread.Sleep method. This method takes
an integer value that determines how long the thread should sleep.Example
Thread.CurrentThread.Sleep(2000).
|
|
Threading FAQ's
Labels:
Threading