Friday, 9 March 2018

Dead lock:

Dead lock can be defined formally as follow ...

A set of process is dead lock.If each process in the set is waiting for an event that only another process in the set can calls.
Condition for dead lock:

Commander all showed that condition must showed there should be the dead lock.

Mutual-exclusion condition:

Each-resource is either currently assigned to exactly one process (or) is available.

Hold and wait:
Process currently holding resources granted earlier can request new resources.

Non preemptive condition:

Resource previously granted can not be forcefully taken away from the process.They must be explicitly released by the process holding them.

Circular wait:

They must be a circular chain of two (or) more process each of which is waiting for a resource held by the next number of the chain.


All four of then condition must be present dead lock to occur.It one of them is absent no dead lock is possible.

Dead lock modeling:

Resource node represent with square process node represent with circle.

p0      p1
|         |
r0      r1

A request     R                                         
B  request    S                          
C   request    T                                           A->B->C->A
A   request    R
B  request     S 
C    request  T

Arithmetic shell script:

To carry out arithmetic operation on variable have to use the command expression catch is able to carry arithmetic operation.

Ex: 
a=10 
b=5
echo  expression $ a+$b
echo expression $ a/*$b

  while evaluating an expression expression perform various arithmetic according to the following priorities.

Four decision making 
a) if -then-fi
b)if-then-fi
c)if-max-if-else-fi
d)case-asac

if-then-else if statement 
if(control command)
then statement
else statement
if 
read number
if($number - &to)
then 
echo regestive integer
else
echo positive number
is

pipe

pipe are used for inter process communication between two related process normal a pump is create by a process that process calls fork().

The pipe is used between parent and child. 

syntax:

pipe create calling function pipe int pipe(int Fields [2]);

Two file description are returned 2 fields arguments.

 SHELL PROGRAMING

Dead lock: Dead lock can be defined formally as follow ... A set of process is dead lock.If each process in the set is waiting for an ...