OS - scheduling Flashcards
what does the scheduler determine?
- Who will run*
- When it will run*
- For how long*
Regarding scheduling; what does “fairness” refer to?
Comparable processes should get comparable service.
Regarding scheduling; what does “efficiency” refer to?
keep CPU and I/O device busy
Regarding scheduling; what does “response time” refer to?
Response time is the total amount of time it takes to respond to a request for service. That service can be anything from a memory fetch, to a disk IO, to a complex database query, or loading a full web page. Ignoring transmission time for a moment, the response time is the sum of the service time and wait time.
Regarding scheduling; what does “turnaround time” refer to?
Average time required for a job to complete, from submission time to completion.
Regarding scheduling; what does “waiting time” refer to?
minimize the average time in ready queue over processes
Regarding scheduling; what does “Throughput” refer to?
number of completed jobs per time unit.
Why is there a conflict between response time and turnaround time?
The process’ state changes to “running”, for the first time, quite fast. it takes a lot of time for it to finish its job though.
Why is there a conflict between Fairness and Throughput?
- process 1: size x*
- process 2: size x*
- process 3: size 200x*
- according to fairness - process 3 should get 100 times more CPU time than process 1 and 2. According to Throughput: we can have process 1 and 2 completed much faster if we gave them more CPU.*
What is an “interactive computing”
This term refers to software which accepts input from the users as it runs. Non-interactive programs, by comparison, operate without user intervention; compilers and batch processing applications that are pre-programmed to run independently
What is a script?
A programming language for a special run-time environment(terminal) that automates the execution of tasks. the tasks could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted(rather than compiled)
What is a batch file?
A script file which consists of a series of commands to be executed by the command-line interpreter, stored in a plain text file.
Provide an example of CPU utilization vs turnaround time conflict
- 5 interactive jobs: 10% CPU, 20% Disk, 70% terminal; total time for each job 10 sec.
- Batch job b: 90% CPU, 10% disk. total time 50 sec.
Option A:
- Choose batch job and one of the interactive jobs to work in parallel:
- CPU 100% utilized and Disk 30% utillized.
Option B:
- Choose 5 interactive jobs to work in parallel:
- Disk 100% utilized and CPU just 50% utilized but more jobs finish their work in less time.
- 5 jobs i1…i5,* each takes: 10% CPU 20% Disk, and 10 sec to complete.
- One job b takes 90% CPU 10% Disk and 50 sec to complete.*
- case 1: running i1..i5 in parallel and then b.
- case 2: running b and each of i’s(in turn) in parallel.
What is the CPU utilization and Turnaround time for case 1 and 2?
Case 1:
- UT=(10*0.5+50*0.9)/60
- TA=(10*5+60*1)/6
Case 2:
- UT=(50*(0.9+0.1))/50
- TA=(10+20+30+40+50+50)/6
what’s the difference between preemptive SJF(Shortest job First) and non-preemptive SJF?
if all processes arrive at the same time both behave the same. if not, Non-preemptive chooses the shortest job within the existing process and it doesn’t change its decision even if a shorter job process has arrived. in contrast, preemptive SJF will switch jobs if a shorter jobs has arrived.
What is the Round Robin method?
Each process gets a small unit of CPU time(time -quantum), usually 10-100 milliseconds.
how much is a millisecond?
1/1000 second
why does Round-Robin approaches FCFS(First-come-first-served) as the time quantum grows?
because if the time quantum is quite big, the process would finish their jobs before they are ask to(due to termination, I/O, or voluntarily).
If the time quantum is about the time it takes for switching then …?
we’ll have relatively a large waste of CPU time(50%) but a good response time
If time quantum is much longer than the time it takes for switching then …?
we’ll have long response(waiting) time but better CPU utilization
Assume context switch takes 5 ms. compute the time wasted on switching for 100 ms quantum time?
overall time: context switch + quantum time = 5 + 100. switch/overall = 5/105 = 1/21 -> less than 5% which is a quite good ratio
what is the guaranteed scheduling?
Scheduling that guarantees fairness by monitoring the amount of CPU time spent by each user and allocating resources accordingly.
What is the main drawback of priority scheduling? how can we avoid that?
starvation. Can be avoided by changing priorities dynamically: increase priorities of waiting processes at each clock tick.
- What is I/O bound process?*
- What is CPU bound process?*
A process who’s completion time is determined principally by:
- The period spent waiting for I/O
- The speed of the CPU