Computer Organization & Design 计算机组成与设计

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Exceptional Control Flow Processes Today. Control Flow Processors do only one thing: From startup to shutdown, a CPU simply reads and executes (interprets)
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Disco Running Commodity Operating Systems on Scalable Multiprocessors.
OS Spring’03 Introduction Operating Systems Spring 2003.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
OS Spring’04 Introduction Operating Systems Spring 2004.
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Protection and the Kernel: Mode, Space, and Context.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
12/2/091 What is an Operating System Andy Konwinski CS61CL Dec 2, 2009 Lecture 13 UCB CS61CL F09 Lec 13.
1 Process Description and Control Chapter 3. 2 Requirements of an Operating System Interleave the execution of multiple processes to maximize processor.
Operating Systems CMPSC 473 Introduction and Overview August 24, Lecture 1 Instructor: Bhuvan Urgaonkar.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
S ALVATORE DI G IROLAMO (TA) Networks and Operating Systems: Exercise Session 1.
Memory Protection: Kernel and User Address Spaces Andy Wang Operating Systems COP 4610 / CGS 5765.
Introduction to Operating Systems Concepts
Computer Organization & Design 计算机组成与设计
Exceptional Control Flow
Introduction to Operating Systems
CS 3214 Computer Systems Lecture 9 Godmar Back.
CMSC 611: Advanced Computer Architecture
Memory Management Paging (continued) Segmentation
Operating Systems CMPSC 473
Memory Protection: Kernel and User Address Spaces
Exceptional Control Flow
Lecture 24 Virtual Machine Monitors
Overview of today’s lecture
Computer Organization & Design 计算机组成与设计
Exceptional Control Flow: System Calls, Page Faults etc.
CSE 120 Principles of Operating
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Memory Management Paging (continued) Segmentation
Processes in Unix, Linux, and Windows
Computer-System Architecture
Computer Organization & Design 计算机组成与设计
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Computer Organization & Design 计算机组成与设计
Lecture Topics: 11/1 General Operating System Concepts Processes
Architectural Support for OS
CSCE 313 – Introduction to UNIx process
CS201 - Lecture 17 Exceptions
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
CSE 153 Design of Operating Systems Winter 2019
Memory Management Paging (continued) Segmentation
Memory Protection: Kernel and User Address Spaces
Interrupts and System Calls
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

Computer Organization & Design 计算机组成与设计 Weidong Wang (王维东) wdwang@zju.edu.cn College of Information Science & Electronic Engineering 信息与通信网络工程研究所(ICAN) Zhejiang University

Course Information Instructor: Weidong WANG TA: Email: wdwang@zju.edu.cn Tel(O): 0571-87953170; Office Hours: TBD, Yuquan Campus, Xindian (High-Tech) Building 306 Mobile: 13605812196 TA: mobile,Email: 陈 彬彬 Binbin CHEN, 13071888906; 15091831397@163.com; 陈 佳云 Jiayun CHEN,13161700140; chenjy93@outlook.com; Office Hours: Wednesday & Saturday 14:00-16:30 PM. Xindian (High-Tech) Building 308.(也可以短信邮件联系) 微信号-“2017计组群”

Lecture 12 Hardware Architectural Support for Operating System 3

Operating System Operating system (OS) Examples of operating systems Manages hardware resources Processor, main memory (DRAM), I/O devices Provides virtualization Each program thinks it has exclusive access to resources Provides protection, isolation, and sharing Between user programs and between programs and OS Examples of operating systems Windows (XP, Vista, Win7), MacOS, Linux, BSD Unix, Solaris.. Symbian, Windows Mobile, Android, ios 4

Processes进程 Definition: a process is an instance实例 of a running program Process provides each program with two key abstractions Logical control flow Illusion of exclusive use of the processor Private set of register values (including PC) Private address space Illusion of exclusive use of main memory of “infinite” size How are these illusion错觉maintained? Process execution is interleaved分时交错 (multitasking) On available processors Address space is managed by virtual memory system 专用的错觉 5

Execution of Processes 1 2 3 4 5 分体 同时发生的 6

Reminder Process Address Space 内核 堆 7

Supporting Concurrent Processes through Context Switching上下文切换 1 2 3 4 5 8

HW Support for the OS Mechanisms机制 to protect OS from processes Modes + virtual memory Mechanisms to switch control flow between OS – processes System calls + exceptions Mechanisms to protect processes from each other Virtual memory Mechanisms to interact with I/O devices Primarily memory-mapped I/O 9

Hardware Modes (Protecting OS from Processes) 2 modes are needed, but some architectures have more User mode: Used to run users processes Accessible instructions: user portion of the ISA The instructions we have seen so far Accessible state: user registers and memory But virtual memory translation is always on Cannot access EPC, Cause, … registers Exceptions and interrupts are always on Kernel mode: used to run (most of) the kernel Accessible instructions: the whole ISA User + privileged instructions Accessible state: everything Virtual memory, exceptions, and interrupts may be turned off 10

Altering the Control Flow: System Calls So far, we have branches and jumps They implement control flows within a program Expected switch to the OS: system call instruction (syscall) A jump (or function call) to OS code E.g., in order to perform a disk access Also similar to a program-initiated exception Switches processor to kernel mode & disables interrupts Jump to a pre-defined place in the kernel Returning from a syscall: use the eret instruction (privileged特殊的) Switch to user mode & enable interrupts Jump to program counter indicated by EPC 11

Altering the Control Flow: Exception & Interrupts Exceptions & interrupts implement unexpected switch to OS Exceptions: due to a problem in the program E.g., divide by zero, illegal instructions, page fault Interrupts: due to an external event I/O event, hitting clt+c, periodic timer interrupt Exceptions & interrupts operate similar to system calls Set EPC & Cause registers Switch to kernel mode, turn off interrupts Jump to predefined part of the OS Return to user program using eret instruction 12

Dealing with Switches to the OS 13

A Really Simple Exception Handler 14

Exception Example #1 15

Exception Example #2 16

Using Virtual Memory & Exceptions: Page Sharing Example: Unix fork() system call Creates a 2nd process which is a clone of the current one How can we avoid copying all the address space Expensive in time and space Idea: share pages in physical memory Each process gets a separate page table (separate virtual space) But both PTs point to the same physical pages Saves time and space on fork() Same approach to support any type of sharing Two processes running same program Two processes that share data creates a new process by duplicating the calling process 17

Page Sharing (cont) 18

Copy-on-Write 19

HomeWork Readings: HomeWork Read Book; Read Parallel Processors from Client to Cloud.pdf; HomeWork HW4 Project 2 Computer Organization and Design (COD) (Fifth Edition) 20

Acknowledgements These slides contain material from courses: UCB CS152 Stanford EE108B Also MIT course 6.823 21