Operating System
Operating System
resources such as memory, monitor, keyboard, printer etc. Management of these resources is
required for an effective utilization.The operating system controls the various system input-
1 . what is an os .?
output resources and allocates them to the users or programs as per their requirement.
An operating system (OS) handles your computer needs by finding resources, applying
Consistent user interface: Operating System provides the user an easy-to-work user interface,
hardware management and providing necessary services. Operating systems are essential for
so the user doesn’t have to learn a different UI every time and can focus on the content and be
computers to be able to do everything they need to do.
productive as quickly as possible. Operating System provides templates, UI components to make
How do operating systems work?
the working of a computer, really easy for the user.
An operating system communicates with the various parts of your computer. It sends
Multitasking: Operating System manages memory and allow multiple programs to run in their
information to and from your computer hardware and the desired application or action in
own space and even communicate with each other through shared memory. Multitasking gives
order to carry out the tasks you request. The following pieces of equipment are in contact with
users a good experience as they can perform several tasks on a computer at a time.
your operating system:
Keyboard
4. Explain process life cycle
Monitor
Printer 1 Start
Mouse This is the initial state when a process is first started/created.
Disk drive
2 Ready
The process is waiting to be assigned to a processor. Ready processes are waiting to have the
5. Explain necessary conditions for deadlocks to occur.
2. Explain services of OS.
processor allocated to them by the operating system so that they can run. Process may come A deadlock situation can arise if and only if the following four conditions hold
User Interface
into this state after Start state or while running it by but interrupted by the scheduler to assign simultaneously in a system-
Program Execution
CPU to some other process.
File system manipulation Mutual Exclusion: At least one resource is held in a non-sharable mode that is only one process
Input / Output Operations at a time can use the resource. If another process requests that resource, the requesting process
3 Running
Communication must be delayed until the resource has been released.
Once the process has been assigned to a processor by the OS scheduler, the process state is set
Resource Allocation Hold and Wait:There must exist a process that is holding at least one resource and is waiting to
to running and the processor executes its instructions.
Error Detection acquire additional resources that are currently being held by other processes.
Accounting 4 Waiting
No Preemption: Resouces cannot be preempted; that is, a resource can only be released
Security and protection Process moves into the waiting state if it needs to wait for a resource, such as waiting for user
voluntarily by the process holding it, after the process has completed its task.
input, or waiting for a file to become available.
3. Explain the need of Operating System. Circular Wait: There must exist a set {p0, p1,.....pn} of waiting processes such that p0 is waiting
OS as a platform for Application programs: Operating system provides a platform, on 5 Terminated or Exit for a resource which is held by p 1, p1 is waiting for a resource which is held by p 2,..., pn-1 is
top of which, other programs, called application programs can run. These application Once the process finishes its execution, or it is terminated by the operating system, it is moved waiting for a resource which is held by p n and pn is waiting for a resource which is held by p 0.
programs help the users to perform a specific task easily. It acts as an interface between the to the terminated state where it waits to be removed from main memory.
computer and the user. It is designed in such a manner that it operates, controls and executes
various applications on the computer.
6. Explain deadlocks and solution to remove deadlocks. 9. Explain Race condition / Racing problem.
Eliminate Mutual Exclusion
It is not possible to dis-satisfy the mutual exclusion because some resources, such as the tap It is situation where two or more process are reading / writing some shared data and
drive and printer, are inherently non-shareable. 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
Eliminate Hold and wait execute in any arbitrary fashion then output will be not same.
Allocate all required resources to the process before the start of its execution, this way hold and
wait condition is eliminated but it will lead to low device utilization. for example, if a process
requires printer at a later time and we have allocated printer before the start of its execution
printer will remain blocked till it has completed its execution.
The process will make a new request for resources after releasing the current set of resources.
This solution may lead to starvation.
Eliminate No Preemption
Preempt resources from the process when resources required by other high priority processes.
10. Difference between Logical Address & Physical Address 13. Explain memory relocation.