A program is essentially a sequence of machine instructions stored in a memory.
Now, each machine instruction performs a specific operation and is written in the computer's native
language.
Now, understanding this execution flow is essential to grasp how the system works from both the software
and hardware perspectives.
Now, to follow along with this course, you don't need any special hardware, just a computer with
a keyboard.
And the mouse is enough.
And all the exercises in this course can be done on most modern computers running Linux or using a Linux
like environment.
Uh, or it can be windows, so it doesn't matter at all, to be honest.
Now we typically write programs using high level programming languages like Python, Python, Java or
C, C plus plus.
Yeah, these are the programming languages, right?
That the human can read.
You can read this binary code.
Right.
Nor this.
Right.
Yeah.
Uh, and among this, uh, the fight remains one of the most popular choices and essentially common
on platforms like Raspberry Pi.
And to create and execute simple Hello world program in Python, we will create a new file and we will
name it main dot pi.
Let's for example main dot pi.
Oops, we got the two.
And here what we will do is basically we will print Hello world Occelli.
And that's it.
Or you can also do that with the text editor as well.
It doesn't matter at all.
Or let's use the mouse pad or yeah we don't have the mouse pad.
So we will use the text editor.
Not something.
Yeah, I don't know the name of this text editor, so we could launch one from the terminal, but in
this case, we will just run it from here.
Yes.
Open new.
Go to text editor.
Now it's a GNOME text editor.
Right.
GNOME text editor.
Main.py.
And that's it.
Here it will open the Main.py.
We will write.
Print.
Hello.
Hello, world.
And yeah, you can see we have the syntax highlighting here.
Coloring.
Uh, discard this here.
And as you can see we have the main.py.
And basically we will run it from the main.py and uh python3 main.py.
And you can see hello World here.
And we can do the exactly same thing on the Visual Studio as well.
Terminal.
New terminal.
Main python3 main.py.
And you can see hello world.
Also we will increase the text size a bit.
So you can see font size is going to be 2922.
Text editor font size.
26 maybe.
Yeah that's okay.
24 is better.
And here we can use plus and minus to increase the user interface with Control Plus and Control minus
we can increase and decrease the user interface size in Visual Studio, but this will basically serve
as serve the same purpose.
It's just more nicer basically.
And yeah, we have run the program and you can see we got the printed Hello World and Hello World actually
with two separate Python files.
And we can do the same on the C as well.
Main dot C or let's say test dot c.
And first we will need to include the STD standard input output stdio.h and integer main.
It's going to be return void printf.
Printf hello world from c a new line return zero.
So our application will close after execution.
Yeah basically that's it.
And as I said, we can do the same.
You can see I have test dot c here.
Now we have saved the file in test C.
Now we will need to compile it.
So as you see it's a pretty different with the Python.
And you will see and you will understand why it is right.
Because you need to compile it, compile the C code to run it.
So hello world.
And here we will test dot C.
And here you will see that we have the Hello World here created new program.
And we will just run it with the Hello World.
And here we are.
We have printed the hello from C text.
Now this practical comparison highlights the difference between the interpreted language which is Python,
and compiled language which is C or C plus, plus or many other languages.
There's there's so much compiled languages and yeah, Python translates and runs the code line by line.
Uh, but the C code, on the other hand, must be compiled first into machine instructions before it
can be executed.
Now C allows us to better observe how instructions interact with the underlying hardware, which is
why it is preferred language for this course.
So for the rest of this course we will mainly use C but we will.
We can go through Java Python according to examples to learn best.
And whether a program comes from an interpreter or a compiled file, its instructions and data must
be loaded into the memory before the CPU can run them.
Here's what happens during the execution.
The CPU or let's actually, if you remember from the previous lecture of our course.
And I'm sure you remember it, we had a sum diagram written.
Draw by me and we will open that.
And I will show you something here.
Let's move it into ubuntu.
And here our diagram.
Yes.
Where is our diagram.
Yeah.
It isn't here.
Yeah.
Here we have figure 1.1. jpg file.
Now what you can what you are seeing here is basically the CPU fetches instructions from memory by placing
the address on the address bus and signaling the read operation on the control bus.
You can see the memory system responds by placing the instruction on the data bus for the CPU to receive
right here.
Data bus.
And if data needs to be written back to the memory, the CPU uses data bus to send it.
The address bus here indicate where to store it and the control bus to signal a write operation.
Now this process repeats continuously while the program runs.
Now programs also communicate with the input output devices such as human interface devices or hit um
hide.
Yeah.
Uh which is keyboard mouse or touch screen.
And the machine interface devices devices which is basically uh, like storage devices, uh, network
cards.
And so on and so forth.
So input output devices are much slower than the CPU and memory due to varying speeds and data timing.
Now they require explicitly programmed instructions to operate correctly, which is where drivers come
into play.
Although the Advanced Input Output programming for now is beyond this course, we will still use a terminal
screen for the output.
Now, the operating systems provides built in input output functions and the C runtime library.
Here um includes functions to access them easily with this STD input output dot header file and to support
the programming tasks.
In this course, you will need a working Linux based Space environment.
This could be a native Linux machine, a virtual machine, or a windows subsystem.
Linux.
It's a relatively new thing, I can say.
Or you can also use a windows computer, but it is better to use the windows Linux as well.
Specifically Debian based operating system.
Now you can see these are the Debian based operating system, or you can use the Debian itself the most
the best operating system for a beginner.
If I can say it is Linux Linux Mint, I would recommend Linux Mint if you are a beginner because of
the user interface that is pretty similar to windows one as well.
And we have the Linux documentation tools as well.
Like Linux tools provide extensive documentations.
It's the Linux help is not as useless as windows help.
So yeah GCC help.
Uh.
Yeah.
GCC help will give you basic information about the options and parameters you can use with gcc command.
You can use man man man.
Uh, so this is uh basically manual pager utility.
You can find there's almost every there's almost man page for every command in Linux.
For example, we can do LLS man or man lls.
Man lls.
And you can see we have the list page for man.
That will be pretty handy when you developed or don't know the commands for sure, and you need to install
the info for the deep types.
Sudo apt install info.
Now it's already installed and newest version info info.
Now you can see.
Info.
I can say that better alternative for man, but man is useful as well.
It's.
You can choose how much information you need to read, so if you the info provides more information
than man.
And yeah, basically after doing the steps you also need a word processor.
Now by the word processor, I mean not to use the Libre Office or or Microsoft Word.
Um, they insert hidden formatting into your codes, which can break your code.
But you need to just at the lowest level you can use the VM.
Um, so the apt install vim.
This is more this is for more advanced users.
But once you start using vim you will get addicted to it.
This is a keyboard based women's keyboard based.
You can see uh now.
If you don't know, using the meme like you, you can probably use.
My keyboard Keyboards has some kind of problem here or I don't know.
Yeah.
And basically, uh, what I recommend you to use here, it is either vim if you want more advanced or
professional look vibes, or you can use, uh, Visual Studio Code, uh, which I recommend for flexibility
and graphical user interface features.
Now you can also download the themes for you, like let's say if you want we can also.
Yeah, here it is easily customizable and there's an extension.
So you can almost develop for any languages here even ARM which we will develop in next lectures.
Yeah the Visual Studio Code is good.
But if you like open source, what I can recommend, uh, as you know, Visual Studio Code is not open
source fully, so I think it was V's podium.
Yeah.
Open source binaries for VSCode.
Now, this is basically the same.
Just open source.
Um, and in my windows machine, I use the visual coding Visual Studio Code.
Um, but yeah.
It's also usable.
And how can you you use the Visual Studio Code, install the Visual Studio code is from the apt.
Is sudo apt install code snap.
Oh, yeah.
Sudo snap.
Install code.
Code.
And code is already installed.
Um.
And you can also download from the binary files and compile it yourself.
Or just download the dev file.
To your computer.
Click on release or install.
Yeah here we are.
You can download for windows, Mac OS, Linux.
You can see if you are using the.
Linux machine, you need to install the deb.
Deb file.
Basically, it's almost 100MB.
And yeah.
And in order to run some create some document or open some document, you can you just need to, uh,
add code before your file.
If you want to create a new file, my new file that for example txt you can even edit the txt files.
And here we are.
And you can select the languages see.
And yeah include include stdio dot h and so on and so forth.
And yeah our lecture is been almost 18 minutes.
Uh that's it with our lecture.
Thank you for watching.
Uh, in this lecture, what we have uh, basically learned is CPU execute instructions and contains
fast internal memory.
Memory stores data and instructions.
Input output enables external communication and storage.
Pass.
Uh.
Basically pass transfers the data addresses and control signals.
Program execution is basically how instructions move through the system and programming environment,
which is customizable, and how to prepare your Linux environment for development.
And yeah, that's it with our lecture.
In our next lecture, we will begin learning how data is stored in a memory.
Get introduced to the C language and learn how to use the debugger as an educational tool.
Until then, that's it with our lecture.
Thank you for watching and I'm waiting you in the next lecture.