System Call

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

System Call

Process Control

Definition: Process control system calls manage processes in the operating system. Processes
are instances of executing programs. These calls enable the creation, termination, and control
of processes.

• fork(): This system call creates a new process by duplicating the existing process.

• exec(): The exec() family of system calls replaces the current process with a new
process. It loads a new program into the current process's memory space.

• wait(): This system call suspends the execution of the calling process until one of its
child processes exits or terminates.

• exit(): It terminates the calling process and returns its resources to the system.

File Management

Definition: File management system calls handle files and directories in the operating system.
They perform operations such as creating, opening, closing, reading, and writing files

• open(): Opens a file and returns a file descriptor.

• close(): Closes a file descriptor.

• read(): Reads data from an open file descriptor into a buffer.

• write(): Writes data from a buffer to an open file descriptor.

• seek(): Moves the file pointer associated with a file descriptor to a new position.
Device Management

Definition: Device management system calls interact with hardware devices attached to the
system. They provide an interface for accessing and controlling devices such as printers, disks,
and network interfaces.

• ioctl(): Performs I/O control operations on devices, such as setting parameters or


getting device status.

• read() and write(): These are also used for device I/O operations.

• open() and close(): For opening and closing device files similar to regular files.

Information Maintenance

Definition: Information maintenance system calls provide mechanisms for obtaining and
manipulating system information, such as time, system configuration, and user account
details.

• getpid(): Returns the process ID of the calling process.

• getppid(): Returns the parent process ID of the calling process.

• getuid(): Returns the user ID of the calling process.

• getgid(): Returns the group ID of the calling process.

Communications

Definition: Communication system calls facilitate communication between processes, either


on the same system or across a network.

• pipe(): Creates an inter-process communication channel, typically used for


communication between a parent and child process.

• msgget(), msgsnd(), msgrcv(): System calls for message queues, used for inter-process
communication.

• socket(), connect(), send(), recv(): System calls for inter-process communication over
networks using sockets.

Protection

Definition: Protection system calls enforce security policies and access controls to protect
system resources from unauthorized access.

• chmod(): Changes the permissions of a file.

• chown(): Changes the owner of a file.

• umask(): Sets the default permissions for newly created files.

• setuid(), setgid(): Temporarily changes the user or group ID of a process, typically used
for privilege escalation.

Each of these system calls plays a crucial role in managing the resources and operations of an
operating system, facilitating efficient execution of processes and management of files,
devices, and communication between processes while ensuring security and protection of
system resources.

You might also like