Discuss How The Following Pairs of Scheduling Criteria Conflict in Certain Settings
Discuss How The Following Pairs of Scheduling Criteria Conflict in Certain Settings
Discuss How The Following Pairs of Scheduling Criteria Conflict in Certain Settings
(unit 1)
a. CPU utilization and response time
b. Average turnaround time and maximum waiting time
c. I/O device utilization and CPU utilization
Answer:
• CPU utilization and response time: CPU utilization is increased if the overheads
associated with context switching is minimized. The context switching overheads
could be lowered by performing context switches infrequently. This could however
result in increasing the response time for processes.
• Average turnaround time and maximum waiting time: Average turnaround time
is minimized by executing the shortest tasks first. Such a scheduling policy could
however starve long-running tasks and thereby increase their waiting time.
• I/O device utilization and CPU utilization: CPU utilization is maximized by running
long-running CPU-bound tasks without performing context switches. I/O device
utilization is maximized by scheduling I/O-bound jobs as soon as they become
ready to run, thereby incurring the overheads of context switches.
a) What would be the effect of putting two pointers to the same process in the
ready queue?
b) What would be the major advantages and disadvantages of this scheme
c) How would you modify the basic RR algorithm to achieve the same effect
without the duplicate pointers?
Solution:
a) In effect, that process will have increased its priority since by getting time more
often it is receiveing preferentail treatment.
b) The advantage is that more important jobs could be given more time, in other
words, higher priority in treatment. The consequence, of course, is that shorter
jobs will suffer.
Answer:
The contiguous memory allocation scheme suffers from external fragmentation as
address spaces are allocated contiguously and holes develop as old processes die
and new processes are initiated. It also does not allow processes to share code,
since a process’s virtual memory segment is not broken into noncontiguous fine
grained segments. Pure segmentation also suffers from external fragmentation as
a segment of a process is laid out contiguously in physical memory and
fragmentation would occur as segments of dead processes are replaced by
segments of new processes. Segmentation, however, enables processes to share
code; for instance, two different processes could share a code segment but have
distinct data segments. Pure paging does not suffer from external fragmentation,
but instead suffers from internal fragmentation. Processes are allocated in page
granularity and if a page is not completely utilized, it results in internal
fragmentation and a corresponding wastage of space. Paging also enables
processes to share code at the granularity of pages
5. Why are page sizes always powers of 2? Consider a logical address space of
eight pages of 1024 words each, mapped onto a physical memory of 32 frames.
(unit 2)
->The bytes within a page are addressed using the last N bits of a virtual address,
for some value of N. Since the number of addresses that can be expressed with N
bits is 2N, the page size is a power of 2.
Addressing within a 1024-word page requires 10 bits because 1024 = 2 10. Since
the logical address space consists of 8 = 23 pages, the logical addresses must be
10+3 = 13 bits. Similarly, since there are 32 = 25physical pages, phyiscal addresses
are 5 + 10 = 15 bits long.
P P P P P - - - - - - - - - -
Answer:
(12 * 8 /KB/) + (2048 * 8 /KB) + (2048 * 2048 * 8 /KB/) + (2048 * 2048 * 2048 *
8 /KB) = 64 terabytes
Answer: •
Contiguous—if file is usually accessed sequentially, if file is relatively small.
Linked—if file is large and usually accessed sequentially.
Indexed—if file is large and usually accessed randomly.
8. Given five memory partitions of 100Kb, 500Kb, 200Kb, 300Kb, 600Kb (in order),
how would the first-fit, best-fit, and worst-fit algorithms place
processes of 212 Kb, 417 Kb, 112 Kb, and 426 Kb (in order)? Which algorithm
makes the most efficient use of memory?
First-fit:
212K is put in 500K partition
417K is put in 600K partition
112K is put in 288K partition (new partition 288K = 500K - 212K)
426K must wait
Best-fit:
212K is put in 300K partition
417K is put in 500K partition
112K is put in 200K partition
426K is put in 600K partition
Worst-fit:
212K is put in 600K partition
417K is put in 500K partition
112K is put in 388K partition
426K must wait
1. FCFS
Total seek time
= 10*6 + 12*6 + 2*6 + 18*6+ 38 * 6 + 34*6 + 32*6
= 146*6
= 876 ms
Answer: Remember that the turnaround time is the amount of time that elapses
between the job arriving and the job completing. Since we assume that all jobs
arrive at time 0, the turnaround time will simply be the time that they complete.
(a) Round Robin: The table below gives a break down of which jobs will be
processed during each time quantum. A * indicates that the job completes
during that quantum.