This is a discussion on Threading in VB.Net Tips within the VB.NET Programming forums, part of the Software Development category; Hi all, Here is some tips and answers about threading concept in VB.Net. Check it out......
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all, Here is some tips and answers about threading concept in VB.Net. Check it out...
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| Sponsored Links |
| |||
| What is Multi-tasking ? It’s a feature of modern operating systems with which we can run multiple programs at same time example Word, Excel etc.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What is Multi-threading ? 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.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What is a Thread ? A thread is the basic unit to which the operating system allocates processor time.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Did VB6 support multi-threading ? 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.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Can we have multiple threads in one App domain ? 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.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Which namespace has threading ? Systems.Threading has all the classes related to implement threading. Any .NET application who wants to implement threading has to import this namespace.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| How can we change priority and what the levels of priority are provided by .NET ? 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
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What does AddressOf operator do in background ? 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
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| How can you reference current thread of the method ? "Thread.CurrentThread" refers to the current thread running in the method. "CurrentThread" is a public static property.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What's Thread.Sleep() in threading ? 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, Code: Thread.CurrentThread.Sleep(2000)
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| How can we make a thread sleep for infinite period ? You can also place a thread into the sleep state for an indeterminate amount of time by calling Thread.Sleep (System.Threading.Timeout.Infinite). To interrupt this sleep you can call the Thread.Interrupt method.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What is Suspend and Resume in Threading ? It is Similar to Sleep and Interrupt. Suspend allows you to block a thread until another thread calls Thread.Resume. The difference between Sleep and Suspend is that the latter does not immediately place a thread in the wait state. The thread does not suspend until the .NET runtime determines that it is in a safe place to suspend it. Sleep will immediately place a thread in a wait state.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What the way to stop a long running thread ? Thread.Abort() stops the thread execution at that moment itself.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| What is Thread.Join() in threading ? There are two versions of Thread.Join :- √ Thread.join(). √ Thread.join(Integer) this returns a Boolean value.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| The Thread.Join method is useful for determining if a thread has completed before starting another task. The Join method waits a specified amount of time for a thread to end. If the thread ends before the time-out, Join returns true; otherwise it returns False. Once you call Join, the calling procedure stops and waits for the thread to signal that it is done. Example you have "Thread1" and "Thread2" and while executing 'Thread1" you call "Thread2.Join()".So "Thread1" will wait until "Thread2" has completed its execution and the again invoke "Thread1". Thread.Join(Integer) ensures that threads do not wait for a long time. If it exceeds a specific time which is provided in integer the waiting thread will start
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ASP.net threading issue when populating a listbox | $enthil | ASP and ASP.NET Programming | 6 | 11-04-2007 11:24 PM |
| How to implement threading in VB.Net? | amansundar | VB.NET Programming | 2 | 10-30-2007 07:41 AM |
| Threading in C# .Net 2005 : | a.deeban | C# Programming | 53 | 09-10-2007 07:27 AM |
| When working with shared data in threading how do you implement synchronization in a | oxygen | ASP and ASP.NET Programming | 1 | 07-26-2007 04:07 AM |
| what is the threading model used for ASP.Net? | mobilegeek | ASP and ASP.NET Programming | 1 | 07-21-2007 01:48 AM |