Home / UNIX / Process Management In Unix

Process Management In Unix

Process Basic:

The process is the smallest unit in a computer system that performs the task. Unix operating system executes the program with the help of kernel using process. The Unix kernel controls any type of process for executing the commands and related instructions.

Process State:

Process state in Unix
image source:-http://www.macdesign.net

Process State Transaction:

The process gets change on the base of the particular situation and the running state execute the processes but may be terminated due to lack of resources or error. The system maintains signals for suspended processes. The system maintains signals for suspended processes. The system also collects resources for execution of ready state and provide to the kernel for execution. The whole process identifies as state transaction.

Process Control Block(PCB):

All of the information needed to keep track of a process when switching is kept in a data package called a process control block. The process control block typically contains:

  • An ID number that identifies the process.
  • Pointers to the locations in the program and its data where processing last occurred.
  • Register contents.
  • States of various flags and switches.
  • Pointers to the upper and lower bounds of the memory required for the process.
  • A list of files opened by the process.
  • The priority of the process.
  • The status of all I/O devices needed by the process.

Internal & External Command:

The external command includes Unix utilities & create a new process for executing the existing command. It means the shell manages the done of the existing command and use at a time of processing. Internal commands are built-in commands for the existing shell. The system executes these commands directly without creating a new process. The assignment of variable, change directory location etc are the internal commands.

1. Listing Process:

Linux system allows us a method for listing the files which are currently in use to display the process details like process id, process time etc.

A) PID:

A display the process identification number.

B) TTY:

It displays the terminal where the process was stored.

C) Time:

It identifies CPU time process.

D) CMD:

It identifies a name of the process.

example: PS↵

6. Process Creation Basics:

The system uses system cells for creating the processes.

A) fork():

It is a system call that creates the new process for existing instruction. It uses a copy of the process to execute existing command and generate process Id for identifying the existing process.

B) exec():

The fork system call transfers the process to exec for execution. This system call overwrites the process after executing the command. The new process starts execution after selecting by the scheduler.

C) wait:

The parent process calls this system call till the new or child process get the finish or suspend. After receiving the signal from the child process, the parent process is free to continue its functioning.

7. Role Of INIT:

The system manages the booting process with the help of auto-running process that is known as the initial process. This process identifies by PID1 because it is the first real process of the system. It controls the CPU register, Stack, and other resources at the time of booting.

8. Exporting Variable:

LS allows us a method to share the value of a particular variable at different shells for processing. It means we can access the value of the variable at another shell.

A) export:

It is a command that shares the value of the particular variable at a different shell. In this, we pass variable identifier as arguments.

Example:

a=0

export a

9. Exit Status Of Process:

The system use process for executing the commands and return a value after execution. The value indicates whether a process has been successfully executed or generate some error. The process returns 0 if it is successfully executed. Otherwise, return the non-zero value. A command $? is used to get the status of the existing process.

Example: $?↵

10. Killing Process:

The process is executed into the system and define with particular PID. The Unix system allows us to terminate the process with the help of kill command. In this, we pass process ID to stop the processing.

Example:

kill_<process id>

kill<1300>↵

A) Signals:

It is a simple message that can be communicated used to process with like kill. The system generates a signal line 7,9 etc for the different process after terminating the existing command. The advantage of this signal is that it can be sent to a process even if it is not attached to a terminal & displaying its interface so that the server provide required resources as interface still be shut down by sending the opposite signal. We use Ctrl+C to terminate the processing of the existing process.

B) Scheduling Priority:

Scheduling the process to arrange the processes in a particular sequence executed on the base of rank, there are different scheduling method for arranging the process and execute on the base of priority.

C) Nice

It is a command that allows displaying the scheduling priority for the existing process. We use to set the priority for particular command,

D) Renice:

It is a command that allows rescheduling the process priority.

11. Running Command In Background:

Linux operating system allows us a method to execute the particular process and transfer into the background. It is basically used to manage those type of commands which are a process with maximum CPU time than with a need to transfer the existing process in the background.

A) Nohup:

It is a command that also transfers the process in the background. It stores the output data into the nohup.txt file.

Example:

nohup sort abc↵

12. Job Control:

The commands are executed at the command prompt and same commands take maximum time. The system provides controls to manage this type of process in the background or terminate.

ctrl+e(terminate)

A) bg:

It is a command to suspend the process which is executed in the background.

Example:bg↵

B) FG:

It is a command that allows resuming the background process.

C) ctrl+z:

It is the combination keys that allow terminating the process at the running time.

D) Sleep:

It is a command that allows setting the interval between the process. In this, we pass mini seconds as arguments.

Example:

sleep 10000↵

13. Scheduling Process:

The system arranges the process in a particular sequence and transfers to a scheduler for managing the sequence. It assigns the job number on the existing process, the schedule select on the base of sequence and transfers to the kernel for execution.

A) at:

It is a command that displays the scheduling process on the base of given job number. In this, we pass a numeric value to display the process. We use -l option to display the pending process, -d to delete the job process.

Example:

at -d↵

Crontab File Format:

The system provides a function to schedule process as per the user requirement. The system uses a file format to manage the scheduling details and control with chronograph. Corn at each time. This file available in the user directory. All crontab file contains list of command along with the corresponding schedule of extension.

1. Crontab Entry:

It is consist of different fields to manage the process details. It contains minute as the day of the month. Month and day of the week of the command numeric format cront.txt to manage the scheduling details and display with crontab command with -l option.

About Parichay

Check Also

Unix Pipe And Redirection

Standard Input/Output: Linux operating system uses different types of input/output devices like keyboard, mouse, monitor, …

Leave a Reply

Your email address will not be published. Required fields are marked *