IMP QUESTION of OS (3330701) : 1 - What Is An Os .?
IMP QUESTION of OS (3330701) : 1 - What Is An Os .?
1 . what is an os .?
An operating system (OS) handles your computer needs by finding resources, applying
hardware management and providing necessary services. Operating systems are essential for
computers to be able to do everything they need to do.
How do operating systems work?
An operating system communicates with the various parts of your computer. It sends
information to and from your computer hardware and the desired application or action in
order to carry out the tasks you request. The following pieces of equipment are in contact with
your operating system:
Keyboard
Monitor
Printer
Mouse
Disk drive
2 Ready
The process is waiting to be assigned to a processor. Ready processes are waiting to have the
processor allocated to them by the operating system so that they can run. Process may come
into this state after Start state or while running it by but interrupted by the scheduler to assign
CPU to some other process.
3 Running
Once the process has been assigned to a processor by the OS scheduler, the process state is set
to running and the processor executes its instructions.
4 Waiting
Process moves into the waiting state if it needs to wait for a resource, such as waiting for user
input, or waiting for a file to become available.
5 Terminated or Exit
Once the process finishes its execution, or it is terminated by the operating system, it is moved
to the terminated state where it waits to be removed from main memory.
5. Explain necessary conditions for deadlocks to occur.
A deadlock situation can arise if and only if the following four conditions hold
simultaneously in a system-
Mutual Exclusion: At least one resource is held in a non-sharable mode that is only one process
at a time can use the resource. If another process requests that resource, the requesting process
must be delayed until the resource has been released.
Hold and Wait:There must exist a process that is holding at least one resource and is waiting to
acquire additional resources that are currently being held by other processes.
No Preemption: Resouces cannot be preempted; that is, a resource can only be released
voluntarily by the process holding it, after the process has completed its task.
Circular Wait: There must exist a set {p0, p1,.....pn} of waiting processes such that p0 is waiting
for a resource which is held by p 1, p1 is waiting for a resource which is held by p 2,..., pn-1 is
waiting for a resource which is held by p n and pn is waiting for a resource which is held by p 0.
6. Explain deadlocks and solution to remove deadlocks.
Eliminate Mutual Exclusion
It is not possible to dis-satisfy the mutual exclusion because some resources, such as the tap
drive and printer, are inherently non-shareable.
Eliminate No Preemption
Preempt resources from the process when resources required by other high priority processes.
It is situation where two or more process are reading / writing some shared data and
final result depends on relative order of their execution ,is called race condition.
A=1000,At the end of two process A should be 1100.but if P0 and P1 permitted to
execute in any arbitrary fashion then output will be not same.
Here two process are reading and writing common variable ‘A’ .The final value depends
on relative execution order of P0 and P1,such situation is called race condition.
This implies that concurrent process are racing with each other to access a shared
resource in arbitrary order and procedure wrong final results ,so race condition must
be avoided.
10. Difference between Logical Address & Physical Address
1 The process address space can be The entire physical memory can be
considered as a sequential list of bytes. considered as a sequential list of
Each byte has an address that is used to bytes. Each byte has an address that
locate it, these addresses are called is used to locate it; these addresses
logical address. are called physical address.
Swapping is a technique in which processes are moved between main memory and disk.
Swapping uses some of the portion of secondary storage (disk) as a backing store; this
area is called swap area.
Operation of moving process from main memory to swap area is swap-out.
Operation of moving processes from swap area to main memory is swap-in.
When a process is brought back to memory, it may be loaded at some different location
rather than its original one. So It needs memory relocation, There is problem of external
fragmentation.
13. Explain memory relocation.