04-memory-post3up

04-memory-post3up - The memory model Readings: Readings...

Info iconThis preview shows pages 1–4. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The memory model Readings: Readings from CP:AMA (King), chapters 1-10, as detailed in the document available on the Web site. The readings concern the C programming language. The memory model is not discussed in the textbook. CS 136 Spring 2011 04: The memory model 1 A brief look at computer architecture An interpreter like DrRacket or racket runs a program written in a high-level language (HLL) like Scheme. Like any application, the interpreter consists of a sequence of primitive instructions in machine language . Machine language is the low-level language that the particular computer is designed to run. The memory of the computer stores the interpreter, the HLL program which it treats as data, and the data that the user has written the HLL program to transform. CS 136 Spring 2011 04: The memory model 2 Interpreter Memory User's Scheme program User's data Working storage Processor The primitive instructions in the interpreter program specify how memory is to be altered by the processor as the computation proceeds. We will focus here on how data is represented in memory. The processor is discussed in lecture module 05. CS 136 Spring 2011 04: The memory model 3 Memory A convenient model of memory is as a set of numbered words . Each word can hold a fixed amount of information, typically 32 binary digits or bits . 10010010 11101000 00011010 11110000 00001101 00000001 11011111 01001010 11110100 10101110 00010100 00000000 ... 4 8 12 ... 256 260 264 ... address contents Word addresses are divisible by 4 because most 32-bit computer architectures allow 8-bit chunks, called bytes , to be addressed. 10010010 11101000 00011010 11110000 4 address 5 6 7 CS 136 Spring 2011 04: The memory model 4 The 32 bits stored in a memory word could be interpreted as: a single machine instruction; an integer which is part of some larger collection of data; 4 characters (each one requiring 8 bits); the address of another word or byte of memory; something else, depending on context. CS 136 Spring 2011 04: The memory model 5 When the 32 bits stored in a memory word represent the address of another word or byte, we interpret the bits as a natural number represented in binary. This means that legal memory addresses run from 0 to 2 32- 1 , or 4294967295. About 4 billion bytes, or 4 gigabytes, are addressable. In practice, many architectures reserve word 0, so 0 is not a legal word address as far as user programs are concerned. For memory, address can be interpreted as location, and contents as value. Memory makes concrete the mapping between location and value that we discussed in lecture module 03. CS 136 Spring 2011 04: The memory model 6 How Scheme uses memory ( define x 3 ) We know that this binding of a name to a value is composed of a mapping from name to location and a mapping from location to value....
View Full Document

This note was uploaded on 06/19/2011 for the course CS 136 taught by Professor Becker during the Spring '08 term at Waterloo.

Page1 / 21

04-memory-post3up - The memory model Readings: Readings...

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

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