System Calls
System Calls
Purpose:
System call provides an interface between a running program and
operating system. It allows user to access services provided by
operating system. This system calls are procedures written using C,
C++ and assembly language instructions. Each operating system has
its own name for each system call. Each system call is associated with
a number that identifies itself.
Examples:
● Create/ Terminate process
● Load/Execute Process.
● End/Abort process.
● Ready process/Dispatch process.
● Suspend process/Resume Process.
● Get/Set Process Attributes.
● Wait event, signal event
● Allocate and deallocate memory
2) File Control:
• We can identify several common system calls dealing with files. We
first need to be able to create and delete files such a system call
requires the name of the file and perhaps some of its attributes.
• Once, the file is created, we need to open it and use it. We may also
read, write and reposition. Finally we need to close the file, indicating
that we are no longer using it.
Examples:
● create new file, delete existing file
● open, close file
● Create and delete directories
● read, write, reposition
● get/set file attributes
3) Device Management:
When a process is in running state, it requires several resources to
execute.
These resources include main memory, disk drives, files and so on. If
the resource is available, it is assigned to the process.
Once the resource is allocated to the process, process can read,
write and reposition the device.
Examples:
• request device, release device
• read, write, reposition
• get device attributes, set device attributes
• logically attach or detach devices
4. Information Maintenance:
• Many system calls exist simply for the purpose of transferring
information between the user program and the operating system. 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 operating
system, the amount of free memory or disk space and so on.
• In addition the operating system keeps information about all of its
jobs and processes and there are system calls to access this
information. Generally, there are also calls to reset it. (get process
attributes and set process attributes).
Examples:
a. Get Time or Date, Set Time or Date.
b. Get system Data, Set system Data.
c. Get process, File or Device attributes.
d. Set process, File or Device attributes.
5. Communication
• There are two models of inter-process communication, the
message-passing model and the shared memory model.
• Message-passing uses a common mailbox to pass messages
between processes
• Shared memory use certain system calls to create and gain access
to regions of memory owned by other processes
Examples:
• create, delete communication connection
• send, receive messages
• transfer status information
• attach or detach remote devices.