Top Banner
An Introduction To Software Development Using Python Spring Semester, 2015 Class #1: Understanding Computers
24
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An Introduction To Python - Understanding Computers

An Introduction To Software Development Using Python

Spring Semester, 2015

Class #1:Understanding Computers

Page 2: An Introduction To Python - Understanding Computers

An Example Python Job Description• Python developer (H3 Technologies, San Diego, CA, 5 months ago)• Job Description: Job Title : Sr. Software Engineer -Python And C++• Location : San Diego ,CA; Duration : 6 Months+(Contract / Contract to Hire) • Job Description:

– Python Developer– Desired skills:– Python and Python Packages and Libraries: NumPy, SciPy, Pickle – Relational and Non-Relational Database Technologies: SQL, MySQL, NoSQL,

MonoDB, Cassandra – Practical working knowledge of Linux, C++ – Ability/Experience in optimization of Python 2.x and 3.x code for computational

and I/O efficiency – Experience using web servers such as Apache or Tomcat in conjunction with Python– Familiar with XML

Page 3: An Introduction To Python - Understanding Computers

What Is A Computer?

Image Credit: ota_photos, Alex Lomix, yum9me, Kevin Wu

CPU(Microprocessor)

Memory(RAM: Random

Access Memory)

Hard Drive(Disk Drive)

Keyboard(Input)

Display(Output)

A computer is an electronic device that stores and processes data.

A computer includes both hardware and software. In general, hardware comprises the visible, physical elements of the computer, and software provides the invisible instructions that control the hardware and make it perform specific tasks.

Page 4: An Introduction To Python - Understanding Computers

What Is A Bus?• A computer’s components are

interconnected by a subsystem called a bus.

• You can think of a bus as a sort of system of roads running among the computer’s components; data and power travel along the bus from one part of the computer to another.

• In personal computers, the bus is built into the computer’s motherboard, which is a circuit case that connects all of the parts of a computer together

Image Credit: LoveToKnow, Corp

Page 5: An Introduction To Python - Understanding Computers

What Is A Central Processing Unit?• The central processing unit (CPU) is the

computer’s brain. It retrieves instructions from memory and executes them. The CPU usually has two components: a control unit and an arithmetic/logic unit.

• The control unit controls and coordinates the actions of the other components. The arithmetic/logic unit performs numeric operations (addition, subtraction, multiplication, division) and logical operations (comparisons).

• Today’s CPUs are built on small silicon semiconductor chips that contain millions of tiny electric switches, called transistors, for processing information.

Intel 4004, 1971, Clock rate 740kHz

Intel 8086, 1978, Clock rate 10MHz

Intel Pentium, 1993, Clock rate 66MHz

Intel Core i7, 2011, Clock rate 4GHz

Image Credit: Devraj Goswami

Page 6: An Introduction To Python - Understanding Computers

What Goes Into A CPU?• Every computer has an internal clock, which emits

electronic pulses at a constant rate.

• The unit of measurement of clock speed is the hertz (Hz), with 1 hertz equaling 1 pulse per second.

• In the 1990s computers measured clocked speed in megahertz (MHz), but CPU speed has been improving continuously and the clock speed of a computer is now usually stated in gigahertz (GHz).

• CPUs were originally developed with only one core. The core is the part of the processor that performs the reading and executing of instructions.

• In order to increase CPU processing power, chip manufacturers are now producing CPUs that contain multiple cores.

Insides of the PS4 processor

Multi-Core CPU

Page 7: An Introduction To Python - Understanding Computers

How Is Information Stored In A Computer?

• Both data and programs are stored in a computer.

• A computer is really nothing more than a series of switches. Each switch exists in two states: on or off. Storing information in a computer is simply a matter of setting a sequence of switches on or off. If the switch is on, its value is 1. If the switch is off, its value is 0.

• These 0s and 1s are interpreted as digits in the binary number system and are called bits (binary digits).

Image Credit: sdobie

1

0

Page 8: An Introduction To Python - Understanding Computers

The Binary Numbering System

• In mathematics and digital electronics, a binary number is a number expressed in the binary numeral system, or base-2 numeral system, which represents numeric values using two different symbols: typically 0 (zero) and 1 (one).

• Because of its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used internally by almost all modern computers and computer-based devices such as mobile phones.

• Each digit is referred to as a bit.

Page 9: An Introduction To Python - Understanding Computers

Binary Math Time!

• 1

• 23

• 65

• 128

• 1,003

29 28 27 26 25 24 23 22 21 20

512 256 128 64 32 16 8 4 2 1

1

1 1 1 10

1111111111

1

10 0 0 0 0

0 0 0 0 0 0 0

1

1 1 1 1 1 0 1 0 1 1

512+256+128+64+32+16+8+4+2+1= 1023

Page 10: An Introduction To Python - Understanding Computers

Bits Make Bytes• The minimum storage unit in a computer is a byte. A byte is composed of eight bits. A

small number such as 23 can be stored as a single byte. To store a number that cannot fit into a single byte (1,003), the computer uses several bytes.

1 Byte = 00000000, 23 = 00010111, 1,003 = 00000011 11101011

• Data of various kinds, such as numbers and characters, are encoded as a series of bytes. As a programmer, you don’t need to worry about the encoding and decoding of data, which the computer system performs automatically, based on the encoding scheme.

• An encoding scheme is a set of rules that govern how a computer translates characters, numbers, and symbols into data the computer can actually work with.

• Most schemes translate each character into a predetermined string of numbers. In the popular ASCII encoding scheme, for example, the character A is represented as 1000001 in one byte.

Page 11: An Introduction To Python - Understanding Computers

ASCII table“A” = 65 = 1000001

Page 12: An Introduction To Python - Understanding Computers

How Big Is That Storage?• A computer’s storage capacity is measured in bytes and multiples of the

byte, as follows: A ■ kilobyte (KB) is about 1,000 bytes. A ■ megabyte (MB) is about 1 million bytes. A ■ gigabyte (GB) is about 1 billion bytes. A ■ terabyte (TB) is about 1 trillion bytes.

• A typical one-page word document might take 20 KB. Therefore, 1 MB can store 50 pages of documents and 1 GB can store 50,000 pages of documents. A typical two-hour high-resolution movie might take 8 GB, so it would require 160 GB to store 20 movies.

Image Credit: shehan peruma

Page 13: An Introduction To Python - Understanding Computers

Thanks For The Memories• A computer’s memory consists of an

ordered sequence of bytes for storing programs as well as data that the program is working with.

• A program and its data must be moved into the computer’s memory before they can be executed by the CPU.

• Every byte in the memory has a unique address. The address is used to locate the byte for storing and retrieving the data.

• Since the bytes in the memory canbe accessed in any order, the memory is also referred to as random-access memory (RAM).

• The current content of a memory byte is lost whenever new information is placed in it.

Page 14: An Introduction To Python - Understanding Computers

Don’t Forget: Storage Devices• A computer’s memory (RAM) is a volatile form of data storage: any information

that has been stored in memory (that is, saved) is lost when the system’s power is turned off.

Note: an exception to this rule is flash memory – non-volatile memory that can be reprogramed. This is why some computers can remember where they were even after they were turned off

• Programs and data are permanently stored on storage devices and are moved, when the computer actually uses them, to memory, which operates at much faster speeds than permanent storage devices can.– Magnetic disk drives– Optical disc drives (CD and DVD)– USB flash drives

Image Credit: Gabriel Li

Page 15: An Introduction To Python - Understanding Computers

Let’s Talk: Input / Output Devices

Input Output

Image Credit: angelcalzado, Sir Adavis

Page 16: An Introduction To Python - Understanding Computers

Computers Use Networks To Talk With Each Other

Image Credit: Emerson Posadas, All-free-download.com

There are many different types of networks:LAN, WAN, WLAN, MAN, SAN, PAN, EPN & VPN

Page 17: An Introduction To Python - Understanding Computers

What Is Software?Software means computer instructions or data.

Anything that can be stored electronically is software, in contrast to storage devices and display devices which are called hardware.

10 Input “What is your name?”20 Input name$30 Print “Hello”,name$40 Print “The current time is”, sys_time50 End

00001011 0101010111100111 1001100111110001 1010111010000001 0111111010101010

10 Input “What is your name?”20 Input name$30 Print “Hello”,name$40 Print “The current time is”, sys_time50 End

Page 18: An Introduction To Python - Understanding Computers

Programming Languages That Are Used To Create Software

Computer programs, known as software, are instructions that tell a computer what to do

Image Credit: ubergizmo

Page 19: An Introduction To Python - Understanding Computers

Where It All Starts: Machine Language

Image Credit: SlideShare

Value Of AX78

13

AX13

Page 20: An Introduction To Python - Understanding Computers

One Level Higher:Assembly Language

Page 21: An Introduction To Python - Understanding Computers

What We’ll Use:High Level Languages

Page 22: An Introduction To Python - Understanding Computers

Everything Depends On The Operating System

The operating system (OS) is the most important program that runs on a computer.The OS manages and controls a computer’s activities.

The major tasks of an operating system are:• Controlling and monitoring system activities• Allocating and assigning system resources• Scheduling operations

Page 23: An Introduction To Python - Understanding Computers

What We Covered Today

1. Learned what a computer is.

2. Discovered how CPUs have evolved over time.

3. Reviewed the binary numbering system.

4. Reviewed different types of computer storage.

5. Studied the different levels of computer programming: machine, assembly, and higher-level.

Image Credit: http://www.tswdj.com/blog/2011/05/17/the-grooms-checklist/

Page 24: An Introduction To Python - Understanding Computers

What We’ll Be Covering Next Time

1. Software

2. Programming

Image Credit: http://merchantblog.thefind.com/2011/01/merchant-newsletter/resolve-to-take-advantage-of-these-5-e-commerce-trends/attachment/crystal-ball-fullsize/