Hello i am a newbie here
i have a question about kernel threads(not kernel-only threads)
what's the difference between kernel threads and processes
i 've read this website
http://publib.boulder.ibm.com/infocente ... hreads.htm
and it says that the kernel threads can run both in user mode and in kernel mode
is it like a process, or it is a process?
Thx for any reply
About Kernel threads
Re: About Kernel threads
Processes have their own paging-environment, while threads share this environment with other threads. I suppose, that kernel threads will run in some kind of kernel process environment (true for RDOS at least, although it is possible to create kernel threads in a new process as well).
-
- Member
- Posts: 595
- Joined: Mon Jul 05, 2010 4:15 pm
Re: About Kernel threads
A thread is traditionally a kernel primitive where code is executed. A process is a primitive which controls the virtual address space. A thread must run in a virtual address space and therefore threads are associated with processes. The thread and process definitions tend to have different meaning in different operating systems.
Actually there is some ambiguity with kernel threads.
It can mean a thread that runs in kernel mode and has no user process associated with it.
Sometimes it also means a thread that runs in user space but is controlled by the kernel (the thread is a known resource by the kernel and it controls it for example scheduling).
Actually there is some ambiguity with kernel threads.
It can mean a thread that runs in kernel mode and has no user process associated with it.
Sometimes it also means a thread that runs in user space but is controlled by the kernel (the thread is a known resource by the kernel and it controls it for example scheduling).
Re: About Kernel threads
So according to that document, its kernel thread is similar to a kernel-only thread except that it drop to ring3 unless doing syscalls.A kernel thread is a kernel entity, like processes and interrupt handlers; it is the entity handled by the system scheduler. A kernel thread runs in user mode environment when executing user functions or library calls; it switches to kernel mode environment when executing system calls.
The main different from process is that it share the same address space with the kernel and other kernel-threads.
Re: About Kernel threads
In my design, a process is a kernel paging environment that has nothing to do with user applications. A process can exist with or without a user application running within it. What you call process above is called an "application" in my design, and several applications can be nested in the same process. This is an artifact from the DOS-time, but still somewhat useful. On RDOS command line interpreter, one has to add the detach (@) operator in order to run something in a new process.OSwhatever wrote:It can mean a thread that runs in kernel mode and has no user process associated with it.
-
- Posts: 4
- Joined: Sat Jun 18, 2011 3:36 am
Re: About Kernel threads
Thx a lot for the replies
i got bad grades in OS class
i have another quetion
http://stackoverflow.com/questions/1178 ... nel-thread
this website explains the mapping between the user thread and kernel thread
according to the website, every user mode process will maps to a kernel thread when it is created
can i see kernel thread as a data structure which stores the information of processes mapped with it?
and the scheduler in kernel is the one who decides which kernel threads(and the process mapped) is going to executes next?
Am i right?
i got bad grades in OS class
i have another quetion
http://stackoverflow.com/questions/1178 ... nel-thread
this website explains the mapping between the user thread and kernel thread
according to the website, every user mode process will maps to a kernel thread when it is created
can i see kernel thread as a data structure which stores the information of processes mapped with it?
and the scheduler in kernel is the one who decides which kernel threads(and the process mapped) is going to executes next?
Am i right?
Re: About Kernel threads
For me, a thread is an independent execution unit (you can safely put several threads on various CPU cores on an SMP system, which noticeably implies a different stack and different register states), whereas a process is an independent protection unit (own address space, limited access to hardware and system services, etc...). The difference between kernel and user threads is where each one is managed : kernel threads are managed in the kernel, which allows it to take account of them for things like scheduling decisions. On the other hand, user threads are managed by user-space libraries, which means that for all the kernel knows they might as well not even exist.
You can imagine having threads without processes, if your kernel executes several tasks simultaneously without any kind of protection. On the other hand, processes without threads are much harder to envision : if your processes are separated from each other by kernel protection, they should at the very least use a separate set of registers and a separate stack.
You can imagine having threads without processes, if your kernel executes several tasks simultaneously without any kind of protection. On the other hand, processes without threads are much harder to envision : if your processes are separated from each other by kernel protection, they should at the very least use a separate set of registers and a separate stack.