System calls are mechanism that allows a user-level program to request a service from the operating system's kernel. Users can access various services using system calls. These services can include operations like file management, process control, memory allocation, and hardware interaction, which are not directly accessible by user.
Common system calls that are frequently asked in competitive exams like UGC NET, GATE, STATE SET, and others, categorized based on their functionality:
1. Process Control System Calls
- fork() - Creates a new process.
- exec() - Replaces the current process image with a new one.
- wait() - Waits for a child process to terminate.
- waitpid() - Waits for a specific child process.
- exit() - Terminates the process.
- getpid() - Gets the process ID.
- getppid() - Gets the parent process ID.
- nice() - Changes the priority of a process.
- kill() - Sends a signal to a process.
- setuid() - Sets the user ID of the process.
- getuid() - Gets the user ID.
- setsid() - Creates a new session and sets the process group ID.
2. File Management System Calls
- open() - Opens a file.
- close() - Closes a file.
- read() - Reads data from a file.
- write() - Writes data to a file.
- lseek() - Repositions the file offset.
- unlink() - Deletes a file.
- stat() - Retrieves file status.
- fstat() - Gets file status from a file descriptor.
- rename() - Renames a file.
- dup() - Duplicates a file descriptor.
- dup2() - Duplicates a file descriptor to a specified value.
- chmod() - Changes file permissions.
- chown() - Changes file ownership.
3. Directory Management System Calls
- mkdir() - Creates a new directory.
- rmdir() - Removes a directory.
- chdir() - Changes the current working directory.
- getcwd() - Gets the current working directory.
- opendir() - Opens a directory.
- readdir() - Reads a directory entry.
- closedir() - Closes a directory.
4. Memory Management System Calls
- brk() - Changes data segment size.
- sbrk() - Increments program data space.
- mmap() - Maps files or devices into memory.
- munmap() - Unmaps memory.
5. Communication System Calls
- pipe() - Creates a pipe for inter-process communication.
- shmget() - Allocates a shared memory segment.
- shmat() - Attaches a shared memory segment.
- shmdt() - Detaches a shared memory segment.
- msgget() - Creates or accesses a message queue.
- msgsnd() - Sends a message to a queue.
- msgrcv() - Receives a message from a queue.
- socket() - Creates an endpoint for communication.
- bind() - Binds an address to a socket.
- connect() - Initiates a connection on a socket.
- listen() - Listens for connections on a socket.
- accept() - Accepts a connection on a socket.
- send() - Sends data on a socket.
- recv() - Receives data on a socket.
6. Device Management System Calls
- ioctl() - Controls device parameters.
- mknod() - Creates a filesystem node (file, device).
- fcntl() - Performs various control operations on a file descriptor.
7. Information Maintenance System Calls
- gethostname() - Gets the name of the current host.
- sethostname() - Sets the hostname.
- uname() - Gets system information.
- getrlimit() - Gets resource limits.
- setrlimit() - Sets resource limits.
8. Time Management System Calls
- time() - Returns the current time.
- gettimeofday() - Gets the current time with microsecond precision.
- settimeofday() - Sets the current time.
- nanosleep() - Suspends the process for the specified time.
Frequently Asked in Exams:
- GATE:
fork()
,exec()
,wait()
,read()
,write()
,pipe()
- UGC NET:
fork()
,exec()
,kill()
,shmget()
,mmap()
Comments
Post a Comment