tailieunhanh - Lecture Operating systems: A concept-based approach: Chapter 2 - Dhananjay M. Dhamdhere

Chapter 2 - The OS, the computer, and user programs. This chapter presents hardware features of a computer system that are relevant for operation and performance of an operating system (OS). It describes how an OS uses some of the hardware features to control execution of user programs and perform I/O operations in them, and how user programs use features in the hardware to interact with the OS and obtain the services they need. | Chapter 2 The OS, the Computer, and User Programs Copyright © 2008 Introduction Fundamental Principles of OS Operation The Computer OS Interaction with the Computer and User Programs 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 Fundamental Principles of OS Operation The kernel of the OS is the collection of routines that form the core of the operating system Implements control functions Set of services to user programs Exists in memory during operation of the OS An interrupt diverts the CPU to execution of the kernel code A software interrupt is used by programs to communicate their requests to the kernel 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 Fundamental Principles of OS Operation (continued) CPU has two modes of operation: Kernel mode CPU can execute all instructions Kernel operates with CPU in this mode so that it can control computer operations User mode CPU cannot execute instructions that could interfere with other programs or with | Chapter 2 The OS, the Computer, and User Programs Copyright © 2008 Introduction Fundamental Principles of OS Operation The Computer OS Interaction with the Computer and User Programs 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 Fundamental Principles of OS Operation The kernel of the OS is the collection of routines that form the core of the operating system Implements control functions Set of services to user programs Exists in memory during operation of the OS An interrupt diverts the CPU to execution of the kernel code A software interrupt is used by programs to communicate their requests to the kernel 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 Fundamental Principles of OS Operation (continued) CPU has two modes of operation: Kernel mode CPU can execute all instructions Kernel operates with CPU in this mode so that it can control computer operations User mode CPU cannot execute instructions that could interfere with other programs or with the OS if used indiscriminately CPU is put in this mode to execute user programs 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 The Computer 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 The Computer (continued) The CPU Memory Management Unit (MMU) Memory Hierarchy Input/Output Interrupts 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 The CPU Two features of the CPU are visible to user programs or the OS: General-purpose registers (GPRs) Also called program-accessible registers Hold data, addresses, index values, or the stack pointer during execution of a program Control registers Contain information that controls or influences operation of the CPU Set of control registers is called the program status word (PSW) 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 2. Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 The CPU (continued) CPU can operate in two modes: Kernel mode Can execute privileged .