Click here to Skip to main content
16,004,529 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Multithreading slower? Pin
Luc Pattyn6-May-10 8:34
sitebuilderLuc Pattyn6-May-10 8:34 
GeneralRe: Multithreading slower? Pin
Luc Pattyn6-May-10 12:38
sitebuilderLuc Pattyn6-May-10 12:38 
GeneralRe: Multithreading slower? [modified] Pin
NikWing6-May-10 13:23
NikWing6-May-10 13:23 
General!!!DO NOT DUPLICATE CODE!!! Pin
Luc Pattyn6-May-10 13:37
sitebuilderLuc Pattyn6-May-10 13:37 
GeneralRe: !!!DO NOT DUPLICATE CODE!!! Pin
NikWing6-May-10 14:03
NikWing6-May-10 14:03 
GeneralRe: !!!DO NOT DUPLICATE CODE!!! Pin
Luc Pattyn6-May-10 14:12
sitebuilderLuc Pattyn6-May-10 14:12 
GeneralRe: !!!DO NOT DUPLICATE CODE!!! Pin
NikWing6-May-10 14:57
NikWing6-May-10 14:57 
GeneralRe: !!!DO NOT DUPLICATE CODE!!! Pin
Dave Kreskowiak6-May-10 16:57
mveDave Kreskowiak6-May-10 16:57 
It's not that odd when you consider that starting a thread is a very expensive operation by itself. And, judging by the code that has been written and discussed with Luc, it's not written with threading in mind. Just launching a second copy of the same code you wrote for a single threaded operation in another thread does not mean it's correct for multiple thread operation. Much greater care must be taken to make sure you don't introduce resource contention bottlenecks (access collections, I/O operations, ...) and situations where two or more threads are all waiting on each other to give up control, called a deadlock, as well as others.

Chances are your single-threaded code has to be scrapped and completely rewritten if you want to support multiple threaded operation. And even then, that's no guarantee your entire operation is going to run faster than the single threaded version. You also have to look at what you're doing. Keep in mind that your every day disk can't read more than one part of a disk at any one time, so, depending on your software design, only one thread will get data at any one time. Your algorithm could conceivably thrash the disk, moving the heads back and forth between two areas of the disk constantly, trashing the disk cache and spending more time seeking the heads than reading a segment of data.

A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008
But no longer in 2009...




GeneralRe: !!!DO NOT DUPLICATE CODE!!! Pin
NikWing7-May-10 0:43
NikWing7-May-10 0:43 
GeneralRe: Multithreading slower? Pin
Luc Pattyn6-May-10 13:57
sitebuilderLuc Pattyn6-May-10 13:57 
GeneralRe: Multithreading slower? Pin
NikWing6-May-10 14:21
NikWing6-May-10 14:21 
AnswerRe: Multithreading slower? Pin
Luc Pattyn6-May-10 6:14
sitebuilderLuc Pattyn6-May-10 6:14 
AnswerRe: Multithreading slower? Pin
supercat96-May-10 6:54
supercat96-May-10 6:54 
GeneralRe: Multithreading slower? Pin
NikWing6-May-10 7:56
NikWing6-May-10 7:56 
GeneralRe: Multithreading slower? Pin
supercat96-May-10 9:11
supercat96-May-10 9:11 
GeneralRe: Multithreading slower? Pin
NikWing7-May-10 0:50
NikWing7-May-10 0:50 
QuestionMaximum number in an array? Pin
Adam Wike6-May-10 4:51
Adam Wike6-May-10 4:51 
AnswerRe: Maximum number in an array? Pin
Luc Pattyn6-May-10 5:04
sitebuilderLuc Pattyn6-May-10 5:04 
AnswerRe: Maximum number in an array? Pin
dan!sh 6-May-10 5:06
professional dan!sh 6-May-10 5:06 
GeneralRe: Maximum number in an array? Pin
Adam Wike6-May-10 7:36
Adam Wike6-May-10 7:36 
GeneralRe: Maximum number in an array? Pin
Adam Wike7-May-10 4:08
Adam Wike7-May-10 4:08 
QuestionOutlook Addin Pin
Dominick Marciano5-May-10 10:48
professionalDominick Marciano5-May-10 10:48 
QuestionAddIn stopped working Pin
Sonhospa5-May-10 2:38
Sonhospa5-May-10 2:38 
AnswerRe: AddIn stopped working Pin
tosch5-May-10 3:43
tosch5-May-10 3:43 
GeneralRe: AddIn stopped working Pin
Sonhospa5-May-10 6:01
Sonhospa5-May-10 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.