2) Multiprocessing Flashcards
Define the term “Program”.
A program is a set of instructions which are executed in order by a processor.
What is a multiprocessing system?
A system which allows multiple processes to be processed concurrently.
What are the 5 problems which are cause by concurrency?
-> Switching from one activity to the other
-> Protection of one activity from the effects of another
-> Synchronising activities which are mutually dependant
-> Control over shared resources
-> Communication between 2 activities
What are the types of Scheduling of programs?
-> Preemptive ~ The process which is currently processed can be interrupted for another process to start processing.
-> Non-Preemptive ~ Once a process is processing, it keeps on running.
-> Fixed ~ Fixed parameters are assigned to the schedule before the processes start running.
-> Dynamic ~ Parameters can be modified during the processing
-> Real Time ~ The schedule must contain the time constraint of the real time system.
What does Scheduling of programs involve?
Timing of when programs need to be added, deleted or have their processing stop.
Define a Critical Region (CR)
Critical Region is when the shared resources are being manipulated or accessed by multiple processes at a time. This is where the resources is given to 1 process for a certain amount of time, and to the other process for a certain amount of time.
What is a Semaphore?
A Semaphore is a variable with a value that indicated the status of a common resource. It is used to lock the resource from being used. Before a resource is taken by the processor, its semaphore is checked to see whether the resource can be taken or not.
What scheduling algorithms does the CPU allow?
First Come First Served (FCFS) - Uses a simple FIFO algorithm
Shortest Job First - Shortest processes are executed first
Priority Scheduling - Every process is assigned a priority, and the processes with the highest priority are ruined first. Processes with the same priority are run in a FCFS manner.
(NOTE about Priority Scheduling: Starvation is the idea of the lowest priority processes waiting indefinitely for them be run, to avoid this, it must use the aging method, this is were by time, the priority of a process keeps increasing.)
Round Robin - The processes are assigned a specific amount of time for them to run, once that time has passed, the process that would be running will be preempted and the next program will start / continue its execution.
Multi-level Scheduling - This type of scheduling contains a multi-level of processes with each level to have a unique scheduling method.
Define a deadlock and how can it happen?
A deadlock is when a process is waiting for an event which will never happen.
A deadlock can occur when multiple processes compete for resources or the resources are waiting for each other to be done with certain actions.
Define the circular wait
Condition which can cause a deadlock, this is when a process holds a resource which is required by the next process in the chain.
State and define the 3 strategies to handling a deadlock
Deadlock Prevention - This technique makes sure that the processes once have started running, will surely not encounter a deadlock.
Deadlock Avoidance - This is a technique which tried to avoidant meeting deadlocks although it is still possible. If a deadlock is seen to occur if a step is made, that step would be avoided.
Deadlock Detection - This is a technique of which detects any signs of a circular wait. But does not limit resources or apply restriction to processes like the other 2 strategies.
5 Recovery Stratigies of a deadlock
1) Abort all deadlocked processes
2) Abort the deadlock processes one by one until no deadlocks are left.
3) Preempt resources until the deadlock no longer remains
4) Using selection criteria
5) Back-up a deadlock to a previous checkpoint and restart the processes.