Showing posts with label PROCESS SCHEDULING AND SYNCHRONIZATION. Show all posts
Showing posts with label PROCESS SCHEDULING AND SYNCHRONIZATION. Show all posts

Saturday, December 12, 2015

deadlock



1.Define entry section and exit section.

The critical section problem is to design a protocol that the processes can use to cooperate. Each process must request permission to enter its critical section. The section of the code implementing this request is the entry section. The critical section is followed by an exit section. The remaining code is the remainder section.

2.Give two hardware instructions and their definitions which can be used for implementing mutual exclusion.

• TestAndSet
boolean TestAndSet (boolean &target)
{

boolean rv = target; target = true; return rv;
}
• Swap
void Swap (boolean &a, boolean &b)
{

boolean temp = a; a = b;

b = temp;
}

3.What is semaphores?

A semaphore 'S' is a synchronization tool which is an integer value that, apart from initialization, is accessed only through two standard atomic operations; wait and signal.Semaphores can be used to deal with the n-process critical section problem. It can be also used to solve various Synchronization problems.

4.Define busy waiting and spinlock.

When a process is in its critical section, any other process that tries to enter its critical section must loop continuously in the entry code. This is called as busy waiting and this type of semaphore is also called a spinlock,because the process while waiting for the lock.

5.Define deadlock.

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

Friday, December 11, 2015

PROCESS SCHEDULING AND SYNCHRONIZATION



1.Define CPU scheduling.

CPU scheduling is the process of switching the CPU among various processes. CPU scheduling is the basis of multiprogrammed operating systems. By switching the CPU among processes, the operating system can make the computer more productive.

2.What is preemptive and nonpreemptive scheduling?

Under nonpreemptive scheduling once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or switching to the waiting state. Preemptive scheduling can preempt a process which is utilizing the CPU in between its execution and give the CPU to another process.

3.What is a Dispatcher?

The dispatcher is the module that gives control of the CPU to the process selected by the short-term scheduler. This function involves:

  Switching context
  Switching to user mode
  Jumping to the proper location in the user program to restart that program.

4.What is dispatch latency?

The time taken by the dispatcher to stop one process and start another running is known as

dispatch latency.

5.What are the various scheduling criteria for CPU scheduling?

The various scheduling criteria are
  CPU utilization
  Throughput
  Turnaround time
  Waiting time
  Response time