System Call and Its Type
System Call and Its Type
System calls provide an interface between the process and the operating system.
System calls allow user-level processes to request some services from the
operating system which process itself is not allowed to do.
In handling the trap, the operating system will enter in the kernel mode, where it
has access to privileged instructions, and can perform the desired service on the
behalf of user-level process.
Trap occur when the system call is made to terminate the currently running
program abnormally, or if the program runs into a problem and causes an error
trap, a dump of memory take place sometimes and error message is
generated.
For I/O a process involves a system call telling the operating system to read or
write particular area and this request is satisfied by the operating system.
File management
Device management
Information maintenance
Communications
1) Process Control:
A running program needs to be able to stop execution either normally or
abnormally.
When execution is stopped abnormally, often a dump of memory is taken and
can be examined with a debugger.
Following are functions of process control:
3) Device Management:
A process may need several resources to execute - main memory, disk drives,
access to files, and so on. If the resources are available, they can be granted,
and control can be returned to the user process. Otherwise, the process will have
to wait until sufficient resources are available.
The various resources controlled by the OS can be thought of as devices. Some
of these devices are physical devices (for example, tapes), while others can be
thought of as abstract or virtual devices (for example, files).
Once the device has been requested (and allocated to us), we can read, write,
and (possibly) reposition the device, just as we can with files.
Functions:
o request device, release device
4) Information Maintenance
Many system calls exist simply for the purpose of transferring information
between the user program and the OS. For example, most systems have a
system call to return the current time and date.
Other system calls may return information about the system, such as the number
of current users, the version number of the OS, the amount of free memory or
disk space, and so on.
In addition, the OS keeps information about all its processes, and system calls
are used to access this information. Generally, calls are also used to reset the
process information.
Functions:
get time or date, set time or date
5) Communication
There are two common models of interprocess communication: the message-
passing model and the shared-memory model. In the message-passing model,
the communicating processes exchange messages with one another to transfer
information.
In the shared-memory model, processes use shared memory creates and shared
memory attaches system calls to create and gain access to regions of memory
owned by other processes.
Recall that, normally, the OS tries to prevent one process from accessing
another process's memory. Shared memory requires that two or more processes
agree to remove this restriction. They can then exchange information by reading
and writing data in the shared areas.
Message passing is useful for exchanging smaller amounts of data, because no
conflicts need be avoided. It is also easier to implement than is shared memory
for intercomputer communication.
Shared memory allows maximum speed and convenience of communication,
since it can be done at memory speeds when it takes place within a computer.
Problems exist, however, in the areas of protection and synchronization between
the processes sharing memory.
Functions:
o create, delete communication connection