1.

What do you understand about processes and threads in the context of an operating system?

Answer»
  • Process: Any program in execution is referred to as a process. Any process is controlled by a process control block. Process priority, process id, process state, CPU, register, and other information are all stored in the Process Control Block (PCB). Child Processes are created when a process spawns another process. It takes longer for a process to end, and it is isolated, which means it doesn't SHARE memory with other processes.
  • Thread: A thread is a section of a process, which means that a process can have several threads, all of which are CONTAINED within the process. A thread can be in one of three STATES: running, READY, or blocked. Threads require less time to terminate than processes, but they do not isolate like processes.

The following table illustrates the differences between them:

Process Thread
The creation of a process takes more time.The creation of a thread takes less time.
Switching between contexts from one process to another takes longer.Switching between contexts from one thread to another takes less time.
In terms of intercommunication, the process is inefficient.In terms of intercommunication, Thread is more efficient.
Different processes use different areas of memory. They do not share memory.Threads of the same process share memory.
The Process Control Block, Stack, and Address Space are all unique to each process.All threads of the same process share the process control block but have different thread control blocks, stack and address space.
When one process gets blocked, it does not affect the other running processes.When one thread gets blocked, all the other threads of the same process get blocked.
The operating SYSTEM interface is used for process switching.Thread switching does not necessitate invoking an operating system or causing a kernel interrupt.


Discussion

No Comment Found