part1 - 1 CS354: Operating Systems Spring 2012 Part 4: OS...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CS354: Operating Systems Spring 2012 Part 4: OS Interface Dongyan Xu Department of Computer Science Purdue University Kernel and User Mode Kernel Mode When the CPU runs in this mode: It can execute any machine instruction Examples of privilege instructions: LMSW, SMSW (load/store Machine Status Word register) MOV DBn, MOV CRn (move to debug/control registers) LSL (load stack limit, adjusting stack space available to a process) HLT (halt the CPU) It can access/modify any location in memory It can access and modify any register in the CPU and any device. The OS kernel instructions run in kernel mode. Kernel and User Mode User Mode When the CPU runs in this mode: The CPU can use a limited set of instructions The CPU can only modify only the sections of memory assigned to the process running the program. The CPU can access only a subset of registers in the CPU and it cannot access registers in devices. There is a limited access to the resources of the computer. The user processes run in user mode Kernel and User Mode When the OS boots, it starts in kernel mode. In kernel mode the OS sets up all the interrupt vectors and initializes all the devices. Then it starts the first process and switches to user mode. In user mode it runs all the background system processes (daemons or services). Then it runs the user shell or windows manager. Kernel and User Mode User programs run in user mode. The programs switch to kernel mode to request OS services (through the system call interface) Also user programs switch to kernel mode when an interrupt is raised. They switch back to user mode when interrupt returns. The interrupt handling code (part of OS) is executed in kernel mode. The interrupt vector can be modified only in kernel mode....
View Full Document

This note was uploaded on 02/20/2012 for the course CS 354 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 22

part1 - 1 CS354: Operating Systems Spring 2012 Part 4: OS...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online