Notes: + Starting a Process: 1. Creating it from scratch. 2. Or, try forking, where you copy the data structures of another process. This creates the same process twice, which isn't always desireable. 3. VFORK- Doesn't copy the original process before overlaying the new one. Saves a copy + CPU Scheduling: 1.OS makes two decisions about resources: ->Allocation: Who gets what efficiently. ->Scheduling: Providing pre-empitlbe resources like CPU and memory. When resources run low, in what order the procs are serviced. 2. Scheduling flow: submit->hold->ready->run run can either wait and loop back to ready or go to done. In reality, there is a hold, runnable, in memory and wait queue. 3. Important parts of scheduling: ->Job: The unit of scheduling, it is computation associated with a single submission. ->Jobs and processes are the same thing ->Hold Queue: Holds jobs until system is prepared to give services. ->Runnable Queue: Procs considered for scheduling, but not in memory ->Memory Queue: Procs in memory. Scheduling is cheaper. ->Job scheduler, Dispatcher: Keeps track of job status, chooses which jobs are run. Allocates/deallocates memory. 4. Job scheduler determines which jobs go in which queue. Dispatcher decides which one runs in memory. 5. What do we want from the scheduler?? -> Prioritize jobs that run faster. -> Minimize time from arrival to departure. -> Keep CPU and disks busy (efficiency of resource utilization) -> Minimize overhead -> Minimize response time -> Maximize throughput -> Reserve some part of machine for specific tasks/groups -> Minmize number of waiting processes -> Get short jobs through quickly -> Avoid starvation (A process that will never get done) -> Minimize variance of response time -> Satisfy external constraints -> Meet deadlines -> Graceful degradation under overload -> No "fairness" like round robin of FIFO 6. Real goal: Maximize user satisfaction, minimize complaints. 7. Typically optimization centers around: -> Minimizing flow time -> Minimizing variance of flow_time/service_time ->service time is time taken by CPU to complete some instructions 8. Typical External Constraints: -> Fixed priority -> Fixed fraction of machine -> Real time constraints (like missile defence... you only have a little bit of time before the missile hits.) 9. Open vs. Closed Systems -> Open System: Arrival rate of customers unaffected by number in system. -> Closed System: Total number of customers are constant. More quickly they come, less that arrive. 10. Throughput-Number of jobs/sec -> Is constant w.r.t scheduling algorithm for open system (but only if rho is less than one) -> Is variable for a closed system 11. The longer a request should take, the longer the user is willing to wait. Users like predictability. User at a terminal is very impatient. 12. Simplest scheduling algorithm: First in First out. This means uniprogramming. ->Lowest variance of overall wait time -> Problem: One process can monopolize the CPU. Minimal resources sharing, short jobs wait for long jobs. 13. Job characteristics: -> Highly skewed. Most are really short, some are really long. -> Expected time for job to run is an increasing function of the time it has already run. (If its been running for a while you expect it to keep running a lot longer) -> Expected time for next I/), page fault or job completion is: the integral from t to infinity of (x-t)r(x)/(1-R(t)) w.r.t x. where r(t) is the runtime distribution and R(t) is its CDF. -> Solution: Time slice: This means each job has a max operation time