untitled

Similar documents
ESP1ºÎ-04

6주차.key

Here is a "PLDWorld.com"... // EXCALIBUR... // Additional Resources // µc/os-ii... Page 1 of 23 Additional Resources: µc/os-ii Author: Source: HiTEL D

10주차.key

EmbeddedSoC_1주차.PDF

PCServerMgmt7

SRC PLUS 제어기 MANUAL

Chap06(Interprocess Communication).PDF

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

강의10

1217 WebTrafMon II

<4D F736F F F696E74202D20322DBDC7BDC3B0A320BFEEBFB5C3BCC1A6>


untitled

Remote UI Guide

기술 이력서 2.0

untitled

untitled

DBPIA-NURIMEDIA

hlogin7

T100MD+

Microsoft PowerPoint - Introduction.pptx

SMB_ICMP_UDP(huichang).PDF

Microsoft Word - FunctionCall

hlogin2

PRO1_16E [읽기 전용]

untitled

1. GigE Camera Interface를 위한 최소 PC 사양 CPU : Intel Core 2 Duo, 2.4GHz이상 RAM : 2GB 이상 LANcard : Intel PRO/1000xT 이상 VGA : PCI x 16, VRAM DDR2 RAM 256MB

Deok9_Exploit Technique


TCP.IP.ppt

슬라이드 제목 없음

Something that can be seen, touched or otherwise sensed

PowerPoint 프레젠테이션

Backup Exec

Network seminar.key

Chap04(Signals and Sessions).PDF

1.LAN의 특징과 각종 방식

03장.스택.key

Figure 5.01

MAX+plus II Getting Started - 무작정따라하기

ETL_project_best_practice1.ppt

Microsoft Word - ExecutionStack

Voice Portal using Oracle 9i AS Wireless


목차 1. 제품 소개 특징 개요 Function table 기능 소개 Copy Compare Copy & Compare Erase

thesis

PRO1_04E [읽기 전용]

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

4.18.국가직 9급_전산직_컴퓨터일반_손경희_ver.1.hwp

CD-RW_Advanced.PDF

2. Deferred Interrupt Processing A. Binary Semaphores를이용한동기 (Synchronization) i. Binary Semaphores는 Interrupt가발생하였을때특정한 를 Unblock 하는데사용할수있다. 이러한기능은 In

The Self-Managing Database : Automatic Health Monitoring and Alerting

5.스택(강의자료).key

hd1300_k_v1r2_Final_.PDF

Sena Technologies, Inc. HelloDevice Super 1.1.0

Sena Device Server Serial/IP TM Version

歯J PDF

기타자료.PDF

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

UML

Abstract View of System Components

Chap7.PDF

APOGEE Insight_KR_Base_3P11

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

chap7.key

10.

MicrocontrollerAcademy_Lab_ST_040709

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

thesis

13주-14주proc.PDF

1

Interstage5 SOAP서비스 설정 가이드

untitled

Solaris Express Developer Edition

Chapter. 1 Embedded System I Embedded System 소개 Jaeheung, Lee

R50_51_kor_ch1

Embeddedsystem(8).PDF

<4D F736F F D E20B4DCB8BB20C1A1B0CB20B9D720C1B6C4A120B8C5B4BABEF35F76312E335F2E646F63>

IBM Rational 2006 IBM Corporation

Windows Embedded Compact 2013 [그림 1]은 Windows CE 로 알려진 Microsoft의 Windows Embedded Compact OS의 history를 보여주고 있다. [표 1] 은 각 Windows CE 버전들의 주요 특징들을 담고

ori r24, 0x03 ; Modify 하고, out PORTD, r24 ; Write 한다. 위예는명령이하나실행된다음, 나머지명령이실행되기전에 Interrupt가발생할수있기때문에 non-atomic Operation 이다. 다음의시나리오는 2개의 Task가 PORT

FileMaker 15 WebDirect 설명서

목차 제 1 장 inexio Touch Driver소개 소개 및 주요 기능 제품사양... 4 제 2 장 설치 및 실행 설치 시 주의사항 설치 권고 사양 프로그램 설치 하드웨

시스코 무선랜 설치운영 매뉴얼(AP1200s_v1.1)

4 CD Construct Special Model VI 2 nd Order Model VI 2 Note: Hands-on 1, 2 RC 1 RLC mass-spring-damper 2 2 ζ ω n (rad/sec) 2 ( ζ < 1), 1 (ζ = 1), ( ) 1

s SINUMERIK 840C Service and User Manual DATA SAVING & LOADING & & /

Microsoft PowerPoint APUE(Intro).ppt

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

PRO1_09E [읽기 전용]

K7VT2_QIG_v3

슬라이드 1

歯A1.1함진호.ppt

vm-웨어-01장

Assign an IP Address and Access the Video Stream - Installation Guide

MS-SQL SERVER 대비 기능

슬라이드 1

휠세미나3 ver0.4

Synchronization

Transcription:

Embedded System Lab. II Embedded System Lab. II 2 RTOS Hard Real-Time vs Soft Real-Time RTOS Real-Time, Real-Time RTOS General purpose system OS H/W RTOS H/W task Hard Real-Time Real-Time System, Hard Real-Time System Ex), Soft Real-Time Soft Real-Time System Ex) cellular phone, router Embedded System Lab. II 3 Embedded System Lab. II 4

RTOS - Multitasking RTOS - Task Multitasking Embedded system task (), Multitasking Ex) ADSL Router PPP(point-to-point) Task IP(Internet Protocol) Task UDP(User Datagram Protocol) Task TCP(Transmission Control Protocol) Task RIP(Routing Information Protocol) Task ATM(Asynchronous Transfer Mode) Task Task priority Task priority task priority task Preemptive kernel Task stack Task ( ) Task stack, task, argument, return stack stack Embedded System Lab. II 5 Embedded System Lab. II 6 RTOS Task Task states Diagram Task status DORMANT Memory Task RTOS READY RUNNING Task READY task priority WATING READY terminate WATING get something wait something(events) start context switch interrupt DORMANT READY RUNNING ISR terminate context switch return Embedded System Lab. II 7 Embedded System Lab. II 8

Task state High priority task A serial Low priority task B LED ON/OFF 2 task Task A task B priority RUNNING task B READY. Task A serial WATING Scheduler (Context Switch) task B RUNNING. task B LED ON/OFF. Serial ISR. ISR Scheduler. Scheduler (Context Switch) ISR WATING task A RUNNING task B READY. Multiple Task Diagram 1 2 3 stack stack stack TCB TCB TCB Priority Status Priority Status Priority Status Stack Base Address register Stack Base Address register Stack Base Address register register.. MEMORY Embedded System Lab. II 9 Embedded System Lab. II 10 Scheduler (Dispatcher) Context Switch (Task Switch) Scheduler READY task task priority task priority-based scheduling High priority Ready list A 100 B 80 C 50 D 30 E 5 Scheduler A win!! Task RUNNING. Task (). Task. Context Switch Scheduler RUNNING task RUNNING task Context task Context TCB task Context Switch. Task Context. Context Task. Priority based Scheduler Embedded System Lab. II 11 Embedded System Lab. II 12

Context switch Context switch Diagram task1 Scheduler READY task2 Context switch (, ). task1 Context task1 TCB task2 TCB Context. task2 Scheduler task1 RUNNING Context Switch (, ) task2 (Context) task2 TCB task1 TCB Context 1 2 3 stack stack stack TCB TCB TCB Priority Status Priority Status Priority Status Stack Base Address register Stack Base Address register Stack Base Address register.. context push registers Image into the each TCB MEMORY context switch pop registers image from the TCB into registers Embedded System Lab. II 13 register Embedded System Lab. II 14 Non-preemptive Kernel Non-preemptive Kernel task kernel task task cooperative multitasking Real-time system priority task priority task Ex) Windows 3.1 Low-Priority Task A ISR ISR makes the high-priority task ready Time High-Priority Task B Low-Priority task relinquishes the Embedded System Lab. II 15 Embedded System Lab. II 16

Non-Preemptive Kernel Preemptive Kernel Low priority taska interrupt ISR Scheduler task priority task READY ISR ISR Low priority taska taska system call kernel taskb ( serial ) task kernel task task ( task priority ) priority task Deterministic RTOS Ex) Windows 95/98/NT, UNIX Embedded System Lab. II 17 Embedded System Lab. II 18 Preemptive Kernel Preemptive Kernel Low-Priority Task A Time ISR High-Priority task relinquishes the ISR makes the high-priority task ready High-Priority Task B Low priority taska ISR Scheduler task priority task READY ISR ISR taska high priority taskb taskb ( serial ) taskb kernel system call kernel taska taska Embedded System Lab. II 19 Embedded System Lab. II 20

Critical Section (Region) Mutual Exclusion task, Context Switch task Solution Mutual Exclusion Progress Bounded Waiting Semaphore task task Mutual Exclusion Disable interrupts; Access(read/write) the shared resource; Enable interrupts; ( ) enable Embedded System Lab. II 21 Embedded System Lab. II 22 Mutual Exclusion (2) Semaphore Scheduling Semaphore Disable scheduling; Access(read/write) the shared resource; Enable scheduling; 1960 Edgser Dijkstra RTOS key Scheduling ISR Mutual Exclusion task, priority task deterministic Binary Semaphore 1 Acquire Semaphore Semaphore SEMAPHORE Shared Resource Shared Resource access time Acquire Semaphore n Binary Semaphore Embedded System Lab. II 23 Embedded System Lab. II 24

Semaphore (2) Task Synchronization Counting Semaphore 1 n Semaphore priority based FIFO based Acquire Semaphore Acquire Semaphore 5 SEMAPHOREs 5 4 3 2 1 Shared Resources int N = 0; void taska(void) /* task A */ int i; for (i = 1; i <= 2000; i++) N++; void taskb(void) /* taskb */ int i; for (i = 1; i <= 2000; i++) printf( N is %d\n, N); int N = 0; /* semaphore X count = 0 */ /* semaphore Y count = 1 */ void taska(void) /* taska */ int i; for (i = 1; i <= 2000; i++) Take semaphorex; /* attempt to get semaphore X */ N++; Give semaphorey; /* release semaphore Y */ void taskb(void) /* taskb */ int i; for (i = 1; i <= 2000; i++) Take semaphorey; /* attempt to get semaphore Y*/ printf( N is %d\n, N); Give semaphorex; /* release semaphore X */ Embedded System Lab. II 25 Embedded System Lab. II 26 Reentrancy Priority Inversion & Priority Inheritance Non-reentrant function example int Temp; void swap(int *x, int *y) Temp = *x; *x = *y; *y = Temp; Priority Inversion priority task priority task HIGH Task 1 Task 1 Temp = 1 Low priority task A for( ; ; ) for( ; ) x = 1; x = 1; y = 2; y = 2; swap(&x, &y); swap(&x, &y); Temp = *x; Temp = *x; *x = *y; *x = *y; *y = Temp; *y = Temp; sleep(1); sleep(1); ISR OS (context switch) OS (context switch) Temp = 3 Original Temp value(=1) is altered to 3!!! Temp = 3 High priority task B for( ; ; ) for( ; ) x = 3; x = 3; y = 4; y = 4; swap(&x, &y); swap(&x, &y); Temp = *x; Temp = *x; *x = *y; *x = *y; *y = Temp; *y = Temp; sleep(1); sleep(1); priority Task 3 LOW : take semaphore : give semaphore : give semaphore Task 2 Task 3 Task 3 time : context switch(preemption) : priority inheritance/release : waited(blocked) Priority Inversion Embedded System Lab. II 27 Non-reentrant function Embedded System Lab. II 28

Priority Inversion & Priority Inheritance (2) Task Communication (Inter) Priority Inversion priority task WAITING, task task priority task priority HIGH LOW priority Task 3 : take semaphore : give semaphore : give semaphore Task 1 Task 3 time Task 1 : context switch(preemption) : priority inheritance/release : waited(blocked) Task 2 Priority Inheritance global variable Linked list, Circular queue.. Mutual Exclusion message passing Message Mailbox Message Queue ISR ISR send send Mailbox receive Message Message Mailbox Queue receive Message Message Queue Embedded System Lab. II 29 Embedded System Lab. II 30 Interrupts Interrupts (2) mechanism asynchronous events Non-preemptive kernel ISR ISR task Preemptive kernel ISR, Scheduling Interrupt Latency : Maximum amount of time interrupts are disabled + Time to start executing the first instruction in the ISR Interrupt Response : Interrupt Latency + Time to save the s context + Execution time of the kernel ISR entry function(preemptive kernel only) Interrupt Recovery : Time to determine if a higher priority task is ready(preemptive kernel only) + Time to restore the s context of the highest priority task + Time to execute the return from interrupt instruction Embedded System Lab. II 31 Embedded System Lab. II 32

Interrupts (3) non-preemptive kernel Interrupts (4) preemptive kernel Interrupt Request time Interrupt Request A s Context saved time Kernel s ISR Exit function Interrupt Recovery A s Context restored Kernel s ISR Entry function User ISR Code s Context restored Interrupt Latency Interrupt Response User ISR Code Interrupt Recovery s Context restored Interrupt latency, response, and recovery (non-preemptive kernel) Interrupt Latency Interrupt Response Kernel s ISR Exit function Interrupt Response s Context restored B Interrupt latency, response, and recovery (preemptive kernel) Embedded System Lab. II 33 Embedded System Lab. II 34 RTOS RTOS -Task RTOS kernel interface VxWorks psos Nucleus VRTX uc/os II Task ID Task ID Task Unique Key VxWorks, psos, Nucleus TCB pointer Task Id OS TCB, pointer VRTX, uc/os II Virtual Task ID, TCB Table 0-255(VRTX), 0-63(uC/OS II) Task ID Task Task VxWorks, psos, Nucleus, VRTX Configuration Task uc/os II 64 Task, 4 4 Task OS Task 56 Embedded System Lab. II 35 Embedded System Lab. II 36

RTOS -Task RTOS -Task Task VxWorks, psos, Nucleus 10, 4, 8 Task Task unique ID VRTX, uc/os II Task Priority() VxWorks, VRTX, Nucleus 0 255 priority ( 0 ) psos 0 255 priority ( 0 ) 0 240-255 OS uc/os II Priority Task ID (0-63) Task Nucleus, uc/os II Scheduling psos Scheduling VxWorks, VRTX Scheduling Scheduling 2 Argument Passing() Task data argument VxWorks 10 parameter VRTX char *paddr unsigned long psize parameter block Nucleus argc argv psos 4 integer argument uc/os II 3 parameter Embedded System Lab. II 37 Embedded System Lab. II 38 RTOS Semaphore/Mutex RTOS Semaphore/Mutex Mutex Nucleus uc/os II 2.04 version psos psos 3 VxWorks Binary Semaphore Priority or FIFO Semaphore pending Priority, FIFO uc/os II Priority VxWorks, psos, Nucleus, VRTX Priority FIFO Create interface Name psos, Nucleus VxWorks, VRTX, uc/os II Name Semaphore ID Timout No Wait Semaphore Timout Timout,, No Timeout 3 No Timeout Semaphore pend return VxWorks, Nucleus NOWAIT pending interface timeout (FOREVER,NOWAIT,Timeout) psos WAIT, NOWAIT wait parameter, WAIT 0 Timeout interface VRTX, uc/os II NOWAIT accept() interface Embedded System Lab. II 39 Embedded System Lab. II 40

RTOS Semaphore/Mutex RTOS Queue Semaphore VxWorks Take/Give psos P/V VRTX, uc/os II Pend/Post Nucleus Obtain/Release Mutex VxWorks Take/Give VRTX Lock/Unlock Variable-length Fixed-length Variable-length : queue message Fixed-length : queue message VxWorks Variable-length psos, Nucleus Variable-length Fixed-length VRTX, uc/os II Fixed-length Priority or FIFO Queue pending uc/os II Priority VxWorks, psos, Nucleus, VRTX Priority FIFO Create interface Embedded System Lab. II 41 Embedded System Lab. II 42 RTOS Queue RTOS Queue Name psos, Nucleus VxWorks, VRTX, uc/os II Name Queue ID Send/Post Timout Queue Full Send/Post error return, send/post VxWorks, Nucleus - psos, VRTX, uc/os II error return Timout No Wait Queue Timout Timout,, No Timeout 3 No Timeout Queue message pend return VxWorks, Nucleus NOWAIT pending interface timeout (FOREVER,NOWAIT,Timeout) psos WAIT, NOWAIT wait parameter, WAIT 0 Timeout interface VRTX, uc/os II NOWAIT accept() interface Broadcast Queue pend Task psos, VRTX, Nucleus VxWorks, uc/os II Embedded System Lab. II 43 Embedded System Lab. II 44

RTOS Queue RTOS (psos) Queue VxWorks, psos, Nucleus send/receive VRTX, uc/os II post/pend Integrated Systems WindRiver ( psos+ ) RTOS (prism+) Kernel Software component Kernel, application, royalty application Embedded System Lab. II 45 Embedded System Lab. II 46 RTOS (VxWorks) Multi Thread OS (1) WindRiver Chip Device Driver psos 200 -> RTOS (Tornado:) Kernel, application, royalty OSE Enea OSE Systems, RTOS VRTX Mentor Graphics RTOS. Nucleus Plus Accelerated Technology, RTOS RTOS Full Source Code, Royalty PDA 50, 1, 2 SuperTask US Software, RTOS. Nucleus Source Code Open, No Royalty Embedded System Lab. II 47 Embedded System Lab. II 48

Multi Thread OS (2) Multi Process OS (3) MicroC/OS (uc/os) RTOS Jean J. Labrosse RTOS, Source Code, Royalty Upgrade Upgrade uc/os-ii, QNX QNX Software Systems, UNIX, Real-Time Platform Package OS-9 Microware, RTOS LynxOS LinuxWorks, Embedded Linux RTOS UNIX OS, Real-Time Application RTLinux Finite State Machine Labs, Embedded Linux Embedded System Lab. II 49 Embedded System Lab. II 50