System calls
In user space, a program first calls the GNU C Library (glibc), which provides an interface to make system calls. When a system call is made, it triggers a software interrupt, which switches the CPU from user mode to kernel mode. The system call interface in the kernel mode then locates the required function within the kernel. This function interacts with the hardware as needed. Once the operation is complete, the control is returned to the user space program.
- User Action: You right-click on the desktop and choose to create a new folder.
- File Manager: The file manager application (running in user space) handles this action.
- glibc Function Call: The file manager calls the
mkdir()function from the GNU C Library (glibc) to request the creation of the new folder. - System Call Preparation: The
mkdir()function in glibc makes a system call to the kernel mode (System call interface). - Software Interrupt: This system call triggers a software interrupt or special CPU instruction that switches the CPU from user mode to kernel mode.
- System Call Interface: In kernel mode, the system call interface receives the system call request. It maps the system call number (e.g.,
mkdir) to the corresponding kernel function (e.g.,sys_mkdir). - Kernel Function Execution: The kernel executes the
sys_mkdirfunction, which performs the actual operation of creating the new folder in the file system. - Return to User Space: After the folder is created, the CPU switches back to user mode. The file manager updates the desktop to show the new folder.
Types of system calls:


Very good
ReplyDelete