lkml.org 
[lkml]   [1999]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: system call overheads


On Thu, 14 Jan 1999, Robert Fish wrote:

>
> I am trying to time various stages of system call execution. Over a
> million iterations it appears to take 2 microseconds for a Pentium75 to
> start executing the nominated handling function. A Pentium II 300 is
> slightly faster at 1 microsecond, but both seem slow compared to
> other (older Sparc based) architectures.
>
> I have scoured the web trying to find out what happens in the
> time between an application issuing the "int 0x80" instruction and the
> execution of the system call handler (system_call in
> /usr/src/linux/arch/i386/kernel/entry.S).
>
> What happens before the kernel side (system_call) handler gets called ???
> Using RH5.1 kernel version 2.1.119.

Find an Intel reference manual and have look at the description of the
int and iret instructions. Both need a lot of microcode to perform their
tasks and access several structures kept in memory:

- int $0x80 from user mode accesses:
1) an 8 byte entry in the IDT
2) an 8 byte code segment descriptors (in the GDT)
3) 8 bytes in the TSS to get the new stack since the privilege
level changes
4) an 8 byte stack segment descriptor (in the GDT)

every one of these accesses is followed by complex validity checks
(segment present, correct privilege level or type...) even if you only
take the 32 bit protected mode case into account. It finally pushes 20
bytes on the stack (ss/esp/eflags/cs/eip). Do not forget that the
processor has to do all of this or nothing (internal state can't change
until the processor has determined that all memory accesses can be
performed, for example that they don't cause a page fault).

- iret to user mode also performs complex checks and at least has to
access 2 segment descriptors for user mode code and stack segments.
But it is significantly simpler than int $0x80.


Gabriel.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.119 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site