Click here to Skip to main content
15,903,201 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Refresh connection or port to Remote DB Pin
nishkarsh_k22-Dec-07 20:48
nishkarsh_k22-Dec-07 20:48 
GeneralRe: Refresh connection or port to Remote DB [modified] Pin
Dave Kreskowiak23-Dec-07 4:21
mveDave Kreskowiak23-Dec-07 4:21 
GeneralPopulate ListView from TreeView Pin
ExcelMonkey21-Dec-07 6:00
ExcelMonkey21-Dec-07 6:00 
GeneralRe: Populate ListView from TreeView Pin
Dave Kreskowiak21-Dec-07 6:12
mveDave Kreskowiak21-Dec-07 6:12 
GeneralMultithreading Problem : Threads die before complete their assigned task Pin
Rupesh Kumar Swami21-Dec-07 2:42
Rupesh Kumar Swami21-Dec-07 2:42 
GeneralRe: Multithreading Problem : Threads die before complete their assigned task Pin
Dave Kreskowiak21-Dec-07 3:10
mveDave Kreskowiak21-Dec-07 3:10 
GeneralRe: Multithreading Problem : Threads die before complete their assigned task Pin
Rupesh Kumar Swami21-Dec-07 4:00
Rupesh Kumar Swami21-Dec-07 4:00 
GeneralRe: Multithreading Problem : Threads die before complete their assigned task Pin
MidwestLimey21-Dec-07 5:15
professionalMidwestLimey21-Dec-07 5:15 
I thought Dave explained it well enough .. but here goes my shot:

The major choke point in this scenario is the network connection.

High level, ignoring all the details and reality overview:
At heart your network connection is a serial line, pushing one byte at a time to and from your machine.
Those bytes are amalgamated into multiple byte sequences called packets. When a packet arrives at your machine it will be addressed to a logical port number (1-65535). Each of your threads having opened a connection to a remote peer will have a logical port number for that socket connection.

Thus you have 175 open connections, each uniquely addressed, each eagerly awaiting packets from the network connection.

However the first thing I said was that the network connection was serial in nature. Only ONE packet at a time can get through. So for any given moment only ONE thread can receive data. Given that the latency for the network is vastly greater (i.e. slower) then for the core(s) your threads are running on, the OS is happily context switching your threads in and out to do absolutly nothing for most of their lives.

Eventually the network connection (not the threads) time out due to inactivity or failure to tranfer the data - this behaviour is desired and shouldn't be altered unless absolutly necessary.

The best analogy I can think of is a cookie jar with a small opening. One person can reach in and take cookie after cookie. A dozen people reaching in will get their hands stuck and get few if any cookies.

To make a long story short, the optimal number of threads for this operation is : 1

I'm largely language agnostic

After a while they all bug me D'Oh! | :doh:


GeneralRe: Multithreading Problem : Threads die before complete their assigned task Pin
Dave Kreskowiak21-Dec-07 6:09
mveDave Kreskowiak21-Dec-07 6:09 
GeneralRe: Multithreading Problem : Threads die before complete their assigned task Pin
MidwestLimey21-Dec-07 6:40
professionalMidwestLimey21-Dec-07 6:40 
Questionwildcard search [modified] Pin
BOREC21-Dec-07 0:43
BOREC21-Dec-07 0:43 
GeneralRe: wildcard search Pin
Dave Kreskowiak21-Dec-07 3:04
mveDave Kreskowiak21-Dec-07 3:04 
GeneralRe: wildcard search Pin
BOREC21-Dec-07 8:33
BOREC21-Dec-07 8:33 
GeneralRe: wildcard search Pin
Dave Kreskowiak21-Dec-07 9:07
mveDave Kreskowiak21-Dec-07 9:07 
GeneralRe: wildcard search Pin
Luc Pattyn21-Dec-07 15:34
sitebuilderLuc Pattyn21-Dec-07 15:34 
GeneralRe: wildcard search Pin
Dave Kreskowiak21-Dec-07 15:52
mveDave Kreskowiak21-Dec-07 15:52 
GeneralRe: wildcard search Pin
Luc Pattyn22-Dec-07 4:18
sitebuilderLuc Pattyn22-Dec-07 4:18 
GeneralRe: wildcard search Pin
ChandraRam23-Dec-07 22:31
ChandraRam23-Dec-07 22:31 
QuestionHow to add shape controls to pictuirebox in vb.net Pin
VB 8.021-Dec-07 0:36
VB 8.021-Dec-07 0:36 
AnswerRe: How to add shape controls to pictuirebox in vb.net Pin
Dave Kreskowiak21-Dec-07 1:56
mveDave Kreskowiak21-Dec-07 1:56 
GeneralRe: How to add shape controls to pictuirebox in vb.net Pin
VB 8.021-Dec-07 3:01
VB 8.021-Dec-07 3:01 
GeneralRe: How to add shape controls to pictuirebox in vb.net Pin
Dave Kreskowiak21-Dec-07 3:32
mveDave Kreskowiak21-Dec-07 3:32 
GeneralRe: How to add shape controls to panel in vb.net Pin
VB 8.021-Dec-07 20:47
VB 8.021-Dec-07 20:47 
QuestionRegarding multithreading Pin
praveenkumar palla20-Dec-07 22:45
praveenkumar palla20-Dec-07 22:45 
GeneralRe: Regarding multithreading Pin
Dave Kreskowiak21-Dec-07 3:33
mveDave Kreskowiak21-Dec-07 3:33 

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.