Post Contents
System call
We have to understand the difference between the CPU’s kernel mode and user mode before understanding the concept of the system call.
Nowadays there are two modes in every operating system: –
1. Kernel-mode
2. User-mode
Kernel-mode: –
When CPU If it is in kernel mode, then the executing program can access memory address and hardware resources. This CPU Can execute any of the instructions.
The kernel-mode is a very powerful mode as it executes the most reliable programs of the operating system.
If a program crashed in kernel mode, then the entire system comes to a halt ie it stops.
User mode: –
When CPU In user mode, the program is not allowed to directly access the memory address and the hardware resource.
Even if a program crashes in user mode, only that program will be closed. That is, even if a program is closed in user mode, the system remains safe.
Most programs in the computer run in user mode itself.
System call
Whenever a program is performed in user mode, the user is requested by the system to complete the program. Because memory addresses and hardware resources cannot be directly accessed in user mode.
So this request is made by the user through a call which we call system call.
Simply put, ‘system call serves as the interface between the program and the operating system.’
When a system is called by the user to perform a program, the mode that is changed from user mode to kernel mode.
Whenever we request to open a folder in the system or move the mouse on the screen, it is called a system call.
Overall, the system call is the method by which a program communicates with the operating system.
A computer program makes a system call when it makes any request to the operating system’s kernel.
System calls provide service programs of the operating system to user programs through the Application Program Interface (API).
It facilitates an interface between the process and the operating system that allows user-level processes to request service from the operating system.
People who develop applications often do not have direct access to system calls, but you can access them through the API i.e. application program interface.
The functions that are inserted into the API call the same real system calls.
Using APIs we have these advantages:
• Portability: –
As long as the system supports the API, any program can be compiled and run using that API.
• Ease of use: –
APIs are easier to use than using actual system calls.
Services offered by system call:
1. Creating and managing processes
2. Main memory management
3. File Access, Directory, and File System Management
4. Device Handling (I / 0)
5. Protection
6. Networking .. etc.
System call type
1. Process control:- create, end, abort, terminate, allocate and free memory.
2. File management:– create, open, close, delete, read files, etc.
3. Device management:- The process actually requires a lot of resources to execute and if these resources are available, they are given and the control is returned to the user process. These resources are seen as devices. These are physical, some are video cards, and some may be abstract, such as a file. The user program requests the device and releases the device when it is finished. In such files, the process of reading, circle, and reposition to the device occurs.
4. Information Maintenance:- There are two models of interprocess communication which are given below:
5. Message passing model that passes messages between processors using a common mailbox.
Shared memory is the create and gain access address of the memory areas of another process using certain system calls. The two processes share and exchange each other’s information by reading and writing the shared data.
Also Read:-
file system & file access methods