Homework Reading Machine Projects Labs

Slides:



Advertisements
Similar presentations
Computer-System Structures Er.Harsimran Singh
Advertisements

Computer Organization and Architecture
Computer System Overview
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
Introduction To The ARM Microprocessor
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Computer Organization
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
2.1 Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Lecture on Central Process Unit (CPU)
1.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 1: Introduction What Operating Systems Do √ Computer-System Organization.
Introduction to Operating Systems Concepts
Computer System Structures
Topics to be covered Instruction Execution Characteristics
Homework Reading Machine Projects Labs
Operating System Overview
Operating Systems Lecture 2.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Chapter Objectives In this chapter, you will learn:
2. OPERATING SYSTEM 2.1 Operating System Function
Chapter 2: Computer-System Structures
ECE354 Embedded Systems Introduction C Andras Moritz.
Operating Systems •The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that.
Anton Burtsev February, 2017
Chapter 1: Introduction
Computer Architecture
Day 08 Processes.
Day 09 Processes.
Advanced Topic: Alternative Architectures Chapter 9 Objectives
Introduction to Operating System (OS)
Overview Introduction General Register Organization Stack Organization
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer Architecture
Central Processing Unit
Computer-System Architecture
Module 2: Computer-System Structures
Today’s agenda Hardware architecture and runtime system
Operating Systems Lecture 2.
Lecture Topics: 11/1 General Operating System Concepts Processes
Architectural Support for OS
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Module 2: Computer-System Structures
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
Overview 1. Inside a PC 2. The Motherboard 3. RAM the 'brains' 4. ROM
Introduction to Microprocessor Programming
CSE 451: Operating Systems Winter 2007 Module 2 Architectural Support for Operating Systems Brian Bershad 562 Allen Center 1.
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Chapter 11 Processor Structure and function
Module 2: Computer-System Structures
COMP3221: Microprocessors and Embedded Systems
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Module 2: Computer-System Structures
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

Homework Reading Machine Projects Labs None (Finish all previous reading assignments) Machine Projects Continue with MP5 Labs Finish lab reports by deadline posted in lab

Pentium Reset / Boot Reset Held asserted until power supply voltages stabilize Starts processor in “real mode” for 1 Meg address space Forces %cs = 0xf000 and %eip = 0xfff0 First instruction is fetched from address 0xffff0 %cs (offset) 0x f 0 0 0 - %eip 0x - f f f 0 Address: 0x f f f f 0 Address decoding logic will enable ROM BIOS device when processor fetches this address and the control bus lines indicate “instruction fetch”

Pentium Reset / Boot Boot BIOS loads an OS (or a debug monitor like Tutor) into RAM from ROM or other non-volatile media such as a hard drive Tutor/OS changes the addressing mode from “real mode” to “protected mode” which supports a flat 32 bit address space Tutor/OS starts executing, interacts with the user, and controls running of user programs

Embedded System Reset / Boot An embedded system resets on power up Embedded systems may operate unattended by an operator, so a system failure could go unnoticed until some catastrophe occurs Other possible causes for system resets: Hardware diagnostics (detects a hardware fault) Software integrity checks (detects corrupt data) A watchdog timer (detects an infinite loop) Remote monitoring system (detects no response)

Operating System Support We have been running our embedded system projects under Tutor Tutor is only a single user debug monitor A real operating system such as Linux can support multiple users simultaneously Some key processor features are required to support multiple simultaneous users and prevent interference between them: Kernel / User Modes of Operation Memory Protection

Processor Modes Most CPU’s can execute code in two modes: Kernel Mode (also called supervisor mode) User Mode (also called application mode) In kernel mode, all privileged instructions are allowed including ones such as sti, cli, lidt, cpuid, in, out, etc. In user mode, those instructions are prohibited or may only be partially available based on the OS configuration

Processor Modes with Tutor The processor boots in kernel mode Tutor initializes itself in kernel mode and never switches the processor to user mode When we start a program with go 100100, it is running in kernel mode Hence, our code can execute all instructions and can make normal calls to functions such as our C library inpt()/outpt() or our callback functions in MP3 and MP5

