Pratique du Shadowing: Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? | Digi-Key Electronics - Apprendre l'anglais à l'oral avec la vidéo

Choisissez un mode d'entraînement

Chaque mode ouvre une salle d'entraînement en plein écran.

119 phrases
Si les phrases sont trop courtes ou trop longues, cliquez sur Edit pour les ajuster.
1
A real-time operating system, or RTOS, is very much like any other operating system with a few important differences.
2
Over the next few videos, I'd like to talk about those differences and how to get started using free RTOS.
3
We'll go over tasks, threads, prioritization, memory management, and intertask communication.
4
Let's get started.
5
An operating system is a piece of software that runs on a computer or microcontroller that accomplishes a number of important functions.
6
First, it is in charge of scheduling background tasks and user applications.
7
In most operating systems, dozens of background processes are executing at the same time,
8
and you probably have several applications open on your phone or computer right now.
9
The operating system figures out how to give slices of time to each of these processes
10
so that everything appears to be happening concurrently.
11
Second, it manages a number of virtual resources like files, libraries, and folders, allowing applications and processes to access them when needed.
12
Third, they can manage or provide device drivers for your system.
13
These drivers allow the system to read and write from an external disk, respond to keyboard and mouse input or draw graphics on your monitor.
14
You're probably familiar with general purpose operating systems like Windows Mac OS and Linux iOS and Android also fall into this category.
15
Most general purpose operating systems are designed with human interaction as the most important feature.
16
So the scheduler is designed to prioritize such tasks
17
that may mean some timing deadlines can be missed or pushed back and a little lag in responsiveness,
18
especially if it's not really noticed by a human, is acceptable.
19
Additionally, the scheduler is often non-deterministic, which means we can't know exactly which task will execute when and for how long.
20
If you're making something that requires an OS and strict timing deadlines, like a medical device or engine controller,
21
missing a deadline to say fire a spark plug would be catastrophic.
22
This is where a real-time operating system or RTOS can save the day.
23
Most RTOS's offer many of the same functions as general purpose operating systems
24
but they are designed so that the scheduler can guarantee meeting timing deadlines on the tasks.
25
While some RTOS's might provide high-level device drivers,
26
you'll usually see things intended for microcontrollers like Wi-Fi and Bluetooth stacks or simple LCD drivers.
27
You can also find bare bones RTOS's that provide just a scheduler.
28
With these, you'll need to import or write your own file systems and device drivers.
29
Note that while most RTOS's provide methods for meeting timing deadlines, that's not the only reason to use an RTOS in your project.
30
The ability to run multiple tasks concurrently can be a lifesaver as we'll see in a moment.
31
If you've written programs for microcontrollers, including Arduino, you're probably familiar with this kind of structure.
32
When your program starts, it performs some setup functions
33
and then it executes your tasks in a round robin fashion inside a while forever loop.
34
These tasks might read from sensors, perform some calculations based on those readings, and then say display something on a gorgeous LED display.
35
This type of simple programming architecture is known as a super loop.
36
It's incredibly easy to implement, has very little overhead, and is great when you only need to accomplish a handful of tasks on your microcontroller. In fact,
37
there's nothing wrong with the super loop for the vast majority
38
of simple microcontroller projects you're usually better off with this type of program flow as it saves on CPU cycles and memory
39
and it's much easier to debug than using an RTOS you
40
might even have created a couple of interrupts to break the
41
flow of execution to handle an external event like a button push or perform some action at specific timed intervals
42
If you need to meet strict timing deadlines for one or two tasks,
43
you might be better off using just interrupt service routines to accomplish those tasks with precise timing.
44
In my experience, if you need to meet a timing deadline of less than about one millisecond, your best bet is an interrupt anyway.
45
If you're trying to do something with an interval of less than a few hundred nanoseconds, you either need an incredibly fast processor,
46
or it's time to start looking at custom hardware like an FPGA.
47
Now, the unfortunate thing about this super loop architecture is that you cannot execute tasks concurrently.
48
If task two starts taking a long time and task three is your update display task, you'll start to experience some lag.
49
Similarly, if you're polling for user input like from a serial terminal or reading a sensor, you might miss data if other tasks take too long.
50
To fix that, we can use the concept of running multiple tasks at the same time.
51
On a multi-core processor, this is actually physically possible.
52
However, since many microcontrollers only have one core, the CPU time needs to be split up among the tasks.
53
We can also give higher priority to some tasks so that they happen sooner or take more CPU time.
54
For example, if we prioritize the user input task, users will likely experience less lag,
55
but it might mean background tasks take longer to execute.
56
We'll talk more about time slicing and prioritization in a future video.
57
Note the terminology used here.
58
A task is any piece of work we want to get done in code.
59
A thread is a unit of CPU utilization with its own program counter and set of memory.
60
A process is an instance of a computer program that's being executed.
61
Usually a process will have one or more threads used to accomplish tasks.
62
Threads within a process will often share resources like heap memory and can pass resources to each other.
63
You'll often find that in our toss is capable of handling only one process, but a general purpose OS can run many processes.
64
Note that in free our toss, the term task is used to mean something closer to a thread and you'll often see these terms used interchangeably.
65
Because of this, I will use the term task
66
when referring to units of CPU utilization so
67
that it makes sense within the free our toss ecosystem interrupts still work within an RTOS
68
so long as they have a higher priority than any of
69
the tasks they will stop code execution for all tasks run your interrupt service routine
70
and return execution to where it left off you can have more than one interrupt
71
but we won't get into handling nested interrupts which can get nasty
72
if you're writing code for a simple 8
73
or 16-bit microcontroller with 2 kilobytes of ram you're probably best sticking with the super loop approach
74
and using the inexpensive controller to do only a a handful of tasks.
75
While you can get a simple scheduler to run on such a device,
76
the memory and CPU overhead of switching tasks would not leave you with many resources left for your actual program.
77
People have ported free RTOS to the Arduino Uno.
78
It's definitely a good way to tinker around with it, but I don't know how ultimately useful it is.
79
As you move into more and more powerful microcontrollers, it becomes much more viable to run in RTOS as you've got clock cycles
80
and memory to spare for things like a scheduler.
81
While you can still run a bare metal super loop on something like an ESP32,
82
I usually find that the whole reason I bought something with that much computing power is to run several concurrent tasks.
83
Which brings me to the ultimate question of, why would you want an RTOS?
84
There are a number of reasons, but the best one that comes to mind is for when you need to do several things concurrently currently.
85
An ESP 32 is capable of handling user input, reading and writing to an SD card, controlling hardware, and crunching numbers all at the same time.
86
The big one for something like this is the wireless stack.
87
These libraries require large amounts of RAM and processing power.
88
They also need to respond to events from the network in a short amount of time, which means using an RTOS can be a massive help in this case.
89
It can help you divide up these different features into individual tasks.
90
An RTOS can be great if you're part of a team working on a larger project.
91
You can divide up the tasks among the team members, knowing that each one will run concurrently.
92
There will be some overhead and debugging to make sure everything works together though.
93
Over the next few videos, I'll go over important RTOS concepts like prioritization and resource management.
94
We'll practice these concepts by implementing small demo projects in Free RTOS on the ESP32.
95
The reason I chose Free RTOS for this series is because it's currently the most popular real-time operating system for IoT devices,
96
as shown by this 2018 survey from the Eclipse Foundation.
97
While Linux still reigns supreme for most of these devices, it and Windows are general purpose operating systems, with the exception of RT Linux.
98
You can see that the bare metal super loop architecture is still quite popular and an acceptable solution to many problems.
99
FreeRTOS is also free and open source, making it easy for you to try out.
100
Note that as of 2017, Amazon has taken over maintenance of the FreeRTOS project.
101
I also recommend keeping an eye on the Zephyr project as
102
it's a relative newcomer to the field backed by the Linux Foundation.
103
The ESP32 is a powerful IoT microcontroller that's packed with features.
104
Also, you can find inexpensive ESP32 development boards.
105
Any of them should work for this series as long as they have an associated Arduino package.
106
I know some of you will balk at the idea of using Arduino for our coding, but hear me out.
107
Most embedded programmers and electronics tinkerers will have some experience with Arduino, and if not, it's easy to learn.
108
Because of that, it creates a level playing field for anyone wanting to try out RTOS concepts.
109
I don't need to teach a vendor tool or chip-specific libraries on top of trying to teach free RTOS.
110
Because the ESP32 runs a modified version of FreeRTOS out of the box, there is hardly any setup involved in creating tasks in Arduino.
111
Almost every code example you see, including task management, semaphores, mutexes, and so on, can easily be ported to your own build system.
112
I'll try to point out where the ESPRTOS differs from vanilla FreeRTOS.
113
An RTOS may not be the right answer to every firmware problem you run across, but sometimes it is the right tool for the job,
114
especially when you need to do things like run concurrent tasks and meet timing deadlines.
115
At the end of most of these videos, I'll issue you a challenge,
116
and I encourage you to try it out on your own ESP32 or whatever device you're running free RTOS on.
117
I'll then post a link to my solution so that you can see how your solution compares.
118
In the next video I'll show you how to get started with free RTOS
119
and create your own task to blink an LED.

