Professional Documents
Culture Documents
CSE100 wk1
CSE100 wk1
CSE100 wk1
Systems
2
Topics
• Introduction to Computing
• Hardware and Software
• Networking, Internet, and Security
• Principles of Programming Languages
• Programming using Python
3
A Modern Computer
• A modern computer can be defined as “a machine that
stores and manipulates information under the control
of a changeable program.”
4
Computer = Powerful + Stupid !
• Powerful -- looking through masses of a data
--Billions of "operations" per second
• Stupid
--Operations are simple and mechanical
--Lacks "insight"
• But computers still are incredibly useful
• That's what this class is about
--Visit this funny computer world, see how it works
--Understand what they can do
--Not intimidated, computer is not a magic box
• Open your eyes computer world .. some students
interested more computer science
5
How Does a Computer Work?
6
So Useful !
7
Who Does This Mapping?
Programmers
8
Programmers Make It Happen!
9
Hardware and Software
10
Chips and Transistors
11
Moore’s Law*
*Moore's law (Gordon Moore, Intel co-founder) states that the density of
transistors on a chip doubles about every 2 years.
12
Hardware
• CPU
• RAM
• Disk
13
• CPU
– CPU - Central Processing Unit
– The brains
– Performs simple operations
– e.g. Add two numbers
– Run button ... code "runs" on the CPU
• RAM
– RAM - Memory
– Temporary, working storage bytes
– RAM is not persistent .. gone when power goes out
– e.g. You're working on a doc, then power goes out (vs. "Save")
14
Persistent Storage
• Persistent storage
aka "non volatile" .. preserved when not powered
• File system - files, folders
• Hard drive - stores bytes as a magnetic pattern on a spinning disk
High pitch spinning sound you may have heard
• Flash drive - stores bytes as electrons in a chip
Solid state approach, aka "flash memory"
• Flash drive forms - usb key, SD card in camera, flash chips built into
a tablet
• Flash used to be very expensive, so most computers used drives
• However flash is getting cheaper (Moore's law)
15
File System
• File System
– When you take a digital picture, where does it go?
– File system - organize the bytes of persistent storage
– "File" - a name, a handle to a block of bytes
– e.g. "flowers.jpg" refers to 48KB of image data
16
Bits and Bytes
• Bit
– Bit - stores just a 0 or 1
– Can store/communicate 2 states
– e.g. 0 if by land, 1 if by sea (Revere's ride bit)
– Transistors on a chip can make a bit
– Too small to be much use on its own .. form into a byte
• Byte
– Byte - the most important unit of storage
– One byte can store one letter, e.g. 'a' or 'x'
– One byte is made of 8 bits
17
Byte
18
Kilobyte, Megabyte, …
• Kilobyte
– Kilobyte KB - 1024 bytes
– About a thousand bytes
– A small email text is about 2KB
– A 5 page paper might be 100KB
– Text does not take a lot of bytes to store compared to images or video
• Megabyte
– Megabyte (MB) - 1024 kilobytes
– About a million bytes
– MP3 audio is about 1 megabyte per minute
– A high quality digital picture is about 3 megabytes
– An audio CD is about 700 megabytes
• Gigabyte (GB), Terabyte (TB), …
19
Gigahertz (speed)
20
Computer vs. Computer Science
• It is not the study of computers!
“Computers are to computer science what telescopes
are to astronomy.” – E. Dijkstra
• Since a computer can carry out any process that we
can describe, the real question is “What processes
can we describe? “
• Put another way, the fundamental question of
computer science is simply “What can be computed?”
21
Computer Science
22
Computer Program
23
Computer Program
25
Hardware Basics
• Input devices
– Information is passed to the computer through keyboards, mice,
etc.
• Output devices
– Processed information is presented to the user through the
monitor, printer, etc.
• Fetch-Execute Cycle
– First instruction retrieved from memory
– Decode the instruction to see what it represents
– Appropriate action carried out
– Next instruction fetched, decoded, and executed
– Lather, rinse, repeat!
26
Natural vs. Formal Languages
• Natural languages:
– The languages that people speak, such as Bengali, English, and
French. They were not designed by people (although people try to
impose some order on them); they evolved naturally
• Formal languages:
– The languages that people have designed for specific purposes,
such as representing mathematical ideas or computer programs; all
programming languages are formal languages
• Token:
– One of the basic elements of the syntactic structure of a program,
analogous to a word in a natural language
• Parse:
– To examine a program and analyze the syntactic structure
27
Programming Languages
28
Programming Languages
29
Programming Languages
• High-level to low-level
– Computers can only execute programs written in low-level
languages. Thus, programs written in a high-level language have
to be processed before they can run.
– Two kinds of programs process high-level languages into low-level
languages: interpreters and compiler.
• Interpreter vs Compiler
– An interpreter reads a high-level program and executes it,
meaning that it does what the program says.
– A compiler reads the program and translates it completely before
the program starts running. In this case, the high-level program is
called the source code, and the translated program is called the
object code or the executable.
30