31.What are the various scheduling criteria for CPU scheduling?
The various scheduling criteria are
• CPU utilization
• Throughput
• Turnaround time
• Waiting time
• Response time
32.Define throughput?
Throughput in CPU scheduling is the number of processes that are completed per unit time. For long processes, this rate may be one process per hour; for short transactions, throughput might be 10 processes per second.
33.What is turnaround time?
Turnaround time is the interval from the time of submission to the time of completion of a process. It is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O.
34.Define race condition.
When several process access and manipulate same data concurrently, then the outcome of the execution depends on particular order in which the access takes place is called race condition. To avoid race condition, only one process at a time can manipulate the shared variable.
35.What is critical section problem?
Consider a system consists of 'n' processes. Each process has segment of code called a critical section, in which the process may be changing common variables, updating a table, writing a file. When one process is executing in its critical section, no other process can allowed to execute in its critical section.
36.What are the requirements that a solution to the critical section problem must satisfy?
The three requirements are
• Mutual exclusion
• Progress
• Bounded waiting
37.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
.
38.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;
}
39.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.
The classic definition of 'wait'
wait (S)
{
while (S<=0)
;
S--;
}
The classic definition of 'signal'
signal (S)
{
S++;
}
40.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.
No comments:
Post a Comment