Program v/s Process in Operating System

  • Program v/s Process :

1.  A process is a program in execution. 

 

  •  For example, when we write a program in C or C++ and compile it, the compiler creates binary code. 
  • The original code and binary code are both programs in high level and low level languages respectively. 

2.  When we actually run the binary code, it becomes a process. 

 

  • A process is an ‘active’ entity, while a program, is considered a ‘passive’ entity. 
  • A single program can create many processes when run multiple times; for example, when we open a .exe or binary file multiple times, multiple instances begin (multiple processes are created). 

PROCESS 


  • A process is a program in execution 
  • A process (program while executing) will need certain resources—such as CPU time, memory, files, and I/O devices—to accomplish its task. 
  • These resources are typically allocated by OS to the process while it is executing. 
  • A process is the unit of work in most systems. 

 

--The operating system is responsible for the following activities in connection with process management: 

 

  • Creating and deleting both user and system processes 
  • Scheduling processes and threads on the CPUs 
  • Suspending and resuming processes 
  • Providing mechanisms for process synchronization 
  • Providing mechanisms for process communication 
ADDRESS SPACE :


  • 1.  Text section—the executable code (instructions in binary format) 

 

  • 2.  Data section—Global variables 

 

  • 3.  Heap section—memory that is dynamically allocated during program run time 

 

  • 4.  Stack section—temporary data storage when invoking functions (such as function parameters, return addresses, and local variables) 

 

  • 5.  The sizes of the text and data sections are fixed, as their sizes do not change during program run time. 

 

  • 6.  However, the stack and heap sections can shrink and grow dynamically during program execution. 

 

  • 7.  The Stack area is used during function calls. 

 

  • 8.  The heap area is used to dynamically allocate the memory. 

 

  • 9.  Although the stack and heap sections grow toward one another, the operating system must ensure they do not overlap one another. 


Post a Comment

Previous Post Next Post