On threads and processes
Posted: Sat Feb 28, 2009 10:03 pm
Hi,
I have been starting to implement multitasking stuff in my kernel (written in C++) recently, and am thinking of doing an implementation similar to the Pedigree kernel, where I have a process class and a thread class. The scheduler would then have a vector of threads that it would schedule from. Now, as each process needs its own virtual address space, I am going to put that in its own class, which keeps track of the page directory, and wraps around the paging functions. Originally, I was planning on this keeping track also of the process' stack pointer, and base pointer, but now I've read that each thread has its own stack. So should I make a stack class to do this? How about the thread's instruction pointer - should I just store that as a member of the thread class, or keep that in the stack class?
Thanks.
I have been starting to implement multitasking stuff in my kernel (written in C++) recently, and am thinking of doing an implementation similar to the Pedigree kernel, where I have a process class and a thread class. The scheduler would then have a vector of threads that it would schedule from. Now, as each process needs its own virtual address space, I am going to put that in its own class, which keeps track of the page directory, and wraps around the paging functions. Originally, I was planning on this keeping track also of the process' stack pointer, and base pointer, but now I've read that each thread has its own stack. So should I make a stack class to do this? How about the thread's instruction pointer - should I just store that as a member of the thread class, or keep that in the stack class?
Thanks.