Where can i find information about whats going behind the scene when creating thread? [closed]
Where can i find information about whats going on behind the scene when Im creating a new thread ?
when i write
Thread t = new Thread ()
....
t.start()....
i want to know what actually is going on... can you please redirect me ?
Although managed threads don't necessarily behave the same way as native threads, have a look at this article which covers the basic premise:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681917(v=vs.85).aspx
Specifically, when you create a thread the code will be running in the context below:
A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. In addition, each thread maintains exception handlers, a scheduling priority, thread local storage, a unique thread identifier, and a set of structures the system will use to save the thread context until it is scheduled. The thread context includes the thread's set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread's process. Threads can also have their own security context, which can be used for impersonating clients.
Just so it's here as an answer, Jeffrey Richter's CLR via C# will probably† teach you stuff you don't know about CLR internals.
And here's Joe Duffy's Concurrent Programming on Windows
† in a statistical sense
精彩评论