Unit 6 : CPU Scheduling Flashcards
What is a process? ( 2 )
- A program in execution which progresses in a sequential manner
- It is a unit of work with a unique process identification
What does process require?
- Requires resources like memory, CPU time and files to complete the task
When are resources allocated?
- When a process is created or while in execution
Who creates and deletes user and system processes?
- Operating System
What is the state for process and program ( active / passive ) ?
- Process
- Active
- Program in Execution
- Program
- Passive
- Unused when the files isn’t loaded into memory
How does operating system keeps track of processes ?
- Uses Process Table
- Task Manager
- Activity Monitor
List out the steps for process state diagram and the term used ( Graph )
- New - ( admitted ) -> Ready
- Ready - ( Scheduler Dispatcher ) -> Running
Running - ( Interrupt / Time Out ) -> Ready - Running - ( I/O or Event wait ) -> Blocked
- Blocked - ( I/O or Event Completion ) -> Ready
- Running - ( Exit ) -> Terminated
What will be changing when a program executes?
- States
What is the new stated in Process State Diagram?
- A process has just been created
What are the reasons for process creation?
- New batch job
- Interactive Logon
What will happen when the task is created?
- It will changes from New to Ready processing state
What is the ready state in ProcessState Diagram?
- The process is waiting to be assigned to a processor
What is the Ready -> Running State in Process State Diagram
- Instructions are being executed
What is the state that the process is using the CPU?
- Ready -> Running
What are the factors for the number or running processes
- Depend on the number of processors the computer has
What can the running process possibly become ? ( 3 )
- Blocked
- Ready
- Terminated
Why doies the Running process become Blocked ? ( 2 )
- The process itself cannot execute because it is waiting for an I/O operation to complete
- Waiting for some external event to happen
When will Running process moves to the Ready state? ( 3 )
- A process has reached its maximum allowable time for uninterrupted execution
- A process needs a resource that is not immediately available
- A process needs an I/O operation before continuation
What is the term when Blocked state moves to the Ready state?
- When the event which the process was waiting for occurs
When the Running state process moves into the Terminated state?
- The process has completed
- The process has been aborted
What are the reasons for process termination?
- Normal Completion
- Invalid Instruction
- Memory Unavailable
What will returned to the operating system upon termination?
- Control
What is each process presented as in the Operating System?
- Process Control Block
What does Process Control Block do? ( 3 )
- Keeps track of each process
- Contains information associated with a specific process
- Serves as a repository of any information that may vary from process to process
List out all the components from Process Control Block diagram ( 9 )
- Pointer to Parent Process
- Pointer Area to Child Process
- Process State
- Program Counter
- Register Save Area
- Memory Limits
- Priority Information
- Accounting Information
- Pointer to Files and Other I/O Resources
What process state indicates?
- The process state ( ready , running , blocked , terminated )
What does program counter indicates
- The location for the nest instruction
What does CPU scheduling information indicates?
- Process priority, pointers to scheduling queues
What does Accounting Information indicates ?
- Statistics on CPU time, job and process numbers
What does I/O status indicates?
- List of I/O devices which are allocated to processes
What are the processes put on when a processes enter the system?
- Job Queue
What are the processes put on when there is a new process?
- Ready Queue
What will the process do when in process scheduling? ( 2 )
1.Waits until selected for execution ( dispatched )
2. Give CPU resources
What will happen when the CPU is allocated and the process is running? ( 3 )
- The process could issue an I/O request and be placed on a device queue
- The process could create a new sub-process
- The process could be forcibility removed
Simply list out the Process Scheduling Diagram possibilities ( 5 )
- Ready Queue -> CPU -> Finish
- Ready Queue -> CPU -> I/O Request -> I/O Queue -> I/O -> Ready Queue -> CPU -> Finish
- Ready Queue -> CPU -> Time Slice expired -> Ready Queue -> CPU -> Finish
- Ready Queue -> CPU -> Fork a Child -> Child Execute -> Child Terminates -> Ready Queue -> CPU -> Finish
- Ready Queue -> CPU -> Wait for an Interrupt -> Interrupt Occurs -> Ready Queue -> CPU -> Finish
- Wait for an Interrupt means that wait for the interruption to finished
- Child process is like forgetting password when logging in websites
What can concurrent process do?
- Concurrent process can be independent or cooperating processes
What is Indepedent Processes?
- Processes that do not need to interact with other processes
What is Cooperating Processes
- Processes that work with each other, can affect or be affected by another process
Why OS allow for cooperating processes?
- Information sharing and to allow to resources using the PCB
- Increase computation speed
What is Thread?
- A mini lightweight process that can execute independently of other parts of the process
List out the 2 types of thread
- User Processes
- System Processes
What an action is called when a creation of new process ( child ) from the older one ( parent ) ? ( 2 )
- Spawning
- Forking
What does a CPU scheduler is tasked in?
- With choosing which process to run first form the ready queue
What algorithm is used to choose the next process?
- Scheduling Algorithm
What is a fundamental function of an operating system?
- Scheduling
What the scheduling do to ensure what component is not idle?
- CPU
List out the aims of scheduling
- Fairness
- Efficiency
- Response Time
- Turnaround Time
- Throughput
What does fairness avoids?
- Starvation
What does fairness ( Aims of Scheduling ) do to CPU?
- Make sure all processes get a fair share of the CPU time
What does efficiency ( Aims of Scheduling ) do to CPU?
- Maximise CPU utilisation and keep the CPU busy close to 100% of the time
What are the types for response time? ( 2 )
- Consistent response time
- Minimise response time
What does turnaround time ( Aims of Scheduling ) do to CPU? ( 2 )
- Minimise time between submission and job completion
- Minimise output time
What does throughput time ( Aims of Scheduling ) do to CPU? ( 2 )
- Maximise number of job completed within a given time period
What does preemptive scheduling does to CPU? ( 2 )
- Allows for running processes to be temporarily suspended
- Processes releases CPU upon receiving a command
List out the Preemptive Scheduling Algorithms ( 3 )
- Round Robin
- Multilevel Queue
- Multilevel Feedback Queue
What does Non-preemptive scheduling does to CPU?
- Processes release the CPU only after completion
- Processes releases CPU voluntarily
What is the difference between Preemptive scheduling and Non-Preemptive Scheduling?
- Preemptive Scheduling
- Running processes will be temporarily suspended
- Releases CPU when receiving a command
- Non-Preemptive Scheduling
- Process release the CPU only after completion
- Processes releases CPU voluntarily
List out Non-preemptive scheduling algorithms ( 3 )
- First Come First Serve ( FCFS ) of First In First Out ( FIFO )
- Shortest Job First ( SJF )
- Priority
List out the calculation keywords for calculating for preemptive or non-preemptive scheduling ( 6 )
- CPU Utilisation
- Throughput
- Burst Time
- Resonse Time
- Turnaround Time ( Waiting Time + Burst Time )
- Average Turnaround Time
- Average Waiting Time
- Average Waiting Time ( Response Time / Number of Processes )
What is the oldest, simplest, fairest and most widely used preemptive scheduling?
- Round Robin
What should we do first when implementing round robin?
- The ready queue is kept as a first in first out queue
What system is round robin is designed for?
- Time-sharing system
What is defined for each process ? ( Round Robin )
- Time quantum/Time slice
What does the ready queue is treated as in Round Robin?
- Circular Queue
What is the characteristics of round robin?
- Average waiting time is usually long
- Performance depends on the size of the time quantum ( time slice - 10 to 100 ms )
- Process switch requires time, while the time quantum clock is already running
What will happen when Time Quantum ( Time Slice ) is set too long or too short?
- Time quantum ( Time slice ) which is set too short would result in too many process switches and this reduces CPU efficiency
- Time quantum which is too long would cause poor response to short interactive request
What does the ready queue is seprate into in Multilevel Queue?
- Several separate queues
What does multilevel queue classifies processes into ?
- Different groups
Each process is permanently assigned to one queue based on what?
- Priority
- Size
- Process Tyoe
Each queue ( multilevel queue ) would have its own what?
- Scheduling algorithm
What does the time slices can be allocated in multilevel queue?
- Queues
Give an example for highest priority til lowest priority in multilevel queue
- System Processes
- Interactive Processes
- Interactive Editing Processes
- Batch Processes
- Student Processes
What factor does processes are separated by in multilevel feedback queue?
- CPU burst time
- Processes are allowed to move between queues in multilevel feedback queue
What will happen if a process utilises too much CPU time ?
- CPU time will be moved to a lower priority queue
What will happen if a process is starved of CPU time ?
- CPU time will be moved to a higher level priority queue
What is the simplest CPU scheduling algorithm?
- First In First Out ( FIFO )
- The process that request the first program is allocated to the CPU first
What easily managed the implementation of the FIFO policy?
- FIFO queue
What is the disadvantages for FIFO?
- Average waiting time for FIFO is quite long
- Once the CPU has been allocated the process, the process keeps the CPU until termination or by requesting for I/O
What process is done in scheduling in shortest job first ?
- By examining the length of the next CPU burst time
- If the CPU is free, the next process with the smallest next CPU burst is assigned
- If two processes have the same CPU burst, FIFO is used to break the tie
What is the advantage of shortest job first?
- It is optimal by providing the minimum average waiting time
What is the disadvantage of shortest job first?
- Determine the length of the next process
How does CPU is allocated in Priority?
- The job with highest priority
What will be implemented when there is equal priority processes
- Scheduled using FIFO
Can priority be preemptive or non-preemptive?
- Yes
What is the disadvantages of priority?
- Starvation
What is a technique to gradually increase a processes priority?
- Aging
What does process control blocks represents in the OS?
- Represents a process
What is a basic unit of CPU utilisation?
- Thread
What are the aims for scheduling algorithms?
- Aim to achieve fairness, efficiency
- Maximising throughput
- Masimising turnaround time
What does CPU scheduling is used for?
- Is used to select a process from the ready queue and allocate this process CPU time
What scheduling algorithm has a shorter average waiting time?
- Shortest Job First
What are the result and solving methods for priority scheduling?
- Starvation
- Aging is a method used to overcome this