Posted 04 Mar 2011 22:43
Related concepts of real-time operating system (1) Basic concepts of critical sections of code: the code refers to an integral treatment. Once started this part of the code is not allowed to break into; resources: the task occupied by any entity; shared resource: the task can be more than one use of resources; tasks: also known as a thread, is a simple procedure. Each task is assigned a certain priority, has its own set of CPU registers and its own stack space. Typically, each task is an infinite loop, each task in the following five states: dormant, ready state, running state, suspend state, the interrupted state; task switching: the task is running current state (CPU registers all the content) stored in the task of its own stack area, then the next task will be to run the task from the current state of the stack into the CPU to re-register, and start the next task to run; kernel: responsible for managing the various tasks assigned to each task CPU time, and is responsible for communication between tasks. Divided into type inalienable preemptive kernel in the kernel; scheduling: the main function of the kernel to decide which task to run turn. General priority-based scheduling method; (2) the issue on priority task priority: the priority is not changed into static priority and priority can change the dynamic priority; priority inversion: Priority inversion problem real-time system in the most problems. The allocation of shared resources can lead to low priority tasks run first, high-priority task to run. The solution is to use priority inheritance algorithm to temporarily change the task priority, in order to curb the priority inversion. (3) Although the shared data area exclusive simplify the exchange of information between tasks, but must ensure that each task in dealing with shared data shared exclusivity. So as to meet the general methods are mutually exclusive conditions: disable interrupts, the use of test and set instruction (TAS), banned from task switching, using semaphores. Because the significance of real-time operating system is able to deal with unexpected events in a timely manner, dealing with all kinds of disruption, which measure the major embedded operating system, the most representative performance parameters of doubt should be interrupt response time the. Interrupt response time is usually defined as: interrupt latency interrupt response time = time + time + save CPU state into the function of the **** of the ISR execution time . Interrupt delay time = MAX (the maximum time off interrupted, the longest instruction time) + begin time of the first instruction ISR .