Professional Documents
Culture Documents
3.What is process?
Ans. A process is an active program i.e a program that is under
execution. It is more than the program code as it includes the program
counter, process stack, registers, program code etc. Compared to this,
the program code is only the text section.
A program is not a process by itself as the program is a passive entity,
such as file contents, while the process is an active entity containing
program counter, resources etc.
9.What is Semaphore?
Ans. In computer science, a semaphore is
a variable or abstract data type used to control access to a
common resource by multiple threads and avoid critical
section problems in a concurrent system such as
a multitasking operating system.
11.Define rollback.
Ans. In database technologies, a rollback is an operation which
returns the database to some previous state. Rollbacks are
important for database integrity, because they mean that the
database can be restored to a clean copy even after erroneous
operations are performed.[1] They are crucial for recovering
from database server crashes; by rolling back
any transaction which was active at the time of the crash, the
database is restored to a consistent state.
The rollback feature is usually implemented with a transaction
log, but can also be implemented via multiversion concurrency
control.
Whenever the CPU becomes idle, the operating system must select
one of the processes in the ready queue to be executed. The
selection process is carried out by the short-term scheduler (or CPU
scheduler). The scheduler selects from among the processes in
memory that are ready to execute and allocates the CPU to one of
them.
*The CPU scheduler determines the order and priority in which processes
are executed and allocates CPU time accordingly, based on various criteria
such as CPU utilization, throughput, turnaround time, waiting time, and
response time.
16.Diffrence between Preemptive and non preemptive scheduling.
Ans.
S.No. Preemptive Scheduling Non-Preemptive Scheduling
The CPU scheduling in which the The type of scheduling in which once the resources
resources (CPU Cycle) have been (CPU Cycle) have been allocated to a process, the
1. allocated to a process for a limited process holds it until it completes its burst time or
amount of time is known as preemptive switches to the 'wait' state is known as non-
scheduling. preemptive scheduling.
If a process that has a high priority If a process that has a long burst time is running the
3. arrives frequently in the 'ready' queue, CPU, then the process that has less CPU burst time
the low priority processes may starve. would starve
Examples − Round Robin scheduling, Examples − First Come First Serve and Shortest Job
7. Shortest Remaining Time First First.
scheduling.
Ans.
As Banker’s algorithm using some kind of table like allocation, request, available all
that thing to understand what is the state of the system. Similarly, if you want to
understand the state of the system instead of using those table, actually tables are
very easy to represent and understand it, but then still you could even represent the
same information in the graph. That graph is called Resource Allocation Graph
(RAG).
So, resource allocation graph is explained to us what is the state of the system in
terms of processes and resources. Like how many resources are available, how
many are allocated and what is the request of each process. Everything can be
represented in terms of the diagram. One of the advantages of having a diagram is,
sometimes it is possible to see a deadlock directly by using RAG, but then you might
not be able to know that by looking at the table. But the tables are better if the
system contains lots of process and resource and Graph is better if the system
contains less number of process and resource.
We know that any graph contains vertices and edges. So RAG also contains vertices
and edges. In RAG vertices are two type –
1. Process vertex – Every process will be represented as a process vertex.Generally,
the process will be represented with a circle.
2. Resource vertex – Every resource will be represented as a resource vertex.
a deadlock. T
here are four conditions necessary for the occurrence of a deadlock. They can be
understood with the help of the above illustrated example of staircase:
1. Mutual Exclusion: When two people meet in the landings, they can’t just
walk through because there is space only for one person. This condition
allows only one person (or process) to use the step between them (or the
resource) is the first condition necessary for the occurrence of the
deadlock.
2. Hold and Wait: When the two people refuse to retreat and hold their
ground, it is called holding. This is the next necessary condition for
deadlock.
3. No Preemption: For resolving the deadlock one can simply cancel one of
the processes for other to continue. But the Operating System doesn’t do
so. It allocates the resources to the processors for as much time as is
needed until the task is completed. Hence, there is no temporary
reallocation of the resources. It is the third condition for deadlock.
4. Circular Wait: When the two people refuse to retreat and wait for each
other to retreat so that they can complete their task, it is called circular
wait. It is the last condition for deadlock to occur.