Subscribe by Email


Showing posts with label Avoid. Show all posts
Showing posts with label Avoid. Show all posts

Tuesday, June 4, 2013

Explain briefly Deadlock Avoidance and Detection?

Deadlocks are a serious issue that needs to be avoided since it can cause the whole system to hang or crash.

What is Deadlock Avoidance?


- Avoiding a deadlock is possible only if certain information regarding the processes is available with the operating system.
- This information has to be made available to the OS just before the resources are allocated to the processes.
- These are the processes that are to be consumed by the process in its lifetime.
- For every resource request made by the process, any potential threats are checked by the system i.e., whether granting the request of the process will send it in to an unsafe zone or not.
- If it is so then there are possibilities that the system could enter a deadlock.
- Therefore, only those requests are granted by the process that will ensure a safe state of the process.
- It is important for the system to determine whether the next level of the process will be safe or unsafe.
- There are 3 things that the operating system must know at any before or after the execution of the process:
1. The currently available resources.
2. The resources currently allocated to the processes.
3. Resources to be required and released in the future by these processes.

- It is possible that a process might be in an unsafe state but still may not cause a deadlock.
- By the notion of the safe and unsafe state of the process we refer to the system’s ability of entering in to a deadlock.
An example will make it clearer:
- Consider a resource A requested by a process which would make the process state unsafe.
- At the same time it releases another resource say B preventing the circular wait of the resources.
- In such a situation, the system is said to be in an unsafe state though not necessarily in a deadlock.
- There are various algorithms that have been designed for deadlock avoidance and one such is the banker’s algorithm.
- To use this algorithm knowledge about the resource usage limit is required in advance.
-  It is impossible for most of the systems to know what a process will request for in advance.
- This only implies that the deadlock avoidance is also not possible here.
- There are other two algorithms for achieving this task namely wound/ wait and wait/ die algorithms.
- Each of them makes use of a symmetry breaking technique.

What is Deadlock Detection?


- Deadlocks are free to occur under the implementation of this concept.
- Then through the state of the system, the occurrence of the deadlock is confirmed and subsequently mended.
- Here, the resource allocation activities are tracked along with the process states by certain algorithms.
- After this, the algorithm is used for removing the deadlock.
- Deadlock detection is quite easy since the OS scheduler knows about the resources that have been locked by the processes.
- Model checking is one of the techniques used for deadlock detection.
- In this a finite state model is created up on which a progress analysis of the process is carried out and all the terminal sets of the model are found.
- Each of these stands for a deadlock.
- Correction of the deadlock can be done by any of the below mentioned methods after the deadlock has been detected:
1. Process termination: This is about aborting one or more of the processes that cause the deadlock thus ensuring a certain and speedy removal of the deadlock. But this method might prove to be a little expensive because of the loss of the partial computations.
2. Resource preemption: This is about a successive preemption of the allocated resources until the breakdown of the deadlock.


Saturday, May 11, 2013

What is meant by Deadlock? List the necessary conditions for arising deadlocks?


Consider two competing processes or actions in a situation where both of them wait for each other to be done and so neither of them ever finish. Such a situation is called a deadlock. 
- When the number of competing processes is exactly two, then it is said to be a ‘deadly embrace’. 
- The two involved competing actions tend to move towards some sort of tragedy which might be mutual extinction or mutual death. 

"In operating systems a situation occurs where two threads or processes enter the waiting state at the same time because of the resource that they both want is being used by some other process that also in waiting state for some resource being held by another process in waiting state and so on". 

- It so happens that the process is then unable to change its state since the resources it requires are being used by the other processes which is then keeping the process in waiting state indefinitely. 
- The system is now in a deadlock. 
- Systems such as the distributed systems, parallel computing systems, multi-processing systems face the problem of being in a deadlock quite often. 
- This is so because here the hardware and software locks are purposed for handling the resources that are shared and implementing the process synchronization. 
- Deadlocks may also occur in telecommunication systems because of the corrupt signals and their loss rather than resource contention. 
- A deadlock situation can be compared to problems such as that of the catch-22 or chicken or egg problem. 
- A deadlock can also occur in a circular chain pattern. 
For example, consider a computer having 3 processes and corresponding 3 CD drives i.e., one held by each process. 
- Now all the three processes would be in a deadlock if they all request another drive.

