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,, Operating System operating-system threads process + – Akriti sood asked Dec 20, 2016 Akriti sood 2.5k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
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 Bikram answered Jul 14, 2017 Bikram comment Share Follow See all 9 Comments See all 9 9 Comments reply Bikram commented Jul 14, 2017 reply Follow Share how to change frm user mode to kernel mode and vice-versa From kernel to user mode, a non privileged instruction is required. From user to kernel mode., a software interrupt is required. 1 votes 1 votes Shubhanshu commented Sep 6, 2017 reply Follow Share @Bikram Sir, A system call is a request to the kernel in a Unix-like operating system So, can we consider System call as Privileged instruction, since we are moving from user mode to Kernel mode. 0 votes 0 votes Shubhanshu commented Sep 6, 2017 reply Follow Share In the ref document. All processes begin execution in user mode, and they switch to kernel mode only when obtaining a service provided by the kernel. Does it mean when user program needs to use IO devices then it require to switch the mode from user mode to kernel mode, and perform the required task. Example, printf() function call needs Display device like monitor to show the output, therefore, it switch its mode to kernel mode and when the task happened, mode changes to user mode again. and whenever it needs IO in future again do the same process. right?? 0 votes 0 votes Bikram commented Sep 7, 2017 i edited by Bikram Sep 7, 2017 reply Follow Share can we consider System call as Privileged instruction Yes, System call is a kind of instruction or trap , which we can all as privileged instructions. By using system call we go from user mode to kernel mode . To know more, you can read point 4 here : We need a mechanism whereby: a user-mode program can switch into kernel mode, This mechanism is the system call, which is implemented in the CPU as the trap instruction. http://minnie.tuhs.org/CompArch/Lectures/week05.html 3 votes 3 votes Bikram commented Sep 7, 2017 reply Follow Share Does it mean when user program needs to use IO devices then it require to switch the mode from user mode to kernel mode, and perform the required task. Yes , it is right ..when user program needs to use kernel it switch it's mode .. after performing required operation it again come back . 2 votes 2 votes vamp_vaibhav commented Dec 20, 2017 reply Follow Share Bikram sir.. A small confusion.. Quoting from Galvin "the h/w allow privileged insn to be executed in kernel mode, if any attempt is made to execute a privileged insn in user mode the h/w doesn't execute insn but rather treat it illegal nd trap it to OS '' As you told system call comes under privileged insn then how it is treated in user mode to get kernel mode? 1 votes 1 votes Anu007 commented Dec 20, 2017 reply Follow Share 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 votes 2 votes vamp_vaibhav commented Dec 20, 2017 reply Follow Share It means the system calls are privileged insn and can be executed in user mode to get kernel mode.. Isn't? 0 votes 0 votes Shubhanshu commented Dec 20, 2017 reply Follow Share @Anu007 Since mode Switch is a privileged inst, Thus user to kernel and kernel to user is a privileged instr. ryt? 0 votes 0 votes Please log in or register to add a comment.
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. Bikram answered Jul 14, 2017 Bikram comment Share Follow See all 4 Comments See all 4 4 Comments reply Shubhanshu commented Sep 6, 2017 reply Follow Share From user to kernel mode we require Privileged Instruction. Right? 0 votes 0 votes Bikram commented Sep 7, 2017 reply Follow Share 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 votes 0 votes Venkat Sai commented Dec 20, 2017 reply Follow Share @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 votes 1 votes Abhijit Sen 4 commented Apr 6, 2018 reply Follow Share check this http://www.cs.unc.edu/~dewan/242/s04/notes/ipc/node3.html 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes Kernal mode deals with system calls. User mode deals with execution of user defined processes. A privileged instruction sets the mode. Nithish answered Jan 2, 2017 Nithish comment Share Follow See all 0 reply Please log in or register to add a comment.