Process Management In Linux

A process is a program under execution. (or)

A process is an instance of a running program.

The process has its own address space in memory, a thread of execution, and characteristics such as security context, environment and current priority.

The Linux kernel tracks every aspect of a process by its process ID number information about each process is advertised by the kernel to user program through the / process/ PID

When a process starts another program, the new process is called a child process. This original process is the parent process of its child process. Child process inherit characteristics from its parents, such as its environment and the user and groups it's as which it's run.

There are two types of process in Linux:

  • Foreground process.
  • Background process.

Foreground process: In Foreground user can execute only one process (or) job.

EX: $ firefox  

To kill the foreground job in Linux:

Ctrl + C EX: $cp file1 file2  

Background Process:

n Background user can execute many jobs at a time.

EX:  $fire fox & $ cp file1 file2 

To check the jobs list in Linux:      

$jobs PS:  Displays information about the running process. $ps

To view the process with more detailed information:

$ ps U  

I can detail a particular process:

$ ps aux / grep ssh (or) $ ps aux

Kill: Terminates a process

Syn: $kill PID $ kill 4286 Sometimes if the kill command doesn’t work the way you intended it to, you can also call it with the 9 option to give it a priority on the system.

$Kill -94286   Signal

Signal: The operating system communicates to process through signals. These signals report events or error situations to processes. In many cases, signals will result in the process existing

  • One typical signal is SIGTERM, which terminates the process; it asks it to exit cleanly.
  • Another is SIGKILL, which kills the process; the process is required to exit immediately.

To find the PID(s_ belonging to the SSH service)

$ pidof sshd (or) $ Pgrep sshd

Top: Monitors system resources (similar to task manager in windows)

Options:$top

S --->To change the time interval for updating top results (Sec’s)

R --->   To sort by PID number

U --->   Username to get only that user process details

P --->   To sort by CPU utilization.

M --->   To sort by RAM utilization.

C --->   To display or hide command full path.

R --->   To renice a process

K --->   To kill a process

W --->   To save the modified configuration

Z --->   to Quit

When you’re comfortable working with processes, you can then make some more advanced adjustments, such as changing the priority of a particular process.

Renice:  Adjusts the priority of a particular process.

Syn: renice <priority> [options] -p changes process priority for a particular PID -u changes process priority for a particular user(s)

The priority value range from -20 (first priority) to 20 (dead last priority). Only the root user may set processes to use a priority under o. #renice -23874 *

Note: If all ready processes have the same priority, they will share the processor equally. Priority only has an effect when two processes at different priority levels are computing for CPU time, In which case the lower priority process will get less time & appear to run more slowly.

Nohup: The nohup jobs will create in server account so nohup jobs will execute even the user disconnects from his account. Ex:$nohup cp files1,file2 & $nohup firefox    

Communication commands

The main concept of communication facility exchanging of information or files from one user to another user.

Write: It is used to write a message to another user account, but he should be logged into the user. $write user name/terminal name ----------------------- Ctrl+d  (Save & quit)

  • To deny messages: $mesg n
  • To allow messages: $mesg y

Wall: It is used for to send a broadcast message to all users who are connected to server $ wall Welcome to Linux ______________ Ctrl+d (save & quit)

Mail:   Using mail command you can quickly and efficiently circulate memos and other written information to your co-workers you can even send and receive emails from people outside your organization. $ mail  user1@server254.example.com single user $mail user1,user2,user3              

multiple users at a time $ mail  user1<stud It translates files to the user. $ mail user2<backup-file

  • Mails are stored in mailbox: (/var/spool/mail/username)
  • Go open the mailbox: $mail

Inclined to build a profession as Linux Developer? Then here is the blog post on, explore Linux Training

Note: By default, all mails will store in the primary mailbox (Nor/spool/mail).  It will open mails in primary mailbox transferred to the secondary mailbox (i.e mbox) àTo open secondary mailbox: $mail – f

The primary mailbox only maintains unread mails.

Mail box options:     

Q --->quit                          

d -->delete

R --->reply                      

d2 ---> delete 2nd mail

P ---> print 

w filename --> IT writes to new file *

 

Linux Tutorials

 

One Bit Equals to how many bytes

The bit is the smallest component of data and byte is larger than bit size. The size 1000 can be replaced with 1024 and still be correct using the other acceptable standards. Both of these standards are correct depending on what type of storage you are referring to.

Processor (or) virtual storage                                                     Disk Storage

1          bit                =    Binary digit                                       1 bit           =   binary digit

8          bits               =    1 byte                                               8 bits          =   1 byte

1024    bytes            =    1 kilobyte                                         1000 bytes   =   1 kilo

1024    kilo               =    1 mega                                             1000 kilo       =  1 mega

1024    mega            =    1 Giga                                              1000 mega     =  1Giga

1024    Giga              =    1 Tera                                              1000 Giga        =  1 Tera

1024    Tera              =    1 Peta                                               1000 Tera        =  1 Peta

1024    peta             =    1 exa                                                 1000 peta        =  1 Exa

1024    exa               =    1 zetta                                              1000 Exa          =  1Zetta

1024    zetta             =    1 yotta                                             1000 Zetta        =  1 Yotta

1024    yotta            =    1bronto                                            1000 Yotta        =  1 Bronto

1024    Bronto         =    1 Geo                                                1000 Bronto     =  1 Geo

For an in-depth understanding of Linux click on