Conditions for a Deadlock to arise

There are certain conditions that should be there for a deadlock to arise:
  1. Mutual exclusion: There has to be at least one resource that cannot be shared. So that only one process would use at any given time.
  2. Resource holding (or hold and wait): There should be at least one resource held by a process that in turn should be request more resources that are being held by other processes.
  3. No preemption: Once the resources have been allocated, they should not de-allocated by the operating system. The condition is that the process holding the resource must release it voluntarily.
  4. Circular wait: A circular chain of processes must be formed as explained in the earlier example.
"These 4 conditions for deadlock are collectively called the ‘Coffman conditions’. If any of these conditions is not met, a deadlock can’t occur".

- Handling a deadlock is an important capability of the operating systems. 
However, there are many modern operating systems that still cannot avoid deadlocks. 
- On occurrence of a deadlock many non-standard approaches are followed by different operating systems for handling it. 
- Many of these approaches try to avoid at least one of the Coffman conditions (generally the 4th one). 
- Below we discuss some of the approaches:
  1. Ignoring deadlock
  2. Detection
  3. Prevention
  4. Avoidance
- There is a second kind of deadlocks called the ‘distributed deadlock’ and it is common where concurrency control is used or we can say in the distributed systems. 


Friday, June 8, 2012

When should scrum be used and when should it be avoided?


There are conditions and situations encountered while the development of a software system is in process in which only one specific development methodology can be implemented! 
It does not mean that any software development methodology can be implemented any time and any where! This holds true for all the software development methodologies and so for scrum too! 
In the recent years of the use of the scrum development method, it has been observed that many developers and programmers have faced problems while implementing the scrum in the development process of their software product, project or application etc. The nature of the scrum development methodology should always be kept in mind while implementing it. 

What is Scrum Methodology?


- Scrum represents a light weight agile process frame work that primarily finds it use in the management of the software development process. 
- The scrum has been recognized under the category of light weight agile process frame works since it involves the use of very few elements, 3 core roles (namely the scrum master, development team, product owner) and three main artifacts (namely sprint backlog, product backlog and burn down chart). 
- With scrum, the rate of response to the ever changing needs of the customers is improved. 
Scrum cannot be called as a mere process but a frame work since it is composed of several concepts and practices that together can be used to build several combinations of processes.  
The iterations in a scrum process are cyclic in nature i.e. the iterations are repeated in every few weeks. 
- The requirements are supplied by the product owner as the user stories. 

When should scrum be avoided?


There are cases in which the scrum should be avoided! They have been mentioned below:
Case I: 
Implementing scrum in a problem for whose domain it is not compatible and
Case II: 
Implementing scrum in a development processes whose processes are against that of the scrum principles.
Case III: 
When the development processes of an organization works actively or passively against the principles of the scrum, then the scrum cannot be fully used here. 
Case IV: 
The scrum spirit is also threatened whenever a faux scrum is implemented by the company.
Case V:
Scrum can go wrong when the company involves too many people in the development process of so many projects! This phenomenon is called matrixing.
Case VI:
When the teams cannot commit to a fixed scope of work during a week, the scrum can not be implemented for that project since the scrum processes demand commitment. 

When should scrum be used?


There are cases in which scrum is used. 
Case I:
Scrum can be used well till the company is not bothered about the process that is being used at the team level and is not against the scrum values. 
Case II:
Also implementing scrum in a holistic way is itself an art and requires faith in scrum development process. 

Matrixing at the level of the scrum master is somewhat ok but may pose as a hindrance in the way of scrum. Matrixing is ok as far as the people involved in it have high knowledge and IQ levels. 

Usually teams like production support, network support and so on encounter this kind of problem with scrum. You should be careful while fixing the scope since if it’s too much for the team than your team can experience some serious dysfunction. In some cases if you are advocating for scrum, it may prove to be a disaster for you lest you know how to embrace it! 


Facebook activity