Date: Tue, 18 Jan 2005 12:31:54 -0600 (CST) From: Zera William Holladay <zholla1@uic.edu> To: freebsd-hackers@freebsd.org Subject: Re: Kernel mode programming Message-ID: <Pine.GSO.4.58.0501181155420.12626@icarus.cc.uic.edu> In-Reply-To: <2540.208.4.77.168.1106070768.squirrel@208.4.77.168> References: <002201c4fd4a$c5a81230$0700a8c0@felix> <20050118140523.GE3054@empiric.icir.org> <Pine.GSO.4.58.0501180957340.7134@icarus.cc.uic.edu> <2540.208.4.77.168.1106070768.squirrel@208.4.77.168>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 18 Jan 2005, Ryan Sommers wrote: > Zera William Holladay said: > > Even if the application were run as a kernel module, how much of a > > performance benefit could there be when making system calls? I suspect > > that the module would get a higher scheduling priority but realistically > > wouldn't the module still have to make system calls in the same manner > > that a regular user process does? I really don't know, so would some kind > > soul tell me please? > > > > -Zera Holladay > > The kernel is already running in privileged mode on the CPU so there is no > need for a system call. Technically the kernel never has to make a system > call. A system call is just a well defined method of transitioning between > user and supervisor code. Since the kernel is already supervisor code > there is no need to make a system call. > > Whenever a program makes a system call it has to generate an interrupt, > this is the extra savings he is talking about. By already executing in the > kernel his code does not have to suffer the overhead of an interrupt > handler and can just make a jump to the syscall handler. My understanding is that when a system call is made from a user process, there is a trap into the kernel, the state of the user process is saved and the address of the system call is determined by a looking up the address of the system call in vector table. I assume that a kernel module would at least have to push the parameters of the system call, push some of its registers, jump to the address space of the system call and return. Further I assume, the kernel would have to copy the parameters of the system call to another address, since it is possible for the call to be interrupted and some of the parameters to be corrupted. I am really asking a question out of blind ignorance in an attempt to learn more about what goes on with the kernel. What is the difference between a system call made from the kernel and a system call made from user code? Thanks, Zera
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.58.0501181155420.12626>