We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9
System Calls
• A system call is the programmatic way in which a computer program
requests a service form the kernel of the OS it is executed on . This may include hardware-related services , creation and execution of new processes, and communication with integral kernel services such as process scheduling. • OS provides a variety of system calls to control the process. Almost all modern processes provide instruction that can be used as system calls Concept Of System calls • The more fundamentals level of services is handled through the use of system calls ,System calls provide the interface between current running program and the Operating System. • These calls are generally available as routines in C and C++,although certain low level tasks may need to be written using assembly language instructions. • System calls allow user-level processes to request some services from the OS which process itself is not allowed to do. • For example for I/O a process involves a system call telling the OS to read or write particular area and this request is satisfied by OS.
User Mode(mode bit=1)
User process U User Process Calls system Return from System call executing Calls
Trap mode bit=0
Kernel Return mode bit=1
Execute System Call
Kernel mode(mode bit=0)
• Application developers often do not have direct access to the system
calls,but can access them through an application programming interface. • The functions that are included in API invoke the actual sytem calls. • Three most common APIs are win32 API for windows,POSIX (Portable Operating System Interface)API for POSIX-based systems(including virtually all versions of UNIX,Linux,and Mac OS X),and Java API for the java virtual Machine(JVM).By using the API,certain benefits can be gained. • 1.Portability: 1.As long a system supports an API , any program using that API can compile and run. • 2.Ease Of Use: 1.Using the API can be significantly easier then using the actual system call. (Note:API is a set of C language functions and variables. On a UNIX system, the functions are mostly system calls) System Call Parameters • Three general methods exist for passing parameters to the os: • 1.Parameters can be passed in registers. • 2.When there are more parameters than registers , parameters can be stored in a block and the block address can be passed as a parameter to a register. • 3.Parameters can also be pushed on a popped off the stack by the OS. a.Passing Parameters in System Calls b.System Call Implemenation • Above figure shows implementation of a system call.Basically a number is associated with each system call.It is used to number the system calls. • System call interface maintains a table indexed according to these numbers . The system call interface invokes intended system call in OS kernel and returns status of system call and any return values. • The caller needs to know nothing about how the system call is implemented. • Just needs to obey API and understand what OS will do as a result call. • Most details Of OS interface hidden from Programmer by API • It is managed by run time support library. Types Of System Calls Types Of System Calls 1.Process Control: 1.Process control is the system call that is used to direct the processes. 2.Some process control examples include creating, load, abort, end, execute, process , terminate the process, etc. 2.File Management: 1.File management is a system call that is used to handle the files. 2. Some file management examples include creating files, delete files, open, close, read, write, etc. 3.Device Management 1.Device management is a system call that is used to deal with devices. 2.Some examples of device management include read, device, write, get device attributes, release device, etc. 4.Information Maintenance 1.Information maintenance is a system call that is used to maintain information. 2.There are some examples of information maintenance, including getting system data, set time or date, get time or date, set system data, etc. 5.Communication 1.Communication is a system call that is used for communication. 2. There are some examples of communication, including create, delete communication ,connections, send, receive messages, etc.