Uploaded by bg

cpu scheduling answers

advertisement
Question: Analyze how we can optimize overall execution of processes in single CPU system and
multiprocessor system.
Answer:
A process is defined as an entity which represents the basic unit of work to be implemented in
the system. Almost all processes have some alternating cycle of CPU (CPU Burst) and waiting
for I/O (I/O Burst) of some kind. In a simple system running a single process, when process is
doing some I/O operation, the CPU remains idle. Hence the concept of multiprogramming is
used by most of the OS although having single CPU in the system where multiple processes
are loaded in the memory at once and a scheduling algorithms allow one process to use the
CPU while another is waiting for I/O, thereby making full use of CPU cycles. Also many
systems use the concept of multithreading to have better performance. Hence, the overall
execution of these processes can be optimized by choosing best scheduling algorithm so that
overall CPU utilization and throughput will be maximized and response time, turnaround time
and waiting time will be minimized.
In multiprocessor system, we can use the worker dispatcher model to optimize the overall
execution of process where one processor is used as a dispatcher and dispatches the processes
among several processors known as worker processors and hence multiple processes can be
executed at several processors at once.
Also we can split a process into several small processes and each of these sub processes can
be assigned to different processors to execute and intra parallelism can be achieved and overall
execution of processes can be optimized. This technique can be used in both system (having a
single CPU or multiple CPUs).
Question: What are the different CPU scheduling techniques? Discuss the scenarios for each
technique where the particular scheduling approach is useful and non-useful.
Answer:
The scheduling techniques mainly fall into two categories: Preemptive and Non Preemptive
according to the processor allocation. In Nonpreemptive, the processor once allocated to a process
remains with the same process until its completion. Whereas in Preemptive, the processor although
given to a process can be taken away and given to any other process although the execution of
former process has not be completed.
The scheduling techniques mostly used in Batch systems are: First Come First Serve (FCFS),
Shortest Job First (SJF) and Shortest Remaining Time Next (SRTN). These techniques is mostly
used when the system has to handle lots of similar processes at once and we need higher throughput
and minimized waiting and turnaround time and maximum CPU utilization.
The scheduling techniques mostly used in Time Sharing Interative system are: Round Robin,
Priority, and Multiple Queue. These techniques are mostly used when we need better response
time and need to maintain proportionality that will meet the users’ expectations.
There are multiple scheduling techniques which are applicable to Real time system. These
techniques are used where we need to meet the deadline and avoid quality degradation like in
multimedia.
Download