<< Chapter < Page | Chapter >> Page > |
The process address space, structures used for interprocess communication, files, and I/O resources are associated with theentire process. Each thread gets its own execution state, context (registers), stack, and local variables.
Spatial locality occurs when the array a is accessed sequentially.
Temporal locality occurs when i is used repeatedly with the same value in the second loop.
Cost = Cm x 8 x 220 = $83.89
Cost = Cc x 8 x 220 = $838.86
1.1 x Tc = Tc + (1 - H)Tm110 = 100 + (1 - H) x 12001200 x H = 1190H = 1190/1200 = 99.2%
There are three cases to consider:
Location of Word | Probability | Total Time for Access (ns) |
In cache | 0.9 | 20 |
Not in cache, but in main memory | (0.1)(0.6) = 0.06 | 60 + 20 = 80 |
Not in cache or main memory | (0.1)(0.4) = 0.04 | 12ms + 60 + 20 = 12,000,080 |
So the average access time would be:
Avg = (0.9)(20) + (0.06)(80) + (0.04)(12000080) = 480,026 ns
Compute these quantities for one, two, and four simultaneous jobs, assuming that the period T is distributed in each of thefollowing ways:
When there is one job, it can do I/O or run on the processor whenever it wants. So the quantities are:
When there are two jobs, one starts right away and does I/O. When it switches to run on the CPU, the second can start its I/O. Thisdelays the second job for 1/2*N, but otherwise they alternate between I/O and CPU. Assume the jobs are long, so the extra 1/2 a cycle is insignificant.Then:
When there are 4 jobs, the CPU is round-robin among the four, as is the I/O. This means the jobs are interleaved as:
Job1: I/O CPU I/O CPU
Job2: I/O CPU I/O CPU
Job3: I/O CPU I/O CPU
Job4: I/O CPU I/O CPU
A job can execute for one cycle T, then it must wait for T before doing another cycle. Again assume the jobs are long so that anyinitial wait is insignificant. Then:
The answers for this part are the same as the first. This is easy to see for the case of 1 job and 2 jobs. When there are 4 jobs, theCPU is round-robin among the four, as is the I/O. This means the jobs are interleaved as:
Job1: I CP O I CP O
Job2: I CP O I CP O
Job3: I CP O I CP O
Job4: I CP O I CP O
The algorithm favors I/O bound processes because these will be much less likely to have used the processor recently. As soon asthey are done with an I/O burst, they will get to execute on the processor.
This algorithm does not permanently deny processor time to processor-bound programs, because once they have been prevented fromusing the processor for some time they will be favored by the scheduling algorithm.
Notification Switch
Would you like to follow the 'Operating systems' conversation and receive update notifications?