
- 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 is the concept of system call mechanism?
System call mechanism is one of the techniques by which a user program requests for services from the kernel. System calls always provide an interface to the services that are available by an operating system.
Let us see the step by step explanation of system call mechanism as given below −
Step 1 − A process that is running a user program in user mode wants to execute a read instruction a file and it has to execute a trap instruction to transfer control to the operating system.
Step 2 − The read operation in system call has three parameters which are as follows −
Specifying the file.
Pointing to the buffer.
Giving the number of bytes to read.
Step 3 − Count = read (fd, buffer, nbytes);
Step 4 − First the parameters are pushed onto the stack.
Step 5 − Library procedures are called in the previous step (step 4).
Step 6 − The library procedure, are written in assembly language, typically place the system call number in a place where the operating system expects it, like a register (step 5)
Step 7 − Then to switch from user mode to kernel mode and start execution at a fixed address within the kernel (step 6), it executes a TRAP instruction
Step 8 − The kernel code starts following the TRAP examines the system-call number and then dispatches to the correct system-call handler, usually via a table of pointers to system-call handlers indexed on system-call number (step 7).
Step 9 − At that point the system-call handler runs (step 8).
Step 10 − Once it has completed its work, control may be returned to the user-space library procedure at the instruction following the TRAP instruction (step 9).
Step 11 − This procedure then returns to the user program in the usual way procedure calls return (step 10).
Given below is the diagram of system call mechanism −
- Related Articles
- What is a system call?
- What is the concept of thread?
- What is the concept of Divestiture?
- What is the concept of hedging?
- What is the concept of Monolithic kernel?
- What is the concept of Rolling Settlement?
- What is the Concept of Disguised Unemployment?
- Explain the concept of the traditional file system in DBMS?
- What is the concept of datagram packet switching?
- What is the concept of interest rate swaps?
- What is the Selling Concept of Marketing Management?
- What is the Societal Concept of Marketing Management?
- What is the concept of Data Types in JavaScript?
- What is the concept of currency swaps (FX swaps)?
- What is the Concept of B2B and B2C Marketing?
