A process consists of two parts: a process object and an address space. The thread also has two components: one isThe kernel object of the thread,OneThread stack.
A process is not lively and never chooses anything. It is only a thread dependency. The thread executes code in its process space. And operate in the process address space.
Createthread function (a Windows function used to create a thread. However, if you are writing C/C ++ code, you should never call createthread. Instead, use the VisualC ++ Runtime library function _ beginthreadex)
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES psa,
DWORD cbStack,
LPTHREAD_START_ROUTINE lpStartAddr,
LPVOID lpvThreadParam,
DWORD fdwCreate,
LPDWORD pdwThreadID
);
Parameter description:
Psa
Pointer to the security_attributes structure. Pass null, which is the default attribute of the thread's kernel object. Set to the security_attributes structure.
CbStack
The number of address spaces that a high thread may use for its own stack. (Note: The stack space is in the process space .)
LpStartAddr
Specifies the address (name of the thread function) of the thread to be executed by the new thread ).
PvParam
The parameter is the same as the pvparam parameter that was previously passed to createthread. The only thing to do is to pass the data transmission to the thread function when the thread starts execution. It can be a numeric value. It can also be a pointer to a data structure.
FdwCreate
Set other signs used to control the creation of fire fighting tanks. There are two values0(Schedule now ),
Create_suincluded(The system can completely create a thread and initialize it. It is not commonly used to suspend the running of the thread and the thread cannot be scheduled.
PdwThreadID
It must be a valid address of DWORD, which is used to store the ID assigned to the new thread by the system.
Fangsh
2010-12-27