Job scheduling. Queue discipline. Scheduling. • Modern computers have many processes/threads that want to run concurrently The scheduler is the manager of the CPU resource • It makes allocation decisions – it chooses to run certain processes over others from the ready queue
• Modern computers have many processes/threads that want to run concurrently
• It makes allocation decisions – it chooses to runcertain processes over others from the readyqueue
– Zero threads: just loop in the idle loop
– One thread: just execute that thread
– More than one thread: now the scheduler has to make aresource allocation decision
• The scheduling algorithm determines how jobsare scheduled
• In general, the scheduler runs:
– when a process switches from running to waiting
– when a process is created or terminated
– when an interrupt occurs
• In a non-preemptive system, the scheduler waits for arunning process to explicitly block, terminate or yield
• In a preemptive system, the scheduler can interrupt aprocess that is running.
i) Non-Preemptive -- Once CPU given to the job, it cannot be preempted until it completes its CPU burst.
ii) Preemptive -- If a new job arrives with CPU burst length shorter than remaining time of the current executing job -- preempt. (Shortest remaining time first or SRPT)
– It is run for the quantum or until it finishes
– RR allocates the CPU uniformly (fairly) across all participants.
Queues A, B, C...
credits = credits/2 + priority