
- Operating System Tutorial
- OS - Home
- OS - Overview
- OS - Components
- OS - Types
- OS - Services
- OS - Properties
- OS - Processes
- OS - Process Scheduling
- OS - Scheduling algorithms
- OS - Multi-threading
- OS - Memory Management
- OS - Virtual Memory
- OS - I/O Hardware
- OS - I/O Software
- OS - File System
- OS - Security
- OS - Linux
- OS - Exams Questions with Answers
- OS - Exams Questions with Answers
- Operating System Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
What are the types of system calls used in file management?
The System calls for File management are as follows −
A file is open using a system call open. The mode in which the file is supposed to be open is specified using the parameter.
Parameters also consist of the names of the file to open or a new one to be created. The files are closed using the close systems.
Associated with each file is a pointer that indicates the current position in the file. When reading or writing sequentially, points to the next byte to be read or written.
The Lseek call changes the value of the position pointer so that subsequent calls to read or write can begin anywhere in the file.
Lseek has three parameters which are as follows −
File descriptor for the file
File position
File position is relative to the beginning of the file, the current position, or the end of the file.
Example
The systems calls for file management include the following −
open − for opening the file for reading, writing.
close − to close the opened file.
read − for reading the data from the file into the buffer.
write − for writing the data from the buffer into file.
Now let us see about each system call in detail. We know a file is used to store a large volume of data. A file is treated as a single entity.
The main functions are as follows −
Create a file
Whenever you want to work on a file, the very first step is to create a file. A file is a space in memory where data is stored.
You can follow the steps to create a file −
Right click anywhere in the folder where you want to create a file.
Select new file.
Name the file and a file will be created.
Open a file
After creating a file, you can work on it whenever you want to and open it from the memory of the file system by accessing the path of the file.
For example − cd ./user/file1 -------file1 being the name of the file that you created. Also you can double click on the file to open it wherever you have created it.
Close a file
You can close a file by clicking on the close button in the toolbar of a file.
Delete a file
Delete a file by following these steps −
Right click on the file.
Click on delete.
Click yes/confirm on the confirmation block.
- Related Articles
- What are the Process Management System Calls?
- Different types of system calls
- What are system calls in Operating System?
- What are the different system calls in the operating system?
- File System Management
- What is the purpose of System Calls?
- How are system calls connected to the operating system?
- Levels in a File Management System
- File-based Data Management System
- What are the Dependency Types in Project Management?
- What are the types of Intrusion Prevention System?
- What are the Types of Insulators Used in Transmission Lines?
- What are the types of Parallel Processor System in Computer Architecture?
- System Calls in Unix and Windows
- Timer in C++ using system calls
