0% found this document useful (0 votes)
43 views2 pages

Unit1-What Is A System Call

Uploaded by

hrajaa16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

Unit1-What Is A System Call

Uploaded by

hrajaa16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

What is a System Call

A system call is a method for a computer program to request a service from the kernel of the operating
system on which it is running. A system call is a method of interacting with the operating system via
programs. A system call is a request from computer software to an operating system's kernel.
The Application Program Interface (API) connects the operating system's functions to user programs.
It acts as a link between the operating system and a process, allowing user-level programs to request
operating system services. The kernel system can only be accessed using system calls. System calls are
required for any programs that use resources.
The interface between a process and an operating system is provided by system calls. In general, system
calls are available as assembly language instructions. They are also included in the manuals used by the
assembly level programmers.
System calls are usually made when a process in user mode requires access to a resource. Then it
requests the kernel to provide the resource via a system call.
Types of System Calls
There are mainly five types of system calls. These are explained in detail as follows −
Here are the types of system calls –

i. Process Control
These system calls deal with processes such as process creation, process termination etc.
ii. File Management
These system calls are responsible for file manipulation such as creating a file, reading a file, writing into
a file etc.
iii. Device Management
These system calls are responsible for device manipulation such as reading from device buffers, writing
into device buffers etc.
iv. Information Maintenance
These system calls handle information and its transfer between the operating system and the user
program.
v. Communication
These system calls are useful for interprocess communication. They also deal with creating and deleting
a communication connection.
Some of the examples of all the above types of system calls in Windows and Unix are given as follows −
Types of Windows Linux
System Calls

Process Control CreateProcess()ExitProcess()WaitForSingleObject() fork()exit()wait()

File CreateFile()ReadFile()WriteFile()CloseHandle() open()read()write()close()


Management

Device SetConsoleMode()ReadConsole()WriteConsole() ioctl()read()write()


Management

Information GetCurrentProcessID()SetTimer()Sleep() getpid()alarm()sleep()


Maintenance

Communication CreatePipe()CreateFileMapping()MapViewOfFile() pipe()shmget()mmap()


There are many different system calls as shown above. Details of some of those system calls are as
follows −
wait()
In some systems, a process may wait for another process to complete its execution. This happens when a
parent process creates a child process and the execution of the parent process is suspended until the child
process executes. The suspending of the parent process occurs with a wait() system call. When the child
process completes execution, the control is returned back to the parent process.
exec()
This system call runs an executable file in the context of an already running process. It replaces the
previous executable file. This is known as an overlay. The original process identifier remains since a new
process is not created but data, heap, stack etc. of the process are replaced by the new process.
fork()
Processes use the fork() system call to create processes that are a copy of themselves. This is one of the
major methods of process creation in operating systems. When a parent process creates a child process
and the execution of the parent process is suspended until the child process executes. When the child
process completes execution, the control is returned back to the parent process.
exit()
The exit() system call is used by a program to terminate its execution. In a multithreaded environment,
this means that the thread execution is complete. The operating system reclaims resources that were used
by the process after the exit() system call.
kill()
The kill() system call is used by the operating system to send a termination signal to a process that urges
the process to exit.However, kill system call does not necessary mean killing the process and can have
various meanings.
---xx---

You might also like