zoukankan      html  css  js  c++  java
  • OSEK OS Resource management

    qThe resource management is used to co-ordinate concurrent accesses of several tasks with different priorities to shared resources

    ve.g.management entities (scheduler), program sequences, memory or hardware areas.

    vThe resource management can optionally be extended to co-ordinate concurrent accesses of tasks and interrupt service routines.

    qResource management ensures that

    vtwo tasks cannot occupy the same resource at the same time.

    vpriority inversion cannot occur.

    vdeadlocks do not occur by use of these resources.

    vaccess to resources never results in a waiting state.

    qIf the user requires protection against interruptions not only caused by tasks, but also caused by interrupts, he/she can also use the operating system services to enable/disable interrupts which do not cause rescheduling.

    qRestrictions when using resources

    vTerminateTask,ChainTask,Schedule,WaitEvent shall not be called while a resource is occupied.

    vInterrupt service routine shall not be completed with a resource occupied.

    qScheduler as a resource

    vIf a task shall protect itself against preemptions by other tasks, it can lock the scheduler.

    vThe scheduler is treated like a resource which is accessible to all tasks.

     优先级反转(低优先级的任务T4占有信号量S1,导致最高优先级的任务T1不能使用S1而进入等待状态,而此时比T1优先级低的任务T2,T3得以运行)

     死锁(任务T1占用信号量S1,等待S2;任务T2占用信号量S2,等待S1

    qOSEK Priority Ceiling Protocol(优先级天花板协议优先级最高协议)

    vTo avoid the problems of priority inversion and deadlocks:

    §At the system generation, to each resource its own ceiling priority is statically assigned.

     üThe ceiling priority shall be set at least to the highest priority of all tasks that access a resource or any of the resources linked to this resource.

    üThe ceiling priority shall be lower than the lowest priority of all tasks that do not access the resource, and which have priorities higher than the highest priority of all tasks that access the resource.

    §If a task requires a resource, and its current priority is lower than the ceiling priority of the resource, the priority of the task is raised to the ceiling priority of the resource.

    §If the task releases the resource, the priority of this task is reset to the priority which was dynamically assigned before requiring that resource.

     

     

    qInternal Resources

    vInternal resources are resources which are not visible to the user and therefore can not be addressed by the system functions GetResource and ReleaseResource.

    §managed strictly internally within a clearly defined set of system functions.

    §the behaviour of internal resources is exactly the same as standard resources (priority ceiling protocol etc.).

    vInternal resources are restricted to tasks.

     §Atmost one internal resource can be assigned to a task during system generation. vIf an internal resource is assigned to a task, the internal resource is managed asfollows:

    §The resource is automatically taken when the task entersthe running state,except when it has already taken the resource.

    üAs a result, the priority of the task is automatically changed to the ceiling priority of the resource.

    §At the points of rescheduling, the resource is automatically released.

     vInternal resources can be used in all cases when it is necessary to avoid not-wanted rescheduling within a group of tasks.


  • 相关阅读:
    nexus搭建maven私服及私服jar包上传和下载
    Java数据结构和算法(八)——递归
    postgresql数据库的 to_date 和 to_timestamp 将 字符串转换为时间格式
    postgreSql的字段名称是小写的这个一定要注意
    Mybatis异常There is no getter for property named 'XXX' in 'class java.lang.String'
    postgresql 获取所有表名、字段名、字段类型、注释
    克隆指定的分支和切换分支
    git branch不显示本地分支的问题
    git中Please enter a commit message to explain why this merge is necessary.
    企业微信开发步骤 1.拿到企业的id,在我的企业,拖到最下面拿到企业id 2.拿到SECRET,这个secret只有先创建应用才会产生出来
  • 原文地址:https://www.cnblogs.com/iable/p/4206845.html
Copyright © 2011-2022 走看看