Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mar.11. 2009 OSEK/VDK Woo Dong Kyun.

Similar presentations


Presentation on theme: "Mar.11. 2009 OSEK/VDK Woo Dong Kyun."— Presentation transcript:

1 Mar OSEK/VDK Woo Dong Kyun

2 OSEK OS Processing Level OSEK OS Task Concept OSEK OS Task Scheduler
Contents OSEK OS Introduce OSEK OS Processing Level OSEK OS Task Concept OSEK OS Task Scheduler Task API Priority Ceiling

3 Event Driven Control System
OSEK OS Event Driven Control System portability and re-usability of application software Special support for automotive requirements ProOSEK(3Soft), OSEKTurbo(Metrowerks) OSEK/VDK Specification - OSEK OS - OSEK COM - OSEK Time OS - OSEK FTCOM - OIL 오섹은 세부 표준으로 나뉩니다. OSEK OS 는 멀티테스킹을 지원하는 가장 기본적인 운영체제 이며, 태스크의 생성, 이벤트기반의 태스크 스켸줄링, 태스크 동기화 등의 기능이 제공된다. COM 은 태스크들이 메시지를 받으며 서로 통신할 수 있는 것, ECU에 있는 다른 태스크 끼리 통신도 지원을 한다. TIME OS는 시간기반 스켸줄링을 한다, 스켸줄링 정보들이 미리 타임 테이블에 기록되어 정해진 시간에 정해진 순서대로 태스크들이 수행 될 수 있도록 한다. 오섹 OS와 함께 사용될수도 있고, 아니면 하나만 사용 될수도 있다. FTCOM 은 COM를 확장하여 태스크들이 주고 받는 메시지에 고장 감내성(고장를 견디는??) 부여한다 OIL은 오섹의 여러 옵션들을 정의하고 있으며, 이 파일을 작성하여, 자신의 목적에 맞게끔 최적화를 할수 있다

4 OSEK OS(cont..) Task management Synchronisation Interrupt management
• Activation and termination of tasks • Management of task states, task switching Synchronisation • Event control • Resource management Interrupt management • Services for interrupt processing Alarms • Relative and absolute alarms Intra processor message handling • Services for exchange of data Error treatment • Mechanisms supporting the user in case of various errors 오섹의 기본적인 역할은 일단 테스크를 관리하고, 또한 동기화, 인터럽트 처리, 알람, 프로세스 메시지 핸들링, 에러 처리 등의 역할을 하고 있습니다.

5 OSEK Processing Level Processing levels of the OSEK operating system
OSEK defines three processing levels: • Interrupt level • Logical level for scheduler • Task level 오섹의 프로세싱 레벨입니다. 오섹은 3개의 프로세싱 레벨로 나뉘어 져 있으며, 우선순위가 가장 높은 것은 인터럽트 레벨, 그리고 스켸줄러, 그리고 테스크의 레벨 순으로 이루어져 있습니다.

6 OSEK Processing Level(cont.)
The following priority rules have been established: • Interrupts have precedence over tasks • The interrupt processing level consists of one or more interrupt priority levels • Assignment of interrupt service routines to interrupt priority levels is dependent on Implementation and hardware architecture • For task priorities and resource ceiling-priorities bigger numbers refer to higher priorities. • The task’s priority is statically assigned by the user 인터럽트는 테스크보다 빨리 실행이 도니다. 인터럽트는 우선순위를 가진다. 셀링 프리얼리티는 가장 높은 우선순위보다 1단계더 크다 테스크의 우선 순위는 유저가 고정적으로 정할수 있다

7 OSEK Task Concept Task concept • basic tasks
- Basic tasks switches to a higher-priority task 오섹의 테스크는 크게 두가지로 나뉩니다, 하나가 베이직 테스크 입니다. 베이직 테스크의 상테는 러닝, 레디, 그리고 서스펜드 3가지 상태로 이루어져 있습니다.

8 OSEK Task Concept •Extended Task
1. The OSEK operating system provides a task switching mechanism 2. The OSEK operating system is responsible for saving and restoring task context in conjunction with task state transitions whenever necessary. 3. Extended Task state model 익스턴티드 테스크 는 런닝, 서스팬드, 웨이팅, 래디 4가지 상태가 존재 하며, 태스크간의 상태가 바뀔때 마다, 문맥을 저장, 복구를 보장을 해주고 있습니다. -

9 OSEK Task Concept Running - The CPU is assigned to the task
- Task instructions execute 2. Ready - Task waits for allocation of the processor - The scheduler decides which ready task is executed next. 3. Waiting - A task cannot continue execution because it shall wait for at least one event 4. Suspended - Task is passive and can be activated 태스크 상태를 나열하면 런닝 상태는 태스크가 CPU를 쓰고 있는 상테입니다. 래디는 태스크가 CPU를 쓸려고 기다리고 있는 상태며, 스켸줄러는 다음에 실행될 태스크를 결정을 해줍니다. Waiting 태스크가 적어도 하나의 이벤트를 기다리는 상황이라서 수행이 안되는 시점입니다. 서스팬드는 태스크가 비활성 상태를 뜻합니다, acitve 될수 도 있습니다.

