What are the operations on process?

A process is a program in execution and it is more than a program code called as text section and this concept works under all the operating system because all the task perform by the operating system needs a process to perform the task

The process executes when it changes state. The state of a process is defined by the current activity of the process.

Each process may be any one of the following states −

  • New − The process is being created.

  • Running − In this state the instructions are being executed.

  • Waiting − The process is in waiting state until an event occurs like I/O operation completion or receiving a signal.

  • Ready − The process is waiting to be assigned to a processor.

  • Terminated − The process has finished execution.

It is important to know that only one process can be running on any processor at any instant. Many processes may be ready and waiting.

Operations on Process

The two main operations perform on Process are as follows −

Process Creation

There should be four principle events which cause processes to be created.

System initialization

Numerous processes are created when an operating system is booted. Some of them are −

  • Foreground processes − Processes that interact with users and perform work for them.

  • Background processes − It is also called as daemons and not associated with particular users, but instead has some specific function.

Execution of a process-creation system call by a running process

The running process will issue system calls to create one or more new processes to help it do its job.

A user request to create a new process

A new process is created with the help of an existing process executing a process creation system call.

In UNIX, the system call which is used to create a new process is fork()

In Windows, CreateProcess(), which has 10 parameters to handle both process creation and loading the correct program into the new process.

Initiation of a batch job

Users are going to submit batch jobs to the system.

When the operating system creates a new process and runs the next job from the input queue in it.

Process Termination

Process is going to be terminated by a call to kill in UNIX or Terminate Process in windows.

Process is terminated due to following reason −

  • Normal exit − Most processes terminate when they have completed their work and execute a system call to exit.

  • Error exit − The third type of error occurs due to program bugs like executing an illegal instruction, referencing, or dividing by zero.

  • Fatal exit − A termination of a process occurs when it discovers a fatal error.

  • Killed by another process − A process executes a system call to kill some other process.