-
Time slice rotation scheduling is one of the oldest, simplest, fairest, and most widely used algorithms.
Each process is assigned a period of time, called its time slice, which is the amount of time the process is allowed to run. If the process is still running at the end of the time slice, the CPU is stripped and allocated to another process. If the process blocks or ends before the end of the time slice, the CPU switches immediately.
All the scheduler has to do is maintain a list of ready processes, and when the process runs out of its time slice, it is moved to the end of the queue.
Let's put it this way, if the CPU is compared to a game console, now A, B, and C all want to play, how to allocate it, the time slice rotation scheduling is to allocate the game console, first let A play for three minutes, then let B play for three minutes, then let C play for three minutes, and then let A play for three minutes, and so on.
-
Aren't the explanations in the links you gave detailed enough?
-
Fourth, algorithm implementation.
1) When the system is initialized, each process is assigned a needtime, and all processes are queued in order from needtime to large.
2) Take the queue head process and put it into operation.
3) Adopt a relatively fixed time piece, and the CPU time occupied by the process is added to the time piece each time the old process is executed.
4) If the process does not finish, the process needs time minus time and is placed at the end of the ready queue.
5) If there are still processes in the queue, then go to 2).
PCB structure: n number of processes.
name The name of the process.
time piece Process precedence The process rotates the time slice.
CPU time used by the CPU Time process.
need time The amount of time it takes to complete the process.
count counter.
state process state (p,w,f).
arrive time.
next chain pointer.
run pointer to the currently running process.
Start is ready to queue the trace silver-head pointer.
end ready queue tail pointer.
finish the queue header pointer.
void insert(pcb *p) time slice insert function.
void create() The time slice algorithm creates a process function.
void roundrobin() is a time-slice arithmetic function.
void firstin() runs the first process of the ready queue.
-
In the early time slice rotation method, the system queued all ready processes on a first-come, first-served basis, and assigned the CPU to the queue leader process each time it was scheduled, and made it execute a time slice. The time slice is staring at the small from a few ms to hundreds of msWhen the time slice of the Raid Bi Absolute Line runs out, a timer is used.
A clock interrupt request is made, and the scheduler uses this signal to stop the execution of the process and send it to the end of the ready queue; The processor is then assigned to the new queue leader process in the pose queue, and it is also allowed to execute a time slice. This ensures that all processes in the ready queue get a time-slice processor execution time for a given amount of time.
This is an out-of-sync issue between threads.
You add an afxmessagebox, which is equivalent to adding a waiting time, and in the process of waiting, the system processes the ondatachange message and runs the ondatachange() function. >>>More
It depends on the frequency of use, and for whether it is expected to drive, if the frequency of use is too long or very high, then in about half a month, or half a year, it is necessary to replace a wiper blade. >>>More
Dear, that address was swallowed when it was sent out, I hi you.
Can't drink it. Lemons are very rich in vitamin C, but vitamin C is indeed easily oxidized, so it will oxidize and turn black if left for a period of time. >>>More
Brake pads are not fixed how often to change the statement, it depends on the driving road conditions and driving habits, these habits will affect the use of brake pads, if you can grasp it well, you will find that many times there is no need to step on the brakes, a pair of brake pads are used well, can reach 100,000 kilometers. >>>More