Friday, 13 November 2020
What is Algorithm?
An algorithm is the step-by-step procedure to solve the problem.
When you on a computer to solve any problem, You follow some steps to solve that problem, You can write in a sequence using natural language all those steps which takes you towards the solution this is algorithm.
What is Pseudocode?
Pseudo means Not Genuine, Artificial.
It Looks like code to some extent, but it is not code in some specific programming language.
It is some type of Pre-Code which you can easily convert into any programming language.
In generally pseudocodes are easily understandable by programmers and they can convert these into the any programming language.
To some extant pseudocode are also understandable by nontechnical people.
What is Program?
Program is the exact code written in any programming language to solve any problem.
We can write a program directly if we know some programming language.
If you are following a proper sequence its number comes on the third.
First, we write Algorithm, then we convert that into the pseudocode and finally we convert that pseudocode into some program using some specific programming language.
Algorithm to measure the area of a rectangular
Algorithm:
Get the width of the rectangular
Get the length of the rectangular
Multiply the width with length
Result of the multiplication will be the area of rectangular
Pseudocode to measure the area of a rectangular
Pseudocode:
AreaOfRectangular()
Begin
Read: Width & Length
Area = Width x Length
Print Area
End
Program to measure the area of a rectangular
Program
AreaOfRectangular()
{
int Area = 0;
int Width = 50;
int Length = 60;
Area = Width * Length;
cout<<Area;
}
Saturday, 18 July 2020
What is Thread in Operating System?
First of all you should know that a thread is also known as lightweight process.
It is a sequence of instruction within a process. A thread itself behave like a processes in a process.
It behave like a process within the process, but it don’t have a complete PCB it relays on the PCB of the process under which it is behaving like a process.
A process can have multiple threads, all those multiple threads in the process help the process to perform multiple executions which improves the working.
There must be at least one thread in a process.
A thread pass through three states:
- Running
- Ready
- Blocked
Benefits of Threads:
It share common data and do not use the Inter process communication.
Speed improvement when multiple threads cooperate to complete a single job.
Context switching becomes fast when working with threads.
Threads use very little recourses of OS as they don’t demand complete separate PCB.
It share common data and do not use the Inter process communication.
Speed improvement when multiple threads cooperate to complete a single job.
Context switching becomes fast when working with threads.
Threads use very little recourses of OS as they don’t demand complete separate PCB.
Friday, 17 July 2020
Saturday, 11 July 2020
State Diagram in Software Engineering | State Machine Diagram
State Diagram is one of the UML Diagram which use to show the dynamic behavior of the system.
We use the state diagram only when any object of the system changes its states in the life. This diagram helps us in representing how an object goes through from one state to other and what are the factors which make the object to transit from one state to other, When object move from one state to other if we have options to go in different states so what state an object chose to move forward and where the chosen state take the object.
there is no Rocket science involve in the state diagram, you being an object of the person class have a unique name lets say "John" and you in your whole life make keep transiting through different states up different factors.
The factor of feeling sleepy transit you to the sleeping state, the factor of being hungry transit you to the eating state, the factor or the environment which you hate transit you to the Angry state.
This UML Diagram only represent your transitions from one state to another in a flow.
Being a human if you start to make your life state diagram I don't think you can predict all the states through which you will pass in future. Because it depends on the environmental factors and lots of other external factors but the GOD knows your state diagram very well isn't it?
same like this when you develop a software, It could be the bundle of classes, and there would be lots of objects of different classes, Now the object of the class do not know the states from which or to which it will transit in the whole life, But the creator of the object in this case that's you being a programmer or Software Engineer knows very well the states from which an object going to pass in different situation so according to your knowledge you make this state diagram.
Now The objects in the software are not like Humans they some times change the states but most often they are assign to a task (specific task) and by remaining in a single state the keep performing those tasks and dies at the end just after completing the assigned task this is the case in most of the objects in software you don't have to draw state diagram for these kind of software just think if the software is not changing the state in the whole life what is the purpose of making state diagram.
If there are some objects who are assigned to some task but change the state on factors then you have to make a state diagram for it.
I have given the examples of objects changing the states, may be the example of Easypaisa in the video will be beneficial to understand what I have describe in the whole article till now.
I will recommend you to watch the video now it will help you to clear the concepts.