what is multithreading and how do i do it in vb.net?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Multi-threading is the concept of making a program do multiple things concurrently. A common use case is to do some intense processing in the background, while keeping the UI thread alive and responding to messages, or to split up a large problem and parallellize the finding of a solution across multiple CPUs (or cores).
You can add multithreading to your .NET application by working with the Thread class.
Note that making multi-threaded stuff work usually requires careful synchronization handling, using concepts like mutexes and semaphores. Without this, you can run into various issues that can be insanely difficult to locate, because they do not appear in a deterministic fashion, since it’s now up to the OS to schedule processing time to each thread. A saying I’ve heard several times is that threads are evil. What that means is that they always run when you don’t want them to run, inevitably running into that one place you aren’t doing proper synchronization – but when you then try to find the error, you can’t duplicate it with the debugger running, because now, the OS schedules the threads slightly differently, avoiding the bug.