ucosiii system concepts

Time slice concept:

I.e. CPU time slice allocated to each program time, each thread is assigned a period of time, called its time slice, the time that is allowed to run the process, the surface of the respective program are carried out simultaneously. If the process is still running at the end of the time slice, the CPU will be deprived and assigned to another process. If the process before the end of the time slice blocked or ended, the CPU immediately switches. Without causing the CPU resources. At the macro: We can open multiple applications, each program go hand in hand while running. But microscopically: since the CPU is only one, part of the program can only process required, how to deal with fairness, is to introduce a method of time slices, each program executed in turn.
----------------
Disclaimer: This article is the original article CSDN bloggers "Catullus", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/u014647208/java/article/details/80529187

 

Idle task and blocking delay:

RTOS delay in the call blocking delay, that task requires a delay when the task will give up the right to use the CPU, the CPU can shop and go to other things, when the task delay time to reacquire the right to use the CPU, the task continues to run , so that full use of the CPU resources, rather than waiting to dry.

When the task requires a delay, to enter the blocked state, that CPU went to do things? If there are no other tasks can run, RTOS creates a task for the idle CPU, this time the CPU is running idle task.

The priority of the idle task is the lowest, mainly to do some clean-up system memory. The system is idle task scheduler in the [boot] when created, rather than the beginning of the main function, and function to create a task together, should pay more attention to this point.

 

Timestamp:

Time measurement function, know the running time of a section of code, you obviously know the efficiency of the code, if too long can be adjusted to optimize the code or policy. You can code segment A record a point in time before running TimeStart , in code segment A run to completion record a point in time TimeEnd , then what the code segment A running time of TimeUse equals TimeEnd minus TimeStart . There's two time points

TimeEnd and TimeStart , called a time stamp, the time stamp is actually a point in time.


Critical section:

Access to each process in the critical resource is that part of a program called the critical region ( critical resource is allowed only once a process is using shared resources). Every time a process is only allowed to enter the critical section , after entering not allow other processes to enter.

Scheduling process enters a critical section principle is:
① If there are several processes required to enter the critical region free, once only allowed to enter a process. ② any time in the process of not more than one critical area. As the process has entered its critical section, all other attempts to enter the critical section of the process must wait. ③ into the process critical section to quit within a limited time, so that other processes can promptly enter their critical section. ④ If the process can not access their critical section, you should give up the CPU , the process to avoid a "busy wait" phenomenon.

 

Guess you like

Origin www.cnblogs.com/xwtstudio/p/12609892.html