Operating Systems I-49
when the process has to wait endlessly because the requested resource may be held by other waiting
processes. This type of situation is known as ‘deadlock’. A deadlock situation arises if the following four
conditions hold simultaneously on the system:
• Mutual exclusion: Only one process can use a resource at a time. If another process requests for
the resource, the requesting process has to wait until the requested resource is released.
• Hold and wait: In this situation, a process might be holding some resource while waiting for addi-
tional resource, which is currently being held by the other process.
• No preemption: Resources cannot be preempted, that is, resources cannot be forcibly removed
from a process. A resource can only be released voluntarily by the holding process, after that pro-
cess has completed its task.
• Circular wait: This situation may arise when a set of processes waiting for allocation of resources
held by other processes forms a circular chain in which each process is waiting for the resource
held by its successor process in the chain.
The two schemes that ensure that deadlock never occurs are as follows:
• Deadlock prevention: The system should ensure that at least one of the four deadlock-causing
conditions would not hold true, so that deadlock can be prevented.
• Deadlock avoidance: Additional information concerning which resources a process will require
and use during its lifetime should be provided to the OS beforehand. For example, in a system with
one CD drive and a printer, process P might request first for the CD drive and later for the printer,
before releasing both resources. On the other hand, process Q might request first for the printer
and the CD drive later. With this knowledge in advance, the OS will never allow allocation of a
resource to a process if it leads to a deadlock thereby avoiding the deadlock.
5. Write in brief on the following terms.
(a) Buffer
(b) CLI
(c) GUI
(a) A ‘buffer’ is a temporary storage area that takes a stream of bits from a device such as keyboard
to a serial communication port. Buffers hold the bits and then release them to the CPU at a con-
venient rate, so that the CPU can act on it. This task is important when a number of processes are
running and taking up the processor’s time. The operating system instructs a buffer to continue
taking the input from the device. In addition, it also instructs the buffer to stop sending data back
to the CPU if the process, using the input, is suspended. When the process, requiring input, is
made active once again, the operating system will command the buffer to send data again. This
process allows a keyboard to deal with external users at a higher speed.
(b) ‘CLI’ (stands for ‘command line interface’) is an interface provided by OS, which facilitates the
user to enter commands via an interactive terminal. This interface was used in early days of com-
puting where commands were only means to initiate programs, applications etc. To use CLI, a user
had to learn many commands for proper operation of the system.
(c) ‘GUI’ (stands for ‘graphical user interface’) is an interface, which provides user with pictures
rather than just characters to interact with the machine. These OSs display icons, buttons, dialog
boxes, etc., on the screen. The user sends instructions by moving a pointer on the screen (generally
mouse) and selecting certain objects by pressing buttons on the mouse while the mouse pointer is
pointing at them.
M03_ITL-ESL4791_01_SE_C03.indd 49 12/22/2012 4:53:16 PM