Processor Modes with an OS The processor boots in kernel mode The operating system initializes itself and later provides its services in kernel mode Only “trusted” code executes in kernel mode When the operating system starts “untrusted” code (i.e. user programs), it changes the processor mode from kernel to user mode Execution of a prohibited instruction causes an exception to a kernel mode OS service

Processor Modes with an OS In user mode, there are only two ways to resume kernel mode operation A hardware interrupt or exception occurs Code makes a “system call” to an OS service using an instruction such as int $n Hence, ISR/Exception handling code and OS service functions run in kernel mode and must be trusted

Processor Modes with an OS Compiled C code makes normal calls to and expects normal returns from library functions which do not change the processor mode Hence, many C library functions take the parameters passed to them and reformat them into an OS system call, e.g. int $n That switches the processor to kernel mode The system service returns via iret and the library code is running in user mode again

Memory Protection Some “hacks” attempt to run user code in kernel mode to violate system security If code running in user mode can overwrite trusted kernel mode code, the system is not secure Processor memory protection features are one way that an OS can prevent corruption of its trusted code that runs in kernel mode

Memory Protection with Tutor Tutor does not utilize memory protection With Tutor, we could overwrite our own code or the Tutor code itself in memory That allowed us to run experiments that would not have been possible with an OS

Memory Protection with an OS With an OS, the critical memory areas for the OS are set up with memory protection These memory areas can be accessed only in kernel mode - not in user mode A user code attempt to access a prohibited location causes an exception to a kernel mode OS service

The “Downside” of an OS OS processor mode and memory protection sound great! Let’s always use them. Hmm. So what’s the possible downside? Performance! Using these features causes the OS to have a long context switching time between tasks This may make it impossible to meet the real-time constraints of an embedded system

The “Downside” of an OS There are versions of “embedded Linux”, Android, and commercial products such as Vxworks or Windows CE, that are intended for use on embedded systems They are used in high-end embedded systems such as cell phones or gaming consoles These devices are expensive enough to absorb the high costs of processor, memory, etc.

The “Downside” of an OS Some embedded system software may need to run “raw” on low-end and low-cost hardware without any OS or with only a minimal OS Processor limitations Memory size limitations Hard real-time constraints Costs for licenses or vendor support for an OS Think about the diving computer in lecture one, Arduino boards, appliances, control systems, alarm systems, smart thermostats, etc.

CISC / RISC Architectures Complex Instruction Set Computers This is the traditional processor architecture Complex instructions: Can be of varying length (1 – 8 or more bytes) Need to be decoded before they can be executed Execution may include many steps We have been studying the i386 processor which is based on a CISC architecture

CISC / RISC Architectures Reduced Instruction Set Computers A more recently introduced architecture (1980’s) RISC processors have simpler instruction sets: Instructions are all the same length (typically 32 bits) An instruction word doesn’t need to be decoded Instructions do only one simple thing very fast More instructions are needed to perform any given task The AtMega328P used on our Arduino boards and the Advanced RISC Machines ARM family of processors are good examples

VLIW Architectures Very Long Instruction Word Computers Another recently introduced architecture (1980’s) Processors have a Very Long Instruction Word: Instructions are all the same length (up to 1024 bits) Have a different instruction field for each functional unit The processor executes multiple instructions in parallel per clock cycle without elaborate HW to keep track of dependencies – so faster The compiler must keep track of dependencies when it generates the code The HP/Intel Itanium processor that we cover next time is a good example of this architecture

Registers, Memory, and I/O Ports VLIW Architectures Example layout of a VLIW processor: If a functional unit can’t be used, “nop” is coded Very Long Instruction Word (Six Parallel Instructions) Field A Field B Field C Field D Field E Field F Functional Unit A Functional Unit B Functional Unit C Functional Unit D Functional Unit E Functional Unit F Registers, Memory, and I/O Ports