Télécharger l'application

Tout pour parler couramment

Prononciation IAChaque phrase notée
Phonétique (IPA)Maîtrisez chaque son
VocabulaireEnrichissez votre lexique
Jeu de vocabulaireApprenez en jouant

Vocabulaire et conseils d’expression pour cette leçon

Cette vidéo contient 119 phrases et 1889 mots à répéter en shadowing. La partie parlée dure 11:17. Le locuteur parle à un rythme naturel d’environ 167 mots par minute, proche d’une conversation courante. Seuls 78 % des mots font partie des 3 000 mots les plus courants en anglais, le vocabulaire est donc exigeant.

Vocabulaire clé de cette vidéo

15 mots de la vidéo à retenir, avec leur prononciation et leur sens :

MotPrononciationSens
deadline nom/ˈdɛdˌlaɪn/date butoir, date limite
loop nom/luːp/boucle
interrupt verbe/ˌɪntəˈɹʌpt/interrompre, couper
execute verbe/ˈɛksɪˌkjuːt/exécuter, mettre à mort
thread nom/ˈθɹɛd/fil
resource nom/ɹɪˈzɔːs/ressource
accomplish verbe/əˈkɑm.plɪʃ/accomplir
architecture nom/ˈɑː.kɪˌtɛk.t͡ʃə/architecture
execution nom/ˌɛk.sɪˈkjuː.ʃən/exécution
overhead nom/ˈəʊvəˌhɛd/frais généraux
toss verbe/tɔs/lancer
priority nom/pɹaɪˈɒɹɪti/priorité
incredibly adverbe/ɪŋˈkɹɛdɪbli/incroyablement
routine nom/ɹuˈtin/routine
hardware nom/ˈhɑɹdˌwɛɹ/équipement

Les verbes à particule que vous entendrez

MotSens
try out verbeessayer, expérimenter
figure out verbecerner
point out verbepointer
take over verbereprendre

La grammaire de cette vidéo

Les structures que le locuteur utilise le plus, avec les mots exacts de la vidéo :

StructureDans la vidéo
Voix passive be + participe passé — l’accent est mis sur ce qui arrive, pas sur qui le faitare designed · is designed · can be missed
Present perfect have/has + participe passé — une action passée qui compte encore maintenantyou've written · have created · have ported
Propositions relatives who / which + proposition — une précision sur une personne ou une chosedeterministic, which means · interrupts which can · time, which means

Prononciation à surveiller

Le locuteur utilise 31 contractions et formes réduites, comme you're, I'll, you'll. Prononcez-les sous leur forme courte, telles que vous les entendez.

  • Les sons « sh » et « zh »: accomplish /əˈkɑm.plɪʃ/, execution /ˌɛk.sɪˈkjuː.ʃən/, exception /əkˈsɛpʃən/, interaction /ˌɪn.təˈɹæk.ʃən/, calculation /ˌkælkjuˈleɪʃn̩/
  • Mots longs — placez bien l’accent: architecture /ˈɑː.kɪˌtɛk.t͡ʃə/, execution /ˌɛk.sɪˈkjuː.ʃən/, priority /pɹaɪˈɒɹɪti/, incredibly /ɪŋˈkɹɛdɪbli/, acceptable /əkˈsɛp.tə.bəl/

Comment s’entraîner avec cette vidéo

  1. Écoutez la vidéo en entier une fois sans parler et notez les mots que vous ne connaissez pas.
  2. Commencez à la vitesse 0,75×, répétez phrase par phrase, puis revenez à la vitesse normale quand cela devient facile.
  3. Enregistrez-vous et comparez avec l’original, en faisant attention à des mots comme deadline, loop, interrupt.

Qu'est-ce que la technique du Shadowing ?

Le Shadowing est une technique d'apprentissage des langues fondée sur la science, développée à l'origine pour la formation des interprètes professionnels. Le principe est simple mais puissant : vous écoutez de l'anglais natif et le répétez immédiatement à voix haute — comme une ombre suivant le locuteur avec un décalage de 1 à 2 secondes. Les recherches montrent une amélioration significative de la précision de la prononciation, de l'intonation, du rythme, des liaisons, de la compréhension orale et de la fluidité.

Technique du shadowing : lire le guide complet étape par étape →