|
hai,
what is the limit for number threads we can create in our machine...i heard that is 2000...is it right?
if it is so, den Using IOCP in a thread pool, how many threads, we can create..?
reply me
Mani
Born to win...!
|
|
|
|
|
I don't know if there is a real physical limitation but for you, I think the limitation will be how far would you accept the slowdown of your program ? Using that many threads will bring your program to its knees and it will spend more time switching between the threads than doing effective things.
Some people already told you that, so why do you want to go that direction ? Why do you want to try to readh the limits of your system ? It's certainly not the most efficient way to do it.
|
|
|
|
|
hai,
just i want to know the maximum limit for the threds when Using IOCP...,
Creating that many threads is the complex way, that is correct...i am accepting...
but i want to know how many threads we can create in IOCP....
Born to win...!
|
|
|
|
|
As stated in MSDN the maximum maximorum number of threads you can create is 2028.
That is the limit for the default stack size of 1 MByte.
However if you increase the stack size (see dwStackSize, second parameter in CreateThread documentation), the number of threads that can be created decreases accordingly.
-- modified at 3:31 Friday 23rd November, 2007
... and don't forget to count the threads already existent ...
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
I'm not sure if I answered this for you a couiple days ago, but here it is again...
There's almost NO need to have more threads than you have processors.
There's never going to be more threads than the number of available processors
executing at the same time, so any other threads are sitting there wasting memory
and other resources.
The whole idea of an IOCP is based on these facts. The IOCP acts like a FIFO queue
where each operation is queued to the next available thread. It's extremely efficient in
both speed and resource usage, since you only need at most, a couple threads per processor.
If you're even considering the maximum number of threads Windows is going to let you create,
then an IOCP is useless and you're going to have a serious performance problem with
your application.
Here's some handy articles - they are socket related, but the same IOCP principles apply
(IOCPs can be used for more than just servers )
Writing Windows NT Server Applications in MFC Using I/O Completion Ports[^]
Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports[^]
INFO: Design Issues When Using IOCP in a Winsock Server[^] <-- see tip #2 here for choosing thread pool size!!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
<quote>
There's almost NO need to have more threads than you have processors.
Just almost.
Ovidiu Cucu
Microsoft MVP - Visual C++
Cofounder CODEXPERT.RO
|
|
|
|
|
Yes, almost. For threads that wait for periods of time, like doing device I/O,
there can be an advantage having more threads since during those
I/O waits other threads can get some work done.
It's something that has to be tuned depending on what the threads are or
can be doing, available resources, etc.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Friends,
Im using TWAIN in my application(SDI) to capture the image using digital camera.
I dont want to use the Sources UI. So I want to use my own UI for preview. ie:View as my UI.
Plz anybody help me..
Thanks in advance,
Reagards
Shiva
|
|
|
|
|
Have you studied the "Alternative User Interfaces" section of the TWAIN Specification?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ya Mark,
But im exactly not gettting how to implement it.
can u halp me..?
Reagards
Shiva
|
|
|
|
|
I worked out the .ico file use "Axialis IconWorkshop", with 2 icons in.
One is (16*16 256), the other is (32*32 256).
ID is IDR_MAINFRAME.
When I run the program, the icon in the about dialog has been replaced with the new one. But the icon where the system menu hasn't been replaced. Why?
|
|
|
|
|
Did you use of SetIcon(hIcon,True); and SetIcon(hIcon,False); ?
|
|
|
|
|
I set it after LoadFrame, it's ok now, thanks.
|
|
|
|
|
I gald you could solve it.;)
|
|
|
|
|
Is it possible this is an MDI/SDI app, and it's using the documents icon for the system menu, rather than your IDR_MAINFRAME one?
Iain.
|
|
|
|
|
surely
I set it manually, it's ok now, thanks.
|
|
|
|
|
I have to generate a web page with dynamic controls with data coming from database.Depending upon control type coming from database i have to create a control in the web page and assign value to it which comes from database. web control values also comes from database.Could any body can help me in this.
|
|
|
|
|
You have some values of your database and know you want to read them and eneter to web controls,whats problem? does IHTMLDocument* helpful for you?
|
|
|
|
|
Hello everyone,
I wrote a program to read GPS sentence from Serial Port of an PDA, the code works well at low baudrate,for example 4800. But when I Transfer it to an heigh speed device baudrate at 38400 it does not work.
I have already found the problem lays at the flowing code:
if(ClearCommError(port->m_hComm,&errCode,&comState) == TRUE)
result = ReadFile(port->m_hComm,m_readbuf,comState.cbInQue,&nLength,NULL);
comState.cbInQue always return 0, so ReadFile reads nothing.
Does anyone know any reason to this problem? thanks
|
|
|
|
|
COM-Ports often are very "individual" in timing. Try wait funtion or change some settings.
Supports the PDA this data rate?
Greetings from Germany
|
|
|
|
|
You have to use overlapped IO when you are using serial ports. And handling overlapped IO can be rather difficult.
There are quite a few articles about serial comm here at CP.
Use the code from one of them, they all use overlapped IO.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
First, you have to make sure that the PDA device supports the baudrate you're trying to use like KarstenK suggested.
Second, you should really use overlapped I/O (asynchronous), as kakan also suggested for many reasons.
One reason that may not be so obvious is that any code you post may seem all right at a glance, but suffers from timing issues since it is supposed to be synchronous which makes it hard for us to help you. When you're not using overlapped I/O, the serial port driver can only complete one IRP at a time, which means that while you're blocking on a read operation you cannot issue a write operation.
Read this article[^] to get started with overlapped I/O.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thank you all.
Sorry I forgot to tell the target operating system is WM5.0, and as I know it doesn't support Overlapped IO for Serial port. Please inform me if it's not correct.
The parameters to Set up the com is right, and if i change my code like this, it works all right
if(ClearCommError(port->m_hComm,&errCode,&comState) == TRUE)
result = ReadFile(port->m_hComm,m_readbuf,512,&nLength,NULL);
So, I'm wondering why comState.cbInQue equals 0 while It is fine at low baud rate
|
|
|
|
|
Is it possible to Dynamically change the Tabbing order in a Dialog When It is actually Excecuting.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: Is it possible to Dynamically change the Tabbing order in a Dialog When It is actually Excecuting.
Use SetWindowPos without specifying SWP_NOZORDER . The hwndInsertAfter parameter decides which control precedes this control of yours in the tabbing order. Look up MSDN on SetWindowPos and hwndInsertAfter .
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|