in Operating System
2,479 views
10 votes
10 votes

can anyone tell what are different activities that are performed in 

  • kernel mode
  • user mode
  • how to change frm user mode to kernel mode and vice-versa,,
in Operating System
2.5k views

3 Answers

9 votes
9 votes

Can anyone tell what are different activities that are performed in 

  • kernel mode
  • user mode
  • Kernel mode, also known as system mode, is one of the two distinct modes of operation of the CPU in Linux. The other one is user mode, a non-privileged mode for user programs, that is, for everything other than the kernel.
  • When the CPU is in kernel mode, it is assumed to be executing trusted software, and thus it can execute any instructions and reference any memory addresses (i.e., locations in memory).
  • The kernel (which is the core of the operating system and has complete control over everything that occurs in the system) is a trusted software, but all other programs are considered untrusted software.
  • Thus, all user mode software must request use of the kernel by means of a system call in order to perform privileged instructions, such as process creation or input/output operations. 
  • A system call is a request to the kernel in a Unix-like operating system by an active process for a service performed by the kernel. 
  • All processes begin execution in user mode, and they switch to kernel mode only when obtaining a service provided by the kernel. This change in mode is termed a mode switch .

Reference :

http://www.linfo.org/kernel_mode.html

4 Comments

system call comes under privileged insn then how it is treated in user mode to get kernel mode?

When you call system call then h/w need to change the mode user to kernel .(i.e. mode change done in privileged mode)

system call made from user mode.like printf(); make system call made by the user program in user mode.

2
2
It means the system calls are privileged insn and can be executed in user mode to get kernel mode.. Isn't?
0
0

@Anu007 Since mode Switch is a privileged inst, Thus user to kernel and kernel to user is a privileged instr.

ryt?

0
0
2 votes
2 votes
Privileged mode==kernel mode
Non privileged mode==user mode
 From kernel to user mode, a non privileged instruction is required.
From user to kernel mode., a software interrupt is required.

4 Comments

From user to kernel mode we require Privileged Instruction.

Right?
0
0
Yes , right .

In terms of trap or system calls we go from user to kernel mode .

This trap or system call is known as Privileged Instruction .
0
0

@Shubhanshu privileged instructions are only those we can execute ONLY in the kernel mode so we dont require priviliged instruction to get into kernel mode .. system calls are implemented by the software interrupts and even printf() also leads to a system call this, in turn, calls the WRITE() system call in the library whcih ocurs at the user mode but this call makes a MODE SWITCH to kernel mode 

1
1
0
0
1 vote
1 vote

Kernal mode deals with system calls.

User mode deals with execution of user defined processes.

A privileged instruction sets the mode. 

Related questions