COMP 3000 Essay 1 2010 Question 2: Difference between revisions

From Soma-notes
Sblais2 (talk | contribs)
Sblais2 (talk | contribs)
Line 14: Line 14:




=== Linux Systems Calls (2.6.30+) ===
The Linux operating system (2.6.30+) contains hundreds of system calls. They are roughly grouped into 5 major categories: Process Control, File Management, Device Management, Information Maintenance and Comminution. The code belonging to the system calls, defined by the system call number in /usr/inlude/asm/unistd.h can be found in the kernel source in the routine sys_xxx() (xxx represents the system call number). The dispatch table for i386 can be found in /usr/src/linux/arch/i386/kernel/entry.S. Over time, changes to the interfaces of some system calls have been necessary for example, the need to increase the size of structures or scalar values passed to the system call. Because of these changes, there are now similar system calls which varies in detail (size of their arguments for example).
The Linux operating system contains hundreds of system calls. They are roughly grouped into 5 major categories: Process Control, File Management, Device Management, Information Maintenance and Comminution. The code belonging to the system calls, defined by the system call number in /usr/inlude/asm/unistd.h can be found in the kernel source in the routine sys_xxx() (xxx represents the system call number). The dispatch table for i386 can be found in /usr/src/linux/arch/i386/kernel/entry.S. Over time, changes to the interfaces of some system calls have been necessary for example, the need to increase the size of structures or scalar values passed to the system call. Because of these changes, there are now similar system calls which varies in detail (size of their arguments for example).


= References =
= References =

Revision as of 18:05, 8 October 2010

Question

How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.

Answer

System Calls

Overview

A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same.


In general, a process is not supposed to be able to access the kernel directly. It cannot access kernel memory and it can't call kernel functions. The hardware of the CPU prevents this (called "protected mode"). System calls are an exception to this rule. The process fills the registers with the appropriate values and then calls a special instruction which then go to a previously defined location in the kernel. Under x86 CPUs, this is done using the interrupt 0x80. Once the interrupt is used, the hardware knows that once you jump to this location, you are not running in restricted user mode anymore but as the operating system kernel, or kernel mode. You are now allowed to do whatever you want. The location in the kernel a process can jump is called 'system_call'. The procedure at that location checks the system call number, specifying to kernel which service the process requested. The table of system calls (sys_call_table) is accessed to determine the address of the kernel function to call. The function is then called and returned. After it returns, the system call procedure does a few system checks and then return back to the process.


The Linux operating system (2.6.30+) contains hundreds of system calls. They are roughly grouped into 5 major categories: Process Control, File Management, Device Management, Information Maintenance and Comminution. The code belonging to the system calls, defined by the system call number in /usr/inlude/asm/unistd.h can be found in the kernel source in the routine sys_xxx() (xxx represents the system call number). The dispatch table for i386 can be found in /usr/src/linux/arch/i386/kernel/entry.S. Over time, changes to the interfaces of some system calls have been necessary for example, the need to increase the size of structures or scalar values passed to the system call. Because of these changes, there are now similar system calls which varies in detail (size of their arguments for example).

References

Here is the original manual --Lmundt 18:29, 7 October 2010 (UTC) http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html

The Linux KErnel Module Programming Guide by http://www.faqs.org/docs/kernel/x931.html