In: Computer Science
Computer programs requests system service to perform certain operations. Here, to read a fixed number of bytes from a file into a string variable (input operation), the computer needs permission to perform input operation . User program needs the help of system calls to communicate with the operating system. Process creation , File access , Protection & security , memory management etc are some of the services provided by system calls .
The computer has dual mode operation , The two modes of operation are :
When the user program is running its in user mode . To read the fixed number of bytes from the file it issues a system call, i.e it requests for the service which allows the program to perform input operation. When doing this there will be a transition from user mode to kernel mode.Before switching the mode bit is set to 1 .[Refer the diagram below]
Kernel mode is used to handle interrupts , manage input/output operations. System calls are executed in Kernel mode . After executing the system call i.e after performing the input operations, the mode bit is set to 0 before the transition from Kernel mode to User mode.
Diagram of sequence of events :
If you have any queries please let me know in the comments . Thumbs up appreciated!