What is the priority scheduling:-
As it is clear with the name that this scheduling is based on the priority of the processes. The process which have the higher priority will get the CPU first. whereas jobs with equal priorities are carried out on a round-robin or FCFS basis.
This scheduling is of two types:-
1. Non preemptive
2. Preemptive
characteristics:-
- It schedules the process based on the priority of the processes.
- Lower the number higher the priority.
- If the two or more processes have the same priority then we schedules on the basis of FCFS.
- Major problem with priority scheduling is problem of starvation.
- Solution of the problem of the starvation is aging ,where aging is a technique of gradually increasing the priority of the processes that wait in the system from long time.
- Major problem with priority scheduling is problem of starvation.
- Solution of the problem of the starvation is aging ,where aging is a technique of gradually increasing the priority of the processes that wait in the system from long time.
Code:-
1.After taking the input first we sort the input on the basis of Arrival time (i.e the process which have less Arrival time will come first).
2.Here one more things we will do . we will check that the arrival time of all the processes are different or not. (Example:- if all the processes comes at the same time then we don't need to sort the array on the basis of arrival time ) . for checking this we will use check_ar.
3.After doing this if processes are arrived at the different time then we can easily calculate the waiting and turn around time for the first process. and for other process first we will find the highest priority (less priority number) of the process which are arrived at cmp_time (completion time of the previous process) .
You can easily understand by Following code .
Output:-
Recommended post:-
codechef problems:-
Wipro :-
- Update the booking ID | Wipro previous year question paper solution
- Pages in PDF
- Find the location id
- Find the odd digits
- Find the Product ID
Infytq :-
Key Points;-
Hackerrank:-
- Python : missing characters : hackerrank solution
- Python : string transformation | Hackerrank solution
- Active Traders certification test problem | Hackerrank Solution
- Usernames changes certification test problem | Hackerrank Solution
- string Representation of objects certification test hackerrank solution
- Average Function | hackerrank certification problem solution
C-tutorial:-
- Micros in C
- Pointer in c
- Function declaration
- Types of user define function
- return type of function
- 2D array
- c program to convert specified days into years weeks and days
- Print Reverse Hollow Pyramid
- Update the booking ID | Wipro previous year question paper
- Pages in PDF | Wipro previous year question paper
- Sparse Matrix in data structure
- Find the location ID | Wipro previous year Coding question
- find the odd digits | Wipro Coding question
- Find the product id | Wipro Coding question
- Difference between static and dynamic memory allocation
- What is asymptotic Notation
0 Comments