System Programs and Calls

Rating - 3/5

System Calls and Programs
All the present-day operating systems support the following two modes of operation for the CPU:

  1. User mode
  2. Kernel mode

System Programs and Calls


Fig. Modes supported by the operating system

User Mode:

When the CPU is in user mode, programs can’t access memory and hardware directly.

Moreover, if a program crashes in user mode, its effect is limited to that program only. Hence, the programs are in a safe state in this mode.

Most of the programs are in user mode only. But whenever some privileged instructions, error handling, exception handling, hardware access or other hardware related access needs to be invoked, there is a switch from user mode to kernel mode.

Kernel Mode:

While the CPU is in kernel mode, programs can directly access the memory as well as hardware. All the privileged commands are executed in this mode only. Also, if a program fails in kernel mode then the entire system will halt.

All the important library functions, subroutines etc. all are executed here only. Here user has nothing to do and the kernel only accesses the hardware to provide the requested service.

These Topics Are Also In Your Syllabus System Programs and Calls
1 Types of Operating Systems - Batch operating system, Time-sharing systems, Distributed OS, Network OS, Real Time OS link
2 Operating System Operations- Dual-Mode Operation, Timer link
You May Find Something Very Interesting Here. System Programs and Calls link
3 Operations on Process link
4 Threads overview link
5 Multithreading Models link

Context Switch:

Initially a program is always in the user mode, whenever it invokes any privileged command, control is transferred from user mode to kernel mode. As soon as OS is done with its work and the service has been provided, again there is a transfer from the kernel mode to user mode. This switching among the two modes is called context switch.

System Call:

System call is a call that is invoked whenever, a program needs to access hardware, do some I/O operation or some exception or interrupt has arisen. In other words, system call is a call which in invoked for a context switch from the user mode to the kernel mode.

System Program:

A system program is nothing but a special utility program that creates a user-friendly environment where the user can perform his desired work efficiently.

Operating system, interpreter, compiler, editor etc. are all system programs. They provide a built-in environment to the user where several necessary functions like the ones for compiling, editing, interrupt handling, memory management etc. are already defined and hence the user does not need to write any code for such functions.

Rating - 3/5