510 likes | 629 Views
COMS 161 Introduction to Computing. Title: Computing Basics Date: September 10, 2004 Lecture Number: 8. Announcements. Research paper proposals due 9/17/04, next friday. Review. Number Systems Binary Coded Decimal (BCD) ASCII. Outline. Hexadecimal Numbers Digitization
E N D
COMS 161Introduction to Computing Title: Computing Basics Date: September 10, 2004 Lecture Number: 8
Announcements • Research paper proposals due • 9/17/04, next friday
Review • Number Systems • Binary Coded Decimal (BCD) • ASCII
Outline • Hexadecimal Numbers • Digitization • Computer System Basics
Binary Number System • Precision • The number of bits used to represent an item • Letter: precision of 8 bits • Integer (whole number): precision of 32 or 64 bits • Letters and integer numbers are very precise • Known bit pattern corresponds to a letter or number • Always finite • Computers have finite precision • Presents some limitations
Hexadecimal Number System • Sometimes called hex • Positional,base-16 system • Each digit is multiplied by a power of 16 • Sixteen unique symbols (digits) • 0, 1, 2, …, 15 • Symbol a or A for 10 • Symbol b or B for 11 Symbol e or E for 14 • Symbol c or C for 12 Symbol f or F for 15 • Symbol d or D for 13
Hexadecimal Number System • A hex number can represent 16 different items • Represent one hex number with 4-bits • Easy to convert between binary and hex representations • Group bits by 4’s from the right end • Substitute the hex symbol for each nibble • 9010 = 0101 10102 = 5A16 • Is the base 16 really needed? • 6610 = 0100 00102 = 4216
Hexadecimal Number System • Use the backwards conversion to convert hex to binary • One hex digit represents 4-bits • Substitute the binary nibble • Always start at the right end • Add zeros to the left end as necessary to fill in 4 bits
Digitization • The process of converting information into a binary form • Two classes of information to digitize • Discrete • Analog
Digitization • Discrete forms are easier to digitize • Discrete information is unambiguous • Text and numbers are discrete values • Conversion of discrete to digital • Come up with a mapping • As we did with the letters • ASCII encoding • Two’s complement
Binary Coded Decimal • Integers (whole numbers) • One mapping is to use each digits binary equivalent • Binary Coded Decimal (BCD) • 010 = 00002 • 110 = 00012 • … • 910 = 10012 • Need a minimum of 4 bits to represent 10 different values • Some 4 bit quantities are wasted
Binary Coded Decimal • String of decimal digits • Each decimal digit is represented by 4 bits • The number of bits needed to represent different numbers vary • Performing arithmetic is complicated • Numbers must be converted into another form to computer the correct answer • BCD is a possible mapping between (all) integers and a binary representation
Digitizing Analog Information • Two steps • Sampling the information • Select discrete samples that represents the information • Quantizing the samples • Discrete samples are measured • Encoded into a binary representation
Digitizing Analog Information • Sampling • In time or space (picture) • Quantizing • Approximating the measured value • Placing all continuous values within a range into a bin • Binning
Digitizing Images • Images are digitized using a two step process • Sampling the continuous tone image • Quantizing the samples
Sampling Images Sample image by pixel resolution Spatial Sampling Sample two- dimensional space
Quantizing Images All gray values in each sample are averaged
Quantizing Images Different amount of sampling
Quantizing Images Different amount of sampling
Quantizing Images Different amount of sampling
Computer Systems • A dime a dozen!! • They are everywhere and their uses continue to expand • Microwaves • Clocks • Cars • Watches • What’s next • Shoes??
Computer System • Electronic digital data processing machines • Data: symbolic representation of information • Digital: numeric codes • Computers are discrete state machines • Finite number of states • All are distinct and different • Always in a state
Computer System • Process • Set of actions • Traversing certain states • Sequence of distinct states • Fast to go from one state to another • Billionths of a second • So fast, a process appears continuous • As do light bulbs • Your TV screen
Computer System • Mechanical computers • Mechanical and electrical • Electromechanical • Electronic • Fastest, but still performs simple steps • One of the great illusion of the computer: • Lots of simple steps performed quickly enough make the computer appear complicated
Computer Systems • State transitions are simple • Baby steps • States are independent • Does not matter on state before or after • Instructions cause state transitions • Going from one state to the next • Must be precise and unambiguous • Causing the desired state transition • Instructions are executed
DWIM • The notorious instruction • Prof P’s grand challenge • $1000.00 reward • Make a machine the executes the DWIM instruction • Do • What • I • Mean
Computer Systems • Unlike students (and my daughters) • Computers do what they are told to do • Nothing more, nothing less • Computer Programs (applications) • Consist of a sequence of instructions • Running a program • Executing one instruction after another • This is the primary job of the computer!!!
Fetch the next instruction Decode the instruction Execute the instruction Repeat Computer Systems • Think of the computer as a dogg! • Here boy, here boy, … • Fetch-decode-execute cycle • No good boy or treats are necessary!!
Computer Systems • The fetch-execute cycle • This is not your fathers Orange County Chopper!!
3 + 5 Computer Systems • Data instructions • Instructions that perform an operation on specified data • add 3, 5 • Instruction refers to the values to be added directly • Instruction has direct access to the values to be added
Computer Systems • Indirection • Advantageous to refer to data indirectly • Makes programs more general • Instruction tells where the data is, not what the data is • Other values can be stored and processed • add val1, val2 • val1 and val2 refer to locations that contain the values to add
val1 val2 + val1 and val2 could refer to any other place which contains other values Computer Systems • Indirection 3 7 12 1 5 234 2 3 45 135 5
Computer Systems • Instructions that refer to data • Put the values in special places • Get the values from where they are • Save them in a place where the adder looks for its input • Execute the add instruction • Place the result someplace
Computer Systems • Slight variant of the add instruction • add val1, val2, val3 • Fetch the value referred to by val1 • Read the memory at the location of val1 • Put the value on one of the adder inputs • Read the memory at the location of val2 • Put the value on the other adder inputs • Execute the add • Put result in memory at location val3
Computer Systems • Seemingly simple instruction like add • Require several simpler steps to execute • As complex as computers seem, they still do simple things • Moving data from one place to another • Simple arithmetic operations • Illusion of complexity • Perpetuated by the speed of simple operations
Computer Systems • Composed of two major items • Hardware • Electronic devices that perform specific tasks • Two basic groups • Processing unit • The heart of the computer • Peripherals • Software • Programs the hardware executes
Computer Systems • Processing unit • Central processing unit (CPU) • Controls the instruction-execution cycle • Main memory • Stores both data and instructions • Bus • Connection between main memory and the CPU • Data and address bus
CPU Computer Systems Bus Main memory
0x3550 Data Bus 0x3554 Memory Control Unit 0x3558 0x355c 0x3560 Address Bus 0x3564 0x3568 0x356c Computer Systems • Main memory • Composed of individual memory cells • Cells are grouped into words • Words are accessed via a unique address unique memory address
Computer Systems • Bidirectional bus • Data flows to and from memory • Into and out of memory
Computer Systems • Read memory (read from memory) • Memory controller access word at specified address for a read operation • Data in the memory is put on the data bus • Write memory (write to memory) • Data to write into memory is on the data bus • Memory controller access word at specified address for a write operation
Computer Systems • Peripheral devices • Components added to the basic computer system • Increase the systems functionality • Secondary memory • Input/output devices
Software • Programs • Written using programming languages (symbolic codes for expressing computer instructions) • Programs ≠ processes • Conditional processing • The ability to alternative actions based on the recognition of changing conditions
Conditional Processing • Program execution depends on certain conditions If (ProfP) { Print(“A one of a kind”); Print(“Y’all gonna miss me”); } else { Print(“We are the happy idiots”); Print(“The mediocre”); Print(“Those who fear excellence”); }
Operating Systems • Continuous control of system • Supervises processes • Creates useful abstractions for users • Defines computing experience An operating system is a collection of resident programs that manage the computer’s resources, supervise the execution of processes, and provides useful services and security.
Managing Files • A file is a sequence of items treated as a unit and identified with a unique name • filenames are composed of • identifier + ‘ .’ + extension • identifier (Windows) = up to 255 symbols excluding special characters • extension (Windows) = 1 - 4 characters that are used to classify file
tree--special type of graph nodes, edges (links) parent(s) child(ren) ancestor(s) descendant(s) directory structure--series of levels based on a tree files, folders path--list of all ancestors of a file/folder from root pathname--conventional listing of path Hierarchical File System
TEXT-BASED Command line interpreters Terse, but powerful Steeper learning curves Burden of communication on user GRAPHIC USER INTERFACES (GUI) Manipulate visual elements User-friendly More tedious User Interface