Successfully reported this slideshow.
Your SlideShare is downloading. ×

Difference Program vs Process vs Thread

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Os
Os
Loading in …3
×

Check these out next

1 of 12 Ad

More Related Content

More from jeetendra mandal (20)

Advertisement

Recently uploaded (20)

Difference Program vs Process vs Thread

  1. 1. Programs vs Process vs Threads
  2. 2. What is Program? Program is the set of instructions that are arranged in the defined sequence to perform a particular task. the program generally resides in secondary memory (hard disk) and is comparatively larger. the process is a passive entity.
  3. 3. What is Process? The program under the execution is known as a process, each process is managed inside the main memory (RAM) and control and executed by using the microprocessor. each process has some properties such as process state, process id, program counter, stack pointers registers, accounting data, memory limits, etc. all this process information contains by the process control block.
  4. 4. What is Thread? Thread is an execution unit that is part of a process. A process can have multiple threads, all executing at the same time. It is a unit of execution in concurrent programming. A thread is lightweight and can be managed independently by a scheduler. It helps you to improve the application performance using parallelism. Multiple threads share information like data, code, files, etc. We can implement threads in three different ways: 1.Kernel-level threads 2.User-level threads 3.Hybrid threads
  5. 5. Program An executable file residing on disk Process One or more executing instances of a program. Processes have separate address spaces. Thread (or lightweight process) one or more threads of control within a process. Threads share the same address space.
  6. 6. Parameter Process Thread Definition Process means a program is in execution. Thread means a segment of a process. Lightweight The process is not Lightweight. Threads are Lightweight. Termination time The process takes more time to terminate. The thread takes less time to terminate. Creation time It takes more time for creation. It takes less time for creation. Communication Communication between processes needs more time compared to thread. Communication between threads requires less time compared to processes. Context switching time It takes more time for context switching. It takes less time for context switching. Resource Process consume more resources. Thread consume fewer resources. Treatment by OS Different process are tread separately by OS. All the level peer threads are treated as a single task by OS. Memory The process is mostly isolated. Threads share memory. Sharing It does not share data Threads share data with each other.
  7. 7. Program vs Process some key differences between Program vs Process : 1. A program and process both are related terms from each other, the lifespan of the program is longer than the process, it is considered as a system activity in the batch operating system it is called sequential executing instruction/jobs while in the real-time operating system it is called program. 2. User can run multiple programs parallel in the operating system the terms refer to programming operating system in which the operating system manages its program-related activity such as memory management, cache management, etc.
  8. 8. Program vs Process 3. A program is considered as a passive entity, in the operating system, for example, a batch file or executable file contains an ordered set of instruction/commands for performing any specific task, It is called passive because it does not perform any action by itself, it needs to execute the instruction one by one to get the specific task done. 4. For executing the program operating system allocates the memory to it. the address space of the program composed the address for instruction, data, and pointers. for eg. if P is the program the operating system will allocate the memory to P (before execution) and will explore the P’s address space then the operating system will schedule the execution of the p program and allocates the resource.
  9. 9. Program Process A program is a set of sequential ordered operations to accomplish a programming goal. Executing part of the program is known as a process. Program is generally static. Process is generally dynamic. The program needs memory (primary/secondary) for storage. The Resource requirement is high for the process. There is no duplication needed in the case of the program. A new sub/child process requires replication/duplication of their parent process. A program is stored on disk (secondary memory) or in it contains by some file for eg. batch script and does not require any other resources. Process captures resources like CPU, memory(primary), address, disk, I/O, etc and sometimes it produces deadlock situations. A program needs memory space on the disk to store all instructions. A process occupies many resources like memory, disk, mouse, keyboard, and other external devices. The nature of the program is passive, does not do anything until it gets executed by allocating the resource. The process is an instance of the program executed.
  10. 10. Program has no computation time and cost. Process has considerable single fact access and computation time. Program can be optimized to reduce the execution time and process. Process is a singleton entity and the execution depends on the processor. Deadlock creation and prevention depend on the program. Deadlock condition process stucks and waits for the resource consumed by the process which is waiting for the resource holding by the previous process. Program can control the memory resources and data needs to be used by memory. Process and its information can be controlled by process control block (PCB). Program cannot be decomposed or divided further and there is no such threshing in the program. The process can be further decomposed into the thread which is a part or instance of the single process. Program can contain the instruction to use cache for its data. Process can use cache to store and retrieve the data as it uses operating system paging scheme and cache replacement policy such as FCFS, LIFO, LRU, RR.
  11. 11. THANK YOU Like the Video and Subscribe the Channel

×