GATE is one of the most competitive exams conducted in India. If you are an aspirant looking forward to cracking your GATE 2023 exams in flying colours, you might want to clarify all of your doubts. Well, say no more! The difference between and full-form articles are here to the rescue. In this article, we will discuss the difference between process and thread along with the difference between structure and glass.
So if you are also an aspirant for the GATE exams, read ahead to discover the primary differences between these technical terms. Remember that as a tech professional, you must be aware of all the terms used in day-to-day life- both technical and non-technical. Even the smallest errors can create blunders over time. So make sure you are aware of the basic concepts.
Difference Between Process and Thread
Process
Process means any program is in execution. It takes more time to terminate. It takes more time for creation. It also takes more time for context switching. A process is less efficient in terms of communication. Multiprogramming holds the concepts of multi-process. A process is isolated and is called heavyweight.
Process switching uses an interface in an operating system. If one process is blocked then it will not affect the execution of other processes. A process has its own Process Control Block, Stack and Address Space. If one process is blocked, then no other process can execute until the first process is unblocked. Changes to the parent process do not affect child processes. Want to know more on this topic? Check the difference between Process and Thread in detail here.
Thread
Thread means a segment of a process. It takes less time to terminate. It takes less time for creation. It takes less time for context switching. A thread is more efficient in terms of communication. We don’t need multi programs in action for multiple threads because a single process consists of multiple threads. Threads share memory and are lightweight as each thread in a process shares code, data and resources.
Thread switching does not require calling an operating system and causing an interrupt to the kernel. Second thread in the same task could not run, while one server thread is blocked. A thread has Parents’ PCB, its own Thread Control Block and Stack and common Address space. While one thread is blocked and waiting, a second thread in the same task can run. Since all threads of the same process share address space and other resources, any changes to the main thread may affect the behavior of the other threads of the process.
Difference Between Structure and Class
Structure
If the access specifier is not declared, by default all members are ‘public’.
An instance of ‘structure’ is called ‘structure variable’. Polymorphism and inheritance are not supported. It is a value type. Memory is allocated on Stack. Null values are not possible. It does not require constructors and destructors. Want to know more on this topic? Check the difference between Class and Structure in detail here.
Declaration
struct structure_name{
type struct_element 1;
type struct_element 2;
type struct_element 3;
.
};
Class
If the access specifier is not declared, by default all members are ‘private’. An instance of a ‘class’ is called an ‘object’. It supports polymorphism, and a class can also be inherited. It is a reference type. Memory is allocated on Heap. It can have null values. It requires constructors and destructors.
Declaration
class class_name{
data member;
member function;
};
We hope this article was helpful for you. Read more such articles to clarify your basics on all the concepts. It will help you understand all the topics once you are aware of the smallest of the concepts that surround them. If you are a GATE aspirant, we advise you to prepare a timetable and prepare for your exams accordingly. All the best for GATE 2023. Adios!