1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 4: Operating Systems.

Slides:



Advertisements
Similar presentations
Components of a computer system
Advertisements

The CPU The Central Presentation Unit What is the CPU?
Chapter 2 Machine Language.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
The Central Processing Unit: What Goes on Inside the Computer.
Chapter 2 Machine Language. Machine language The only language a computer can understand directly. Each type of computer has its own unique machine language.
Computer Systems. Computer System Components Computer Networks.
1 Foundations of Software Design Lecture 3: How Computers Work Marti Hearst Fall 2002.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
©Brooks/Cole, 2003 Chapter 5 Computer Organization.
Chapter 0 Introduction to Computing
Operating System & Memory Hierarchy i206 Fall 2010 John Chuang Some slides adapted from Glenn Brookshear, Brian Hayes, or Marti Hearst.
Elements of the Computer (How a processor works)
GCSE Computing - The CPU
COMPUTER MEMORY Modern computers use semiconductor memory It is made up of thousands of circuits (paths) for electrical currents on a single silicon chip.
Computer Systems CS208. Major Components of a Computer System Processor (CPU) Runs program instructions Main Memory Storage for running programs and current.
CPU Describe the purpose of the CPU
Memory Main memory consists of a number of storage locations, each of which is identified by a unique address The ability of the CPU to identify each location.
Computers Central Processor Unit. Basic Computer System MAIN MEMORY ALUCNTL..... BUS CONTROLLER Processor I/O moduleInterconnections BUS Memory.
Computer Processing of Data
The Computer Systems By : Prabir Nandi Computer Instructor KV Lumding.
Practical PC, 7th Edition Chapter 17: Looking Under the Hood
Random access memory.
HARDWARE: CPU & STORAGE How to Buy a Multimedia Computer System.
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
MBMPowered by DeSiaMore System Unit 1. MBMPowered by DeSiaMore Definition The system unit/system cabinet is a container that houses most of the electronic.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Computers organization & Assembly Language Chapter 0 INTRODUCTION TO COMPUTING Basic Concepts.
1 Embedded Systems Computer Architecture. Embedded Systems2 Memory Hierarchy Registers Cache RAM Disk L2 Cache Speed (faster) Cost (cheaper per-byte)
Memory  Main memory consists of a number of storage locations, each of which is identified by a unique address  The ability of the CPU to identify each.
Components of a Computer Prepared by: Mrs. McCallum-Rodney.
1Copyright © Prentice Hall 2000 The Central Processing Unit Chapter 3 What Goes on Inside the Computer.
CIM101 : Introduction to computer Lecture 3 Memory.
Computer Architecture And Organization UNIT-II Structured Organization.
CPU How It Works. 2 Generic Block Diagram CPU MemoryInputOutput Address Bus Data Bus.
Computer Organization - 1. INPUT PROCESS OUTPUT List different input devices Compare the use of voice recognition as opposed to the entry of data via.
SKILL AREA: 1.2 MAIN ELEMENTS OF A PERSONAL COMPUTER.
1 i206: Lecture 4: The CPU, Instruction Sets, and How Computers Work Marti Hearst Spring 2012.
Computer Organization & Assembly Language © by DR. M. Amer.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
IT253: Computer Organization Lecture 9: Making a Processor: Single-Cycle Processor Design Tonga Institute of Higher Education.
Stored Programs In today’s lesson, we will look at: what we mean by a stored program computer how computers store and run programs what we mean by the.
Computer Organization. The digital computer is a digital system that performs various computational tasks Digital computer use binary number system which.
CS 1308 Computer Literacy and the Internet. Objectives In this chapter, you will learn about:  The components of a computer system  Putting all the.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Overview von Neumann Architecture Computer component Computer function
Computer operation is of how the different parts of a computer system work together to perform a task.
The Central Processing Unit (CPU)
A memory is just like a human brain. It is used to store data and instructions. Computer memory is the storage space in computer where data is to be processed.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
Cache Advanced Higher.
GCSE Computing - The CPU
STORAGE DEVICES Towards the end of this unit you will be able to identify the type of storage devices and their storage capacity.
David Kauchak CS 52 – Spring 2017
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Memory Main memory consists of a number of storage locations, each of which is identified by a unique address The ability of the CPU to identify each location.
Memory Main memory consists of a number of storage locations, each of which is identified by a unique address The ability of the CPU to identify each location.
The Central Processing Unit
STORAGE DEVICES Towards the end of this unit you will be able to identify the type of storage devices and their storage capacity.
Computer Architecture
IB Computer Science Topic 2.1.1
STORAGE DEVICES Towards the end of this unit you will be able to identify the type of storage devices and their storage capacity.
November 5 No exam results today. 9 Classes to go!
The Von Neumann Architecture
GCSE Computing - The CPU
Presentation transcript:

1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 4: Operating Systems

2 Today Revisit instructions and the CPU Measuring CPU Performance The Memory Hierarchy Operating Systems –Programs vs. Processes –Process Scheduling –Deadlock –Memory Management

3 Instructions and Their Representation Images from

4 The CPU Images from Bus: bundles of wires connecting things. Instruction Register: holds instructions. Program Counter: points to the current memory location of the executing program. Decoder: uses the 3-bit opcode to control the MUX and the ALU and the memory buses. MUX: multiplexer – chose 1 out of N ALU: adds, subtracts two numbers Accumulator: stores ALU’s output RAM: stores the code (instructions) and the data.

5 Machine code to add two numbers that are stored in memory (locations 13 and 14) and then store the result into memory (location 15). The Program Counter starts at memory location 0. Image adapted from

6 Images from The Program Counter starts at memory location 0. (Notice: the instructions and the data are both stored in the RAM.) This instruction moves along the blue bus into the instruction register. The decoder checks the number bit to see how to handle the opcode. For each instruction, we have to do something with the operand.

7 Images from If the opcode number bit = 0, we want the operand to be used as a memory address. So the decoder switches the MUX to connect the operand to the RAM. If the opcode bit = 1, the MUX would connect the operand to the ALU instead. The green bus does the addressing of the RAM. The blue bus does the reading to and writing from the RAM.

8 Images from The Decoder tells the ALU this is a LOAD instruction. The memory location 13 is activated, and its value placed on the blue bus. This goes through the multiplexer into the ALU. It also trickles down into the Accumulator (Load is implemented as an ADD value to 0). The last step (always, except for a jump) is for the Program Counter to get incremented. Now it points to memory location 1.

9 Images from Instruction: ADD 14 Similar to Load 13, except the ALU is given the ADD operation. The contents of the Accumulator becomes the lefthand operand, and the contents of memory becomes the righthand operand. Results of the ADD end up in the Accumulator. The Program Counter increments.

10 Images from Instruction: STORE 15 Memory address 15 is activated via the green bus. (Because the decoder sets to MUX to connect to the memory bus.) The contents of the Accumlator are written to RAM using the blue bus. The Program Counter increments. The next instruction is HALT.

11 Images from There are other nice examples in the online simulation. They show the use of explicit numbers (represented by # signs), along with memory addresses.

12 CPU Performance CPU cycles are not the whole story. The number of INSTRUCTIONS per second play a big role. –Each operation on the computer requires some number of instructions Each instruction takes some number of cycles to execute. –So … a CPU with an instruction set and circuit design that requires fewer cycles to get operations done might have better performance than a CPU with a faster clock but more complicated circuitry.

13 Measuring CPU Performance MIPS: –millions of instructions per second –“meaningless indicator of performance” (a joke) –Some instructions require more time than others –No standard way to measure MIPS FLOPS: –floating-point operations per second –Measures the speed of the floating point unit A special circuit that does math on real numbers So, doesn’t measure performance on non-numeric applications Benchmark: –A test used to compare performance of hardware and/or software. –Different benchmarks measure different aspects of performance SPEC: –Standard Performance Evaluation Corporation –A set of standardized tasks (benchmarks) that CPUs are run on in order to assess their performance. Adapted form

14 CPU Performance CPU clocks are related to another commonly used term… Real Time –Means regular clock time as opposed to CPU clock time –Other factors also prevent a program from running in real time CPU scheduling, discussed in today’s lecture In common usage today, –Real time means right now, as I’m talking, as opposed to –Offline, when I have to think on my own, or when we’re not in the middle of a timed event with others listening.

15 The Memory Hierarchy Image from

16 Types of Computer Memory Characteristics –Volatile vs. Nonvolatile –Solid State vs. Mechanical –Read only vs. Read-write (RW) –Expense –Speed –Storage capacity (a function of size & expense)

17 Types of Computer Memory Registers (made up of flip-flops-like circuits) –Volatile, small, expensive, fast, solid state, RW DRAM (grid format using capacitance) –Connected to the rest of the CPU via a memory bus –Volatile, now large, expensive, fast, solid state, RW ROM (grid format using diodes) –Nonvolatile, Read-only, cheap, fast Hard Disk –Nonvolatile, mechanical, RW, cheap, slow Flash Memory (grid format using fancy electronics) –Nonvolatile, solid state, RW, expensive, fast, small –Versus hard disk: silent, lighter, faster … but expensive! Flash RAM (e.g., car radio presets) –Like Flash memory, but needs power Other external storage: CD-ROM, Floppy, Zip Adapted from

18 Caching Caches store items that have been used recently for faster access Based on the notion of locality –Something used recently is more likely to be used again soon than other items. Can be done using –Registers –RAM –Hard Disk, etc Image from

19 Types of Computer Memory Cache –The term refers to how the memory is used –Can be volatile or on disk L1 cache - Memory accesses at full microprocessor speed (10 nanoseconds, 4 kilobytes to 16 kilobytes in size) L2 cache - Memory access of type SRAM (around 20 to 30 nanoseconds, 128 kilobytes to 512 kilobytes in size) Main memory - Memory access of type RAM (around 60 nanoseconds, 32 megabytes to 128 megabytes in size) Hard disk - Mechanical, slow (around 12 milliseconds, 1 gigabyte to 10 gigabytes in size) Internet - Incredibly slow (between 1 second and 3 days, unlimited size) Adapted from

20 Levels of a Memory Hierarchy

21 Operating Systems Main Roles: –Allow user applications to run on a given machine’s hardware –Act as a “traffic cop” for allocating resources. Resources –CPU, I/O devices, Memory, Files, Allocation Processes –versus Programs –Scheduling –Synchronization Memory Management File Management Image from

22 Programs vs. Processes Program –The code, both in human and machine-readable form Process –A running program is a process. –It is allocated a number of resources: Registers in the CPU Some part of the CPU’s RAM I/O devices (the monitor, files in the file system) Several copies of the same program can be running as different processes. –But data values, current Program Counter location, etc., will differ among the different processes.

23 Programs vs. Processes How does this relate to Object Oriented Programming? An important difference: –Class definition vs. –Object creation / instantiation Class definitions are created at compile time. Objects don’t really get created until the program is running as a process. –The “new” command in java tells the operating system to allocate some memory and put the new object in that space. When the process ends, –the class definitions do not disappear, but –the objects disappear. meaning that the memory allocated to the objects gets reallocated for some other purpose.