VMWare Inc Interview Question
Software Engineer / DevelopersSystem calls are the functions provided to the user to perform a certain task. Whenever a user makes a call to the corresponding fn/syscall there is a TRAP (exception) that occurs to switch from user mode to the kernel mode and this jump is made without knowing in advance, what function is to be performed. The O.S handler(trap handler) further looks up at the location and takes an appropriate action.
The operating system is responsible for
Process Management (starting, running, stopping processes)
File Management(creating, opening, closing, reading, writing, renaming files)
Memory Management (allocating, deallocating memory)
Other stuff (timing, scheduling, network management)
An application program makes a system call to get the operating system to perform a service for it, like reading from a file.
System calls in 32 bit linux
To make a system call in 32-bit Linux, place the system call number in eax, then its arguments, in order, in ebx, ecx, edx, esi, edi, and ebp, then invoke int 0x80.
Some system calls return information, usually in eax.
All registers are saved across the system call.
The operating system is responsible for
Process Management (starting, running, stopping processes)
File Management(creating, opening, closing, reading, writing, renaming files)
Memory Management (allocating, deallocating memory)
Other stuff (timing, scheduling, network management)
An application program makes a system call to get the operating system to perform a service for it, like reading from a file.
System calls in 32 bit linux
To make a system call in 32-bit Linux, place the system call number in eax, then its arguments, in order, in ebx, ecx, edx, esi, edi, and ebp, then invoke int 0x80.
Some system calls return information, usually in eax.
All registers are saved across the system call.
The operating system is responsible for
Process Management (starting, running, stopping processes)
File Management(creating, opening, closing, reading, writing, renaming files)
Memory Management (allocating, deallocating memory)
Other stuff (timing, scheduling, network management)
An application program makes a system call to get the operating system to perform a service for it, like reading from a file.
System calls in 32 bit linux
To make a system call in 32-bit Linux, place the system call number in eax, then its arguments, in order, in ebx, ecx, edx, esi, edi, and ebp, then invoke int 0x80.
Some system calls return information, usually in eax.
All registers are saved across the system call.
The best analogy I could think about system call is that they are API provided to the application programmer to utilize the kernel functions such as open a file to read/write/execute done usin open/close etc.
- ZooZoo February 21, 2010I am not sure if this holds for all cpu architectures, but the system call is able to force the execution state of processor from user to kernel mode by executing code to generate software interrupt also called as SWI. The interrupt handling is always done in kernel mode and as system call map table is able to resolve SWI number with the particular functionality, thus the user is able to performed desired action provided by that particular system call implementer.