System Calls

Programming interface to the services provided by the OS
Typically written in a high-level language (C or C++)
Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use
Three most common APIs are Win32 API for Windows, POSIX 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)

System Call Implementation

Typically, a number associated with each system call
ystem-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 the system call and any return values
The caller need 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

System Call Parameter Passing

Often, more information is required than simply identity of desired system call

Three general methods used to pass parameters to the OS
(1). Simplest: pass the parameters in registers (In some cases, may be more parameters than registers)
(2). Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register (This approach taken by Linux and Solaris)
(3). Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system (Block and stack methods do not limit the number or length of parameters being passed)