-
Notifications
You must be signed in to change notification settings - Fork 0
/
PQ_entry.h
29 lines (26 loc) · 804 Bytes
/
PQ_entry.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef PQ_ENTRY_INCLUDE
#define PQ_ENTRY_INCLUDE
// initial() places process with id p on the queue
/*
void initial(int P)
{
processtype process;
process.id = P;
process.priority = -currenttime();
INSERT(process,WAITING_QUEUE);
}
// select allocates a time slice to process with highest priority
void select()
{
int begintime, endtime;
processtype process;
process = DELETEMIN(WAITING_QUEUE);
// RETURNS a pointer to the deleted element
begintime = currenttime();
execute(process.id);
endtime = currenttime();
process.priority = process.priority+100*(endtime-begintime); // adjust priority to incorporate amount of time used.
INSERT(process,WAITING_QUEUE); //put selected process back on queue with new priority
}
*/
#endif // PQ_ENTRY_INCLUDE