Click here to Skip to main content
15,891,767 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: File Serialization versus old style data saving on files Pin
toxcct22-May-08 6:30
toxcct22-May-08 6:30 
GeneralRe: File Serialization versus old style data saving on files Pin
CPallini22-May-08 7:28
mveCPallini22-May-08 7:28 
AnswerRe: File Serialization versus old style data saving on files Pin
Hamid_RT22-May-08 6:46
Hamid_RT22-May-08 6:46 
AnswerRe: File Serialization versus old style data saving on files Pin
David Crow22-May-08 6:48
David Crow22-May-08 6:48 
QuestionProblem with CHttpFile and HTML Pin
Sylv3322-May-08 4:06
Sylv3322-May-08 4:06 
QuestionHow long int can the threads ID be... Pin
pl_kode22-May-08 4:03
pl_kode22-May-08 4:03 
AnswerRe: How long int can the threads ID be... Pin
CPallini22-May-08 4:13
mveCPallini22-May-08 4:13 
AnswerRe: How long int can the threads ID be... Pin
Mike Dimmick22-May-08 4:39
Mike Dimmick22-May-08 4:39 
pl_kode wrote:
Please let me know how big or max int can a thread's ID be. i.e. how many digits a thread ID can be.


Microsoft do not document the range of the thread ID. On desktop Windows it is currently a handle into the kernel handle table and is therefore typically a number between 4 and a few thousand, but this is not true on Windows CE. You should allow for any value between 0 and 4,294,967,295.

Also kindly tell me how many, at the max, threads can run at the same time. Max number of threads running at the same time, what is it.


The number of threads that can be created is limited only by the amount of memory in the system. For any given process this is approximately the amount of virtual address space divided by the stack reservation size (normally 1MB, so 1500 is typically the maximum on a 32-bit system). The number of threads that can actually be running on CPU cores concurrently is the number of CPU cores. The number of threads in the runnable state (not blocked, waiting for a CPU) is also effectively unlimited, limited only by the amount of memory in the system.

It takes a finite amount of time to switch between one thread and another, and because of round-robin scheduling, if there are a lot of threads to run, it can take a long time between two time slices for a given thread. (When a thread's time slice expires, it goes on the end of the queue of threads to run.) In many cases the context-switch overhead tends to dominate the overall runtime, causing throughput to be lower than if you queued requests to run on a smaller pool of threads.

Windows has a handy concept called an I/O Completion Port which, once a thread is associated with it, will track when that thread blocks due to some other wait (for I/O, comms, sleep, whatever, as long as it's ultimately waiting on an OS object) and if there's a thread waiting for work, work is queued, and there are fewer than a threshold of threads already running, the thread that most recently started waiting for work is released. This generally keeps the number of runnable threads down. Scalable servers on Windows generally use I/O Completion Ports (SQL Server uses its own scheduler with asynchronous I/O so only has one thread per CPU core.)


DoEvents: Generating unexpected recursion since 1991

QuestionProblem with select row in list control Pin
tataxin22-May-08 2:56
tataxin22-May-08 2:56 
AnswerRe: Problem with select row in list control Pin
David Crow22-May-08 3:28
David Crow22-May-08 3:28 
GeneralRe: Problem with select row in list control Pin
tataxin22-May-08 3:43
tataxin22-May-08 3:43 
QuestionRe: Problem with select row in list control Pin
David Crow22-May-08 4:16
David Crow22-May-08 4:16 
AnswerRe: Problem with select row in list control Pin
tataxin22-May-08 4:35
tataxin22-May-08 4:35 
GeneralRe: Problem with select row in list control Pin
David Crow22-May-08 5:41
David Crow22-May-08 5:41 
AnswerRe: Problem with select row in list control Pin
tataxin22-May-08 5:49
tataxin22-May-08 5:49 
QuestionGetDIBits Pin
subramanyeswari22-May-08 2:54
subramanyeswari22-May-08 2:54 
AnswerRe: GetDIBits Pin
CPallini22-May-08 3:30
mveCPallini22-May-08 3:30 
AnswerRe: GetDIBits Pin
Hamid_RT22-May-08 4:21
Hamid_RT22-May-08 4:21 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 18:18
subramanyeswari22-May-08 18:18 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:01
Hamid_RT22-May-08 19:01 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:07
subramanyeswari22-May-08 19:07 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:17
Hamid_RT22-May-08 19:17 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:22
subramanyeswari22-May-08 19:22 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:29
Hamid_RT22-May-08 19:29 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:34
subramanyeswari22-May-08 19:34 

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.