PowerPoint Presentation
Basics in programming
Course objectives
The student knows how real world problems can be modelled in software and is able to design and implement small object oriented program in Python.
Student can apply basic programming concepts in solving small programming problems.
After the course student understands the basic functionality of a computer device, and how it is controlled using a computer program.
Course contents
The role of programming in systems development.
Introduction to object oriented programming: classes and objects, methods.
What’s need to complete course
Complete 70% of given excerises
Hardware
Basics of HW / SW
Hardware
Hardware architecture
Hardware
Central processing unit (CPU)
CPU is responsible of execution of the progam
Controls other devices
Has both control and arithmetic units
Hardware
CPU
Basic operation:
-Fetch order
-Decode order
-Execute order
-Save result of execution
Hardware
CPU (Machine code)
https://en.wikipedia.org/wiki/Machine_code
Hardware
Memory
Various options for saving data:
-short term / long term
-static / temporary
-fast / slow
Hardware
Memory
Runtime information can be saved into central memory
Fast, temporary ja short-term
Hardware
Memory
External memory is controlled by CPU’s Control Unit.
External memory is persistent between different executions of program
Slow, long-term and persistent
Hardware
Harware
I/O device
Various input devices and outputs
These devices and their behaviour is controlled by the CPU
Hardware
Input devices
Input
Harware
Output device
Hardware
Graphics Processing Unit (GPU)
Mainly used to calculations related to graphics so that displaying of data is fast enough
But is able to perform parallel computing and so can support CPU on calculation tasks
Hardware
CPU / GPU differences
Hardware
Software
Software
Software
Machine code
A compiler is a software program that transforms high-level source code that is written by a developer in a high-level programming language into a low level object code (binary code) in machine language, which can be understood by the processor.
The process of converting high-level programming into machine language is known as compilation.
Software
Machine code
Different CPU’s understand different machine code
For example Intel vs AMD or ARM.
Software
Machine code
There are also different compilers and they have various settings
https://en.wikipedia.org/wiki/List_of_compilers
Software
Machine code
Result that compiler generates is list of individual orders
By executing orders from top to bottom, one by one, CPU completes a task given.
Software
Software
Software
Machine code
CPU’s work is controlled by clock cycles.
During one clock cycle CPU executes one or more orders
(Older computers were only able to perform one order per clock cycle)
Software
Machine code
The speed of a computer processor, or CPU, is determined by the clock cycle, which is the amount of time between two pulses of an oscillator.
Generally speaking, the higher number of pulses per second, the faster the computer processor will be able to process information.
Software
Machine code
Computer processors can execute one or more instructions per clock cycle, depending on the type of processor.
Early computer processors and slower CPUs can only execute one instruction per clock cycle, but modern processors can execute multiple instructions per clock cycle.
Software
Machine code
Software
Machine code
Software
Execution of program
For example Firefox.exe contains millions lines of machine code. Execution of this machine code happens by running Firefox.exe which is result of compilers works. CPU runs lines in Firefox.exe from top to bottom. F
For example first 1000 lines can contain taks that relate to starting of program
Software
Execution of program
During the execution of program, machine code is loaded into central memory
When code is executed CPU fetches one order, executes its commands and saves the result
During one second, billions of such operations are done
Software
Software makes CPU/computer intelligent
Software
CPU’s are efficient but stupid
Efficient = they are able to process masses of data and exeucute billions of operations in second
Stupid = Each order is simple and mechanical
CPU’s is not able to think or make decissions on its own
Software
Task of programmer is to create program that meets the requirements of feature needed. Then CPU executes this program inorder to implement feature
Software
Programmer uses languages like:
C++, JAVA, Python, Swift, Javascript, etc…
Demos of language….
Software
Lets familiarise ourselves with programming:
https://studio.code.org/hoc/1
Excerise 1.
What are the rolses of arithmetic unit and control unit in the CPU?
Familiarize yourself with Interpreter, Just-in-Time (JIT) compiler and compiler.
Whats the difference between them?
Give examples of systems that use them?
/docProps/thumbnail.jpeg