WEBVTT

00:00.480 --> 00:04.840
A program is essentially a sequence of machine instructions stored in a memory.

00:04.840 --> 00:10.200
Now, each machine instruction performs a specific operation and is written in the computer's native

00:10.200 --> 00:10.840
language.

00:10.840 --> 00:17.200
Now, understanding this execution flow is essential to grasp how the system works from both the software

00:17.200 --> 00:18.920
and hardware perspectives.

00:18.960 --> 00:23.920
Now, to follow along with this course, you don't need any special hardware, just a computer with

00:23.920 --> 00:24.600
a keyboard.

00:24.600 --> 00:26.080
And the mouse is enough.

00:26.080 --> 00:32.560
And all the exercises in this course can be done on most modern computers running Linux or using a Linux

00:32.560 --> 00:33.760
like environment.

00:33.840 --> 00:39.680
Uh, or it can be a windows, so it doesn't matter at all, to be honest.

00:39.960 --> 00:47.800
Now we typically write programs using high level programming languages like Python, Python, Java or

00:47.880 --> 00:49.200
C, C plus plus.

00:49.240 --> 00:51.000
Yeah, these are the programming languages, right?

00:51.040 --> 00:52.320
That the human can read.

00:53.320 --> 00:55.000
You can read this binary code.

00:55.000 --> 00:55.440
Right.

00:55.960 --> 00:56.720
Nor this.

00:58.040 --> 00:58.520
Right.

00:59.160 --> 00:59.640
Yeah.

01:00.120 --> 01:06.970
Uh, and among this, uh, the fight remains one of the most popular choices and essentially common

01:07.010 --> 01:09.810
on platforms like Raspberry Pi.

01:10.850 --> 01:17.650
And to create and execute simple Hello world program in Python, we will create a new file and we will

01:17.650 --> 01:19.250
name it main dot pi.

01:19.290 --> 01:22.810
Let's for example main dot pi.

01:23.970 --> 01:26.530
Oops, we got the two.

01:29.130 --> 01:38.770
And here what we will do is basically we will print Hello world Occelli.

01:39.690 --> 01:40.570
And that's it.

01:42.370 --> 01:45.170
Or you can also do that with the text editor as well.

01:46.050 --> 01:47.490
It doesn't matter at all.

01:51.490 --> 01:58.330
Or let's use the mouse pad or yeah we don't have the mouse pad.

01:58.490 --> 02:00.570
So we will use the text editor.

02:04.460 --> 02:06.060
Not something.

02:08.660 --> 02:14.300
Yeah, I don't know the name of this text editor, so we could launch one from the terminal, but in

02:14.300 --> 02:16.620
this case, we will just run it from here.

02:16.940 --> 02:17.540
Yes.

02:17.820 --> 02:19.780
Open new.

02:21.620 --> 02:22.980
Go to text editor.

02:23.380 --> 02:24.940
Now it's a GNOME text editor.

02:24.980 --> 02:25.420
Right.

02:26.100 --> 02:30.020
GNOME text editor.

02:30.580 --> 02:31.860
Uh, main dot pi.

02:34.140 --> 02:35.060
And that's it.

02:35.940 --> 02:37.220
Here it will open the main dot.

02:37.220 --> 02:38.900
Pi will write.

02:39.020 --> 02:39.860
Print.

02:40.500 --> 02:41.180
Hello.

02:42.660 --> 02:44.460
Hello, world.

02:46.740 --> 02:49.980
And yeah, you can see we have the syntax highlighting here.

02:49.980 --> 02:50.740
Coloring.

02:51.300 --> 02:53.380
Uh, discard this here.

02:53.380 --> 02:55.500
And as you can see we have the main dot pi.

02:55.540 --> 03:01.500
And basically we will run it from the main dot pi and uh python3 main dot pi.

03:02.340 --> 03:04.140
And you can see hello World here.

03:04.140 --> 03:09.220
And we can do the exactly same thing on the Visual Studio as well.

03:10.700 --> 03:11.540
Terminal.

03:11.860 --> 03:12.980
New terminal.

03:13.540 --> 03:16.340
Main python3 main.py.

03:16.660 --> 03:19.060
And you can see hello world.

03:19.820 --> 03:23.100
Also we will increase the text size a bit.

03:23.900 --> 03:33.220
So you can see font size is going to be 2922.

03:37.700 --> 03:39.380
Text editor font size.

03:43.060 --> 03:44.300
26 maybe.

03:45.380 --> 03:46.380
Yeah that's okay.

03:47.380 --> 03:49.020
24 is better.

03:50.820 --> 04:01.380
And here we can use plus and minus to increase the user interface with Control Plus and Control minus

04:01.380 --> 04:08.510
we can increase and decrease the user interface size in Visual Studio, but this will basically serve

04:08.550 --> 04:10.230
as serve the same purpose.

04:10.230 --> 04:12.950
It's just more nicer basically.

04:13.310 --> 04:20.630
And yeah, we have run the program and you can see we got the printed Hello World and Hello World actually

04:20.670 --> 04:22.630
with two separate Python files.

04:22.910 --> 04:26.950
And we can do the same on the C as well.

04:27.310 --> 04:30.470
Main dot C or let's say test dot c.

04:31.190 --> 04:40.630
And first we will need to include the STD standard input output stdio.h and integer main.

04:40.670 --> 04:43.830
It's going to be return void printf.

04:45.150 --> 04:53.750
Printf hello world from c a new line return zero.

04:53.750 --> 04:56.270
So our application will close after execution.

04:59.030 --> 05:02.270
Yeah basically that's it.

05:04.110 --> 05:07.560
And as I said, we can do the same.

05:07.560 --> 05:09.880
You can see I have test dot c here.

05:10.440 --> 05:13.720
Now we have saved the file in test C.

05:14.160 --> 05:15.880
Now we will need to compile it.

05:16.520 --> 05:19.960
So as you see it's a pretty different with the Python.

05:19.960 --> 05:24.240
And you will see and you will understand why it is right.

05:24.720 --> 05:29.280
Because you need to compile it, compile the C code to run it.

05:30.400 --> 05:33.520
So hello world.

05:34.160 --> 05:36.760
And here we will test dot C.

05:37.480 --> 05:41.800
And here you will see that we have the Hello World here created new program.

05:42.120 --> 05:45.640
And we will just run it with the Hello World.

05:45.640 --> 05:46.720
And here we are.

05:46.720 --> 05:51.560
We have printed the hello from C text.

05:51.600 --> 05:58.480
Now this practical comparison highlights the difference between the interpreted language which is Python,

05:58.720 --> 06:05.320
and compiled language which is C or C plus, plus or many other languages.

06:05.320 --> 06:14.770
There's there's so much compiled languages and yeah, Python translates and runs the code line by line.

06:15.090 --> 06:20.730
Uh, but the C code, on the other hand, must be compiled first into machine instructions before it

06:20.730 --> 06:21.890
can be executed.

06:21.930 --> 06:28.610
Now C allows us to better observe how instructions interact with the underlying hardware, which is

06:28.610 --> 06:31.330
why it is preferred language for this course.

06:31.890 --> 06:37.650
So for the rest of this course we will mainly use C but we will.

06:37.890 --> 06:43.730
We can go through Java Python according to examples to learn best.

06:49.450 --> 06:56.010
And whether a program comes from an interpreter or a compiled file, its instructions and data must

06:56.010 --> 06:59.330
be loaded into the memory before the CPU can run them.

06:59.610 --> 07:01.770
Here's what happens during the execution.

07:02.650 --> 07:09.370
The CPU or let's actually, if you remember from the previous lecture of our course.

07:11.970 --> 07:18.570
And I'm sure you remember it, we had a sum diagram written.

07:18.850 --> 07:22.970
Draw by me and we will open that.

07:22.970 --> 07:24.570
And I will show you something here.

07:25.890 --> 07:27.690
Let's move it into ubuntu.

07:28.170 --> 07:31.010
And here our diagram.

07:31.050 --> 07:31.450
Yes.

07:32.770 --> 07:33.930
Where is our diagram.

07:34.050 --> 07:34.450
Yeah.

07:35.650 --> 07:37.210
It isn't here.

07:52.530 --> 07:53.050
Yeah.

07:53.090 --> 07:57.210
Here we have figure 1.1. jpg file.

07:57.690 --> 08:06.730
Now what you can what you are seeing here is basically the CPU fetches instructions from memory by placing

08:06.730 --> 08:11.180
the address on the address bus and signaling the read operation on the control bus.

08:11.500 --> 08:19.220
You can see the memory system responds by placing the instruction on the data bus for the CPU to receive

08:19.260 --> 08:20.380
right here.

08:20.740 --> 08:21.380
Data bus.

08:21.980 --> 08:28.740
And if data needs to be written back to the memory, the CPU uses data bus to send it.

08:29.300 --> 08:36.860
The address bus here indicate where to store it and the control bus to signal a write operation.

08:36.900 --> 08:41.100
Now this process repeats continuously while the program runs.

08:44.180 --> 08:50.500
Now programs also communicate with the input output devices such as human interface devices or HID.

08:53.380 --> 08:55.060
HID yeah.

08:55.700 --> 08:58.860
Which is keyboard, mouse or touch screen.

08:59.580 --> 09:05.540
And the machine interface devices devices which is basically like storage devices.

09:07.380 --> 09:08.550
Network cards.

09:11.270 --> 09:12.390
And so on and so forth.

09:12.790 --> 09:20.950
So input output devices are much slower than the CPU and memory due to varying speeds and data timing.

09:20.990 --> 09:28.390
Now they require explicitly programmed instructions to operate correctly, which is where drivers come

09:28.390 --> 09:29.110
into play.

09:29.830 --> 09:37.550
Although the Advanced Input Output programming for now is beyond this course, we will still use a terminal

09:37.550 --> 09:40.190
screen for the output.

09:48.030 --> 09:55.470
Now, the operating systems provides built in input output functions and the C runtime library.

09:55.510 --> 10:05.310
Here um includes functions to access them easily with this STD input output dot header file and to support

10:05.310 --> 10:06.310
the programming tasks.

10:06.310 --> 10:09.320
In this course, you will need a working Linux based Space environment.

10:10.120 --> 10:13.560
This could be a native Linux machine, a virtual machine, or a windows subsystem.

10:13.560 --> 10:14.040
Linux.

10:16.080 --> 10:19.480
It's a relatively new thing, I can say.

10:20.640 --> 10:27.600
Or you can also use a windows computer, but it is better to use the windows Linux as well.

10:28.400 --> 10:31.080
Specifically Debian based operating system.

10:36.840 --> 10:46.280
Now you can see these are the Debian based operating system, or you can use the Debian itself the most

10:46.320 --> 10:48.200
the best operating system for a beginner.

10:48.400 --> 11:00.560
If I can say it is Linux Linux Mint, I would recommend Linux Mint if you are a beginner because of

11:00.600 --> 11:04.680
the user interface that is pretty similar to windows one as well.

11:07.520 --> 11:11.490
And we have the Linux documentation tools as well.

11:11.610 --> 11:14.850
Like Linux tools provide extensive documentations.

11:17.210 --> 11:20.570
It's the Linux help is not as useless as windows help.

11:21.370 --> 11:23.690
So yeah GCC help.

11:23.930 --> 11:24.250
Uh.

11:28.690 --> 11:29.170
Yeah.

11:29.370 --> 11:38.490
GCC help will give you basic information about the options and parameters you can use with gcc command.

11:39.570 --> 11:41.730
You can use man man man.

11:42.610 --> 11:48.490
Uh, so this is uh basically manual pager utility.

11:49.450 --> 11:55.610
You can find there's almost every there's almost man page for every command in Linux.

11:55.890 --> 12:00.250
For example, we can do lls man or man lls.

12:02.890 --> 12:03.930
Man lls.

12:05.650 --> 12:09.250
And you can see we have the LLS page for man.

12:12.250 --> 12:22.210
That will be pretty handy when you developed or don't know the commands for sure, and you need to install

12:22.210 --> 12:23.610
the info for the deep types.

12:23.970 --> 12:26.090
Sudo apt install info.

12:27.330 --> 12:31.650
Now it's already installed and newest version info info.

12:36.810 --> 12:37.730
Now you can see.

12:42.130 --> 12:42.570
Info.

12:42.570 --> 12:48.170
I can say that better alternative for man, but man is useful as well.

12:48.770 --> 12:49.210
It's.

12:50.050 --> 12:59.610
You can choose how much information you need to read, so if you the info provides more information

12:59.610 --> 13:00.370
than man.

13:02.010 --> 13:09.850
And yeah, basically after doing the steps you also need a word processor.

13:13.780 --> 13:19.500
Now by the word processor, I mean not to use the Libre Office or or Microsoft Word.

13:19.940 --> 13:24.380
Um, they insert hidden formatting into your codes, which can break your code.

13:26.740 --> 13:31.260
But you need to just at the lowest level you can use the VM.

13:32.020 --> 13:35.940
Um, so the apt install vim.

13:35.980 --> 13:38.180
This is more this is for more advanced users.

13:38.180 --> 13:43.020
But once you start using vim you will get addicted to it.

13:47.420 --> 13:50.900
This is a keyboard based women's keyboard based.

13:50.900 --> 13:53.180
You can see uh now.

13:55.300 --> 14:00.780
If you don't know, using the meme like you, you can probably use.

14:10.900 --> 14:15.830
My keyboard Keyboards has some kind of problem here or I don't know.

14:15.830 --> 14:16.150
Yeah.

14:17.990 --> 14:25.590
And basically, uh, what I recommend you to use here, it is either vim if you want more advanced or

14:25.590 --> 14:34.910
professional look vibes, or you can use, uh, Visual Studio Code, uh, which I recommend for flexibility

14:35.030 --> 14:36.830
and graphical user interface features.

14:36.870 --> 14:43.150
Now you can also download the themes for you, like let's say if you want we can also.

14:43.870 --> 14:49.230
Yeah, here it is easily customizable and there's an extension.

14:49.230 --> 14:56.590
So you can almost develop for any languages here even ARM which we will develop in next lectures.

14:57.670 --> 15:02.510
Yeah the Visual Studio Code is good.

15:02.830 --> 15:09.150
But if you like open source, what I can recommend, uh, as you know, Visual Studio Code is not open

15:09.150 --> 15:14.240
source fully, so I think it was V's podium.

15:15.400 --> 15:15.840
Yeah.

15:16.160 --> 15:17.800
Open source binaries for VSCode.

15:17.840 --> 15:19.440
Now, this is basically the same.

15:19.440 --> 15:20.560
Just open source.

15:20.880 --> 15:25.080
Um, and in my windows machine, I use the visual coding Visual Studio Code.

15:25.120 --> 15:26.800
Um, but yeah.

15:29.760 --> 15:30.760
It's also usable.

15:31.320 --> 15:37.440
And how can you you use the Visual Studio Code, install the Visual Studio code is from the apt.

15:37.800 --> 15:42.000
Is sudo apt install code snap.

15:42.040 --> 15:42.520
Oh, yeah.

15:42.720 --> 15:43.400
Sudo snap.

15:43.400 --> 15:44.200
Install code.

15:47.720 --> 15:48.320
Code.

15:49.200 --> 15:50.760
And code is already installed.

15:51.760 --> 15:52.200
Um.

15:52.240 --> 15:56.640
And you can also download from the binary files and compile it yourself.

15:56.960 --> 15:59.320
Or just download the dev file.

16:02.320 --> 16:03.360
To your computer.

16:05.480 --> 16:07.720
Click on release or install.

16:07.760 --> 16:08.920
Yeah here we are.

16:08.960 --> 16:11.400
You can download for windows, Mac OS, Linux.

16:11.800 --> 16:13.840
You can see if you are using the.

16:15.280 --> 16:17.160
Linux machine, you need to install the deb.

16:17.200 --> 16:17.880
Deb file.

16:19.000 --> 16:22.280
Basically, it's almost 100MB.

16:24.240 --> 16:24.840
And yeah.

16:24.880 --> 16:32.240
And in order to run some create some document or open some document, you can you just need to, uh,

16:32.560 --> 16:37.040
add code before your file.

16:37.160 --> 16:44.520
If you want to create a new file, my new file that for example txt you can even edit the txt files.

16:45.040 --> 16:46.120
And here we are.

16:46.240 --> 16:48.840
And you can select the languages see.

16:49.080 --> 16:55.680
And yeah include include stdio dot h and so on and so forth.

16:57.160 --> 17:00.720
And yeah our lecture is been almost 18 minutes.

17:00.880 --> 17:02.640
Uh that's it with our lecture.

17:03.720 --> 17:04.800
Thank you for watching.

17:04.800 --> 17:12.840
Uh, in this lecture, what we have uh, basically learned is CPU execute instructions and contains

17:13.320 --> 17:14.560
fast internal memory.

17:17.690 --> 17:22.970
Memory stores data and instructions.

17:24.890 --> 17:28.210
Input output enables external communication and storage.

17:30.650 --> 17:31.330
Pass.

17:32.410 --> 17:32.770
Uh.

17:32.770 --> 17:38.330
Basically pass transfers the data addresses and control signals.

17:40.090 --> 17:48.010
Program execution is basically how instructions move through the system and programming environment,

17:48.690 --> 17:55.210
which is customizable, and how to prepare your Linux environment for development.

17:56.250 --> 17:58.530
And yeah, that's it with our lecture.

17:59.610 --> 18:04.570
In our next lecture, we will begin learning how data is stored in a memory.

18:04.730 --> 18:10.210
Get introduced to the C language and learn how to use the debugger as an educational tool.

18:10.810 --> 18:13.170
Until then, that's it with our lecture.

18:13.210 --> 18:16.130
Thank you for watching and I'm waiting for you in the next lecture.