10 OSEK Task Scheduler 1. 0~15 Priority of a Task
Use 16 FIFO Queue Scheduler 스켸줄러의 구조입니다. 스켸줄러는 레디 상태에 있는 태스크들 중에 다음에 수행할 한 태스크를 선택하는 역할을 합니다. 16개의 우선순위를 지원하는 FIFO스켸줄러를 사용을 하고 있습니다. 각 태스크는 0~15까지의 우선순위를 가지고 있으며, 우선순위가 높은 테스크가 먼저 선택이 됩니다. 만약 우선순위가 같은 태스크가 있는 경우, 가장 오래 전에 래디 상태가 된 태스크가 선택이 된다. Ready Queue

11 OSEK Task API Task API - DeclareTask(TaskIdentifier)
Parameter : TaskIdentifier DeclareTask serves as an external declaration of a task. - ActivateTask(TaskID) Parameter : TaskID The task<TaskID) is transferred from the suspended state into the ready state TerminateTask(void) The task is transferred from the running state into the suspend state ChainTask(TaskID) This service causes the termination of the calling task. Next The Task(TaskID) is activated. 디클리어 태스크: 태스크의 존재를 선어늘 한다. 액티브태스크 : 인자 값으로 태스크 아이디를 넣고, 서스팬드 된 태스크를 ready 상태로 만든다 터미네이트테스크 : 현재 런닝 중인 태스크를 서스팬드로 만든다 체인테스크 : 현재 태스크를 터미네이터를 시키고, 그 인자값으로 들어간 테스크아이디에 맞는 태스크를 활성화 시킨다.

12 Priority Ceiling OSEK Priority Ceiling Protocol
To avoid the problems of priority inversion and deadlocks OSEK use Priority Ceiling Protocol High Low 우선순위 역전과 데드락 문제 때문에 오섹에서는 프리얼리티 셀링 방식으로 방지를 합니다. 보통 방법에는 프리얼리티 인헐리탠스(priority inheritance) 와 프리얼리티 셀링 방식이 있습니다. 오섹에서는 프리얼리티 셀링 방식을 쓰고 있는데. 일단 자원을 잡고 있는 테스크 때문에 우선순위가 높은 테스크가 계속해서 자원을 기다리게 되어서 우선순위 역전 형상이 기약없이 계속 될 수도 있게 됩니다. 그래서 낮은 우선 순위를 가진 테스크의 우선순위를 일시적으로 높은 우선 순위를 가지게 하여, 잠긴 자원의 사용을 빨리 끝내게 하려는 것입니다. 그림에서 보면 테스크 4가 가장 낮은 우선 순위를 가지고 있고, 이때 자원을 요청하면 T4의 우선순위는 셀링 프리얼리티 로 올라가게 됩니다. 이 상테에서 T4는 수행을 하다가 T0의 우선순위가 높기 때문에 선점이 일어나고, 그다음 나머지 수행을 하게 됩니다. T1도 T4가 쓰는 자원을 써야 하지만 우선순위에서 밀려, T4가 원상복구 될때 까지 선점을 못하고 대기하게 됩니다. OSEK Priority Ceiling Protocol

13 Priority Ceiling Resource assignment with priority ceiling between preemptable tasks and interrupt services routines. The task T1 is running and requests a resource shared with the interrupt service routine INT1 이상태는 T1과 인터럽트 1번 이 같은 자원을 공유했을 때 상황입니다. T1이 자료를 요청하면 우선순위가 인터럽트 서비스 루틴 1번 위로 올라가며, 수행도중 INT1 번이 발생하면 인터럽트는 팬딩이 됩니다. 그리고 이때 그보다 더 높은 인터럽트2번(2번은 자원을 공유를 안하기 때문에) 2번이 더 높고, 수행이 되며, 수행후 T1이 계속 수행이 되고, 수행이 다 되면, 인터럽트1이 수행이 됩니다.

14 Priority Ceiling Resource assignment with priority ceiling between interrupt services routines 이 상황을 인터럽트 간의 자원 공유시 상황입니다. 현재 인터럽트1과 2번이 자원을 공유하는 상황이며, 인터럽트 1이 발생을 하면, 2번보다 높은 우선순위로 올라가며,

15 Reference SNU RTOSLab http://redwood.snu.ac.kr/ OSEK/VDX Portal

16 Q&A

17 감사합니다 이상입니다. 질문 있으신분?


Download ppt "Mar.11. 2009 OSEK/VDK Woo Dong Kyun."

Similar presentations


Ads by Google