CSE100 wk1

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 30

Introduction to Computer

Systems

Dr. Mohammed Eunus Ali


(eunus@cse.buet.ac.bd)

Department of Computer Science and Engineering


Bangladesh University of Engineering and Technology (BUET)
Dhaka-1000, Bangladesh
Objectives

To Be Able to Differentiate Computer and Computer


Science

To Learn the Basics of Computers and Computing

To Learn Programming using Python

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.”

• Two key elements:


– Computers are devices for manipulating information
– Computers operate 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?

• Computer is driven by "code" (more detail later)


• Code is made of simple, mechanical instructions
• The computer runs the series of instructions
• Computers do not have insight
• Machine, following sequence of instructions

6
So Useful !

• Think of all the useful computer features (phone,


camera) 
--Email, instant messaging 
--MP3 audio 
--Red-eye reduction
• If computers are so stupid... why are they so useful?

7
Who Does This Mapping?

Programmers

8
Programmers Make It Happen!

• Human programmer thinks of a useful feature 


--Creativity, insight about problems, computers, ...
• Programmer thinks through the solution
• Breaking it down, directing the computer
• Writing code for the computer
• This is what computer programming is
• Every useful feature you've ever used has this pattern
• Combine the best features of both sides: insight +
inexpensive/fast

9
Hardware and Software

• "Hardware" refers the physical parts of the


computer, and "software" refers to the code that
runs on the computer.

10
Chips and Transistors

• Transistor - important building block


• Chip - fingernail sized silicon
• Chip can contain billions of transistors e.g. CPU
chips, memory chips, flash chips
• "Solid state" - no moving parts
• Chips are very sensitive to dust..

11
Moore’s Law*

• Transistors get smaller about every 2 years


• Can fit twice as many per chip
• In effect, transistors/computers get cheaper
• Observation vs. "law"
• $50 MP3 player bigger each year: 2GB, 4GB, 8GB
• Cheaper, cheaper, cheaper
• Why computers are now in cars, thermostats, ...

*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

• How much can one byte hold?


– 1 bit -- 0/1 -- 2 patterns
– 2 bits -- 00/01/10/11 -- 4 patterns
– 3 bits -- 000/001/010/011/100/101/110/111 -- 8 patterns
– 3 bit pattern has twice as many patterns vs. the 2 bit pattern
– 3-bit formed 0(the 4 2-bit patterns), 1(the 4 2-bit patterns again)
– So n bits has twice as many patterns as (n-1) bits
– What is the general formula for # patterns for n-bits?
– 2 ^ n (2 to the nth power)

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)

• One gigahertz is 1 billion cycles per second (a


megahertz is a million cycles per second).
• Gigahertz is a measure of speed, very roughly the
rate that at a CPU can do its simplest operation per
second

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

Computer Science = mathematics + engineering + natural science

– Like mathematicians, computer scientists use formal languages to


denote ideas (specifically computations)
– Like engineers, they design things, assembling components into
systems and evaluating tradeoffs among alternatives
– Like scientists, they observe the behavior of complex systems,
form hypotheses, and test predictions

22
Computer Program

• What is a computer program?


– A detailed, step-by-step set of instructions telling a computer what
to do
– If we change the program, the computer performs a different set of
actions or a different task
– The machine stays the same, but the program changes!

23
Computer Program

• Software (programs) rule the hardware (the physical


machine)
• The process of creating this software is called
programming
• Why learn to program?
– The process of learning to program is an excellent opportunity to
practice problem solving skills, which is the single most important
skill for a computer scientist
– Having an understanding of programming helps you have an
understanding of the strengths and limitations of computers
– Helps you become a more intelligent user of computers
– Programmers are in great demand!
– Programming is a fun!!
24
Hardware Basics

• The central processing unit (CPU) is the “brain” of a


computer
– The CPU carries out all the basic operations on the data
– Examples: simple arithmetic operations, testing to see if two
numbers are equal

• Memory stores programs and data


– CPU can only directly access information stored in main memory
(RAM or Random Access Memory)
– Main memory is fast, but volatile, i.e. when the power is
interrupted, the contents of memory are lost
– Secondary memory provides more permanent storage: magnetic
(hard drive, floppy), optical (CD, DVD)

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

• Programming languages are formal languages that


have been designed to express computations

– Natural language has ambiguity and imprecision problems when


used to describe complex algorithms
– Programs expressed in an unambiguous , precise way using
programming languages
– Every structure in programming language has a precise form,
called its syntax
– Every structure in programming language has a precise meaning,
called its semantics

28
Programming Languages

• High-level programming languages


– Designed to be understood by human
• Low-level programming languages
– Designed to be understood by machines (also known as machine
languages or assembly languages)
• High-level vs. Low-level
– It is much easier to program in a high-level language. Programs
written in a high-level language take less time to write, they are
shorter and easier to read, and they are more likely to be correct
– High-level languages are portable, meaning that they can run on
different kinds of computers with few or no modifications. Low-
level programs can run on only one kind of computer and have to
be rewritten to run on another

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

You might also like