Standard functions can be classified into two major categories:
1. Library function calls
2. System function calls
How does system calls switch modes ?
1. Library function calls
2. System function calls
Library Functions
|
System Calls
|
They are part of standard C library and executes in user space. Eg:
strcmp(), malloc()
|
These functions change the execution mode of the program from user
mode to kernel mode. Eg: open(), read()
|
Library functions may or may not make system calls.
|
They are called by library functions and executed by kernel.
|
Library functions are portable i.e. an application using library
functions will run on every system.
|
An application relying on system call may not run on every system as
system call interface may vary from system to system.
|
Library functions can be debugged using a debugger.
|
System calls cannot be debugged as they are executed by kernel.
|
Traditionally, the mechanism of raising an interrupt of ‘int
$0x80′ to kernel was used. After trapping the interrupt, kernel processes it
and changes the execution mode from user to kernel mode. Today, the
systenter/sysexit instructions are used for switching the execution mode.
No comments:
Post a Comment