Breaking News

IPU BCA Semester 5 - Operating Systems (Questions and Answers)

Operating System (Q & A)

IPU BCA Semester 5 - Operating Systems (Questions and Answers)

Q1: What is a dead lock? What are the-conditions for a deadlock to occur? How it can be avoided?

Deadlock: When a process requests resources, and if the resources are not available at that time, the process enters a wait state. Waiting processes may never change state. This is because the resources they have requested are already held by other waiting processes. This situation is called a deadlock.

Conditions for A Deadlock to occur:

A deadlock can arise if the following four conditions hold simultaneously in a system:

1. Mutual exclusion: At a particular time, only one process can use the resource. If any other process requests for that resource, it must be delayed until the first resource has been released.

2.Hold and Wait: A process must be holding at least one resource and must be requesting for other resources and must be in waiting state to acquire other resources, which are held by other processes.

3. No preemption: A process can only be released voluntarily, only after the completion of its task.

4. Circular Wait:  P0, P1,.....Pn must be the processes which are waiting for the resources held by their immediate next processes. For instance, P0 is waiting for the resource held by P1. Similarly, P1 waiting for P2's resource and Pn for P0.

Deadlock can be Avoided:

Deadlock avoidance requires the operating system be given additional information in advance, about which resources a process will request and use during its lifetime.  With this, one can decide whether a process should wait or not.

1. Safe State: A state is called safe if operating system can allocate resources to each and every process in some order or sequence, and still can avoid deadlock. Suppose Pi has obtained all of its required resources, it would then complete its tasks, return its allocated resources and then terminates. When Pi terminates, Pi+1  enters, obtain all the resources, completes its designated tasks, return the resources and finally terminates. Same procedure is followed by all the processes in a particular sequence. If no such sequence exists, the system is said to be unsafe.

2. Resource Allocation Graph Algorithm: A process Pi requests a resource Rj. The request can be granted only by converting the request edge Pi -> Rj to an assignment edge Rj -> Pi does not result in the formation of a circle in the resource-algorithm graph. Cycle-detection algorithm can check for the safety. If no cycle exists, then the allocation of resource will leave the system in a safe state. If a cycle is found, then allocation will put the system in an unsafe state. Therefore, the process Pi will have to wait for its requests to be satisfied.

3. Banker's Algorithm : When a new process enters the operating system, it must declare the maximum number of instances of each resource type that it may need. This number may not exceed the total number of resources in the system. When a user requests a set of resources, the system  must determine whether the allocation of these resources will leave the system in a safe state. If it will, the resources are allocated; otherwise, the process must wait until some other process releases enough resources.

Q2: Explain what is FILE ALLOCATION TABLE?

Answer: File Allocation Table is a table that the operating system uses to locate file on the disk. Due to fragmentation, a file may be divided into many sections that are scattered into the disk.  The file system allocation keep the track of these sections. Thus, it is used by the operating system to manage files on hard drives.

Most hard-drives require a process known as seeking which means the actual physical searching and positioning of the read/write head of the drive. The File Allocation table was designed to reduce the amount of seeking and therefore, minimizing the wear and tear on the hard disk.
File Allocation table offers reasonably good performance and robustness, even in very lightweight implementation.
It is a convenient way to share data among operating systems and is commonly used on hard disks.

Q3: Write a short note on Program and System Threats.


Program Threats
When a user makes a process perform maliciously, it is known as Program Threats. Some popular Program threats are:

Trojan Horse: These programs stores the users login in credentials and send this information to the malicious programmers who further access the system and use different resources.

Trap Door: When a program has a hole or a fault in it, and does not work according to what it was supposed to do and performs some illegal action, is called to have a trap door
Logic Bomb: It is harder to detect as it misbehaves only in certain conditions. Mostly it works genuinely.

Virus: Virus, is nothing but a small code which gets embedded in a program, and starts replicating itself (as per the name suggests) on the system. These are highly dangerous and can modify or even delete files, which may crash the system.

System Threats

System threats create such an environment that operating system resources/user files are misused, thereby troubling the users. Some popular System threats are:

Worm:  Worms are the processes which can choke down the system performance and can even shut down an entire network, by using system resources excessively to extreme levels. It replicates each copy of the process and prevents all other processes to use the required resources.

Port Scanning : A hacker uses this mechanism to detect where a system is more vulnerable or more prone to get attacked.

Denial Of Service: It prevents users to use the system legitimately. A user may not be able to use internet services if the denial of browser's content has occurred.