In this python tutorial part 2, we talk about the how does the computer programs work, what happening in the background when the system starts running the codes/programs, then what is programming, how the process behaves or what exactly happening when process is running or in running state.
Let’s start with, why python programming, for those who have an experience with other programming languages, for those who would like to skip the popular language (python), we would suggest them, to learn python for Data Science, Machine Learning and Artificial Intelligence because, it is very simple and easy to learn, this technologies growing day by day and also highly paid and it’s rapidly changing everything around us.
Next, how does the computer work, the most important component/element of a computer system, which we called it as CPU (Central Processing Unit). In other words, the brains of the computer where most calculations take place. we will be looking at how the CPU executes program instructions or instruction in the program is executed. In fact, most computers today can execute only one instruction at a time, even though they execute it very fast. It reads the list of instructions and executes each one in order. A list of instructions that a CPU can run is a computer program. We can give simple operations to CPU, called it as Opcode (Operation code) and amount of data to CPU with which the use of operation, called it as Data, where CPU execute both the opcode and data.
Adding another component, called it as RAM (Random Access Memory), typically used to load and store working data and operation code. A random access memory device allows data to be read or written in almost the same amount of time irrespective of the physical location of the data inside the memory, it moves to next line of the code, that is how CPU will translate the operations that the programmer has written into executable binary which it will work on and then what ever output of that operation it will write back to RAM. This output will directly display on screen.
How the processes work, after the program has been loaded into the computer’s memory in a binary form. An executing program needs more than just the binary code that tells the computer what to do. The program needs memory and various operating system resources in order to run.
“process” is what we call a program that has been loaded into memory along with all the resources it needs to operate. The OS handles the task of managing the resources needed to turn the program into a running process. Allocates some space again that is user to create more of data and then it will keep the track of which line of the code is being executed, called it as Stack. There can be multiple instances of a single program, each instance of that running program is a process.
Each process has a separate memory address space, which means that a process runs independently and is isolated from other processes. It cannot directly access shared data in other processes. Switching from one process to another requires some time for saving and loading registers and other resources
We finally made it into Threads, a thread is the unit of execution within a process. A process can have anywhere from one thread to many thread, many thread to many thread. Threads are sometimes called lightweight processes because they have their own stack but can access shared data. In multithreading process, will be able to do multiple task at same time without having to wait for one task to be completed before moving to next one.
We hope this python tutorial video will give you the better understand how does the computer programs work, what happening in the background when the system starts running the code/program, then what is programming, how the process behaves or what exactly happening when process is running or in running state.