ฝึกพูดภาษาอังกฤษด้วยเทคนิค Shadowing จากวิดีโอ: Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? | Digi-Key Electronics

กำลังสร้างบทเรียน...
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.

คำศัพท์และข้อสังเกตด้านการพูดสำหรับบทเรียนนี้

วิดีโอนี้มี 119 ประโยค และ 1889 คำ สำหรับฝึกพูดตาม ช่วงที่มีเสียงพูดยาว 11:17 ผู้พูดพูดด้วยความเร็วเป็นธรรมชาติ ประมาณ 167 คำต่อนาที ใกล้เคียงกับบทสนทนาในชีวิตประจำวัน มีเพียง 78% ของคำที่อยู่ใน 3,000 คำที่ใช้บ่อยที่สุดในภาษาอังกฤษ คำศัพท์จึงค่อนข้างยาก

คำศัพท์สำคัญในวิดีโอนี้

คำที่ควรเรียนรู้ 15 คำจากวิดีโอ พร้อมคำอ่านและความหมาย:

คำศัพท์คำอ่านความหมาย
deadline คำนาม/ˈdɛdˌlaɪn/เส้นตาย
loop คำนาม/luːp/บ่วง
execute คำกริยา/ˈɛksɪˌkjuːt/ประหาร
thread คำนาม/ˈθɹɛd/ด้าย, เชือก
resource คำนาม/ɹɪˈzɔːs/ทรัพยากร
architecture คำนาม/ˈɑː.kɪˌtɛk.t͡ʃə/สถาปัตยกรรม
priority คำนาม/pɹaɪˈɒɹɪti/สิทธิไปก่อน, ความสำคัญ
hardware คำนาม/ˈhɑɹdˌwɛɹ/ฮาร์ดแวร์
slice คำนาม/slaɪs/ชิ้น
interval คำนาม/ˈɪntɚvəl/ช่วง, ระยะ
vast คำคุณศัพท์/væst/ว้างเวิ้ง, ไพศาล
relative คำนาม/ˈɹɛl.ə.tɪv/ญาติ, ญาติพี่น้อง
bone คำนาม/boʊn/กระดูก
package คำนาม/ˈpæk.ɪd͡ʒ/หีบห่อ, ห่อ
compare คำกริยา/kəmˈpɛɚ/เปรียบเทียบ

กริยาวลีที่คุณจะได้ยิน

คำศัพท์ความหมาย
try out คำกริยาลอง

ไวยากรณ์ในวิดีโอนี้

โครงสร้างที่ผู้พูดใช้บ่อยที่สุด พร้อมคำพูดจริงจากวิดีโอ:

โครงสร้างในวิดีโอ
Passive voice be + กริยาช่อง 3 — เน้นสิ่งที่เกิดขึ้น ไม่ใช่ผู้กระทำare designed · is designed · can be missed
Present perfect have/has + กริยาช่อง 3 — เหตุการณ์ในอดีตที่ยังเกี่ยวข้องกับปัจจุบันyou've written · have created · have ported
Relative clauses who / which + อนุประโยค — ข้อมูลเพิ่มเติมเกี่ยวกับคนหรือสิ่งของdeterministic, which means · interrupts which can · time, which means

การออกเสียงที่ควรระวัง

ผู้พูดใช้รูปย่อและรูปลดเสียง 31 ครั้ง เช่น you're, I'll, you'll ให้พูดแบบสั้นตามที่ได้ยิน

  • เสียง “sh” และ “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̩/
  • คำยาว — ลงเสียงหนักให้ถูกพยางค์: 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/

วิธีฝึกกับวิดีโอนี้

  1. ฟังวิดีโอให้จบหนึ่งรอบโดยยังไม่ต้องพูด แล้วจดคำที่ยังไม่รู้จัก
  2. เริ่มที่ความเร็ว 0.75× พูดตามทีละประโยค แล้วกลับไปใช้ความเร็วปกติเมื่อเริ่มคล่อง
  3. อัดเสียงตัวเองแล้วเทียบกับต้นฉบับ โดยสังเกตคำอย่าง deadline, loop, execute เป็นพิเศษ

เทคนิค Shadowing คืออะไร?

Shadowing เป็นเทคนิคการเรียนรู้ภาษาที่ได้รับการรับรองทางวิทยาศาสตร์ พัฒนาขึ้นสำหรับการฝึกนักแปลมืออาชีพ วิธีการนี้เรียบง่ายแต่ทรงพลัง: คุณฟังเสียงภาษาอังกฤษจากเจ้าของภาษาและพูดตามทันที — เหมือนเงาที่ตามผู้พูดด้วยช่วงเวลาห่าง 1-2 วินาที การวิจัยแสดงว่าเทคนิคนี้ปรับปรุงความแม่นยำในการออกเสียง ทำนองเสียง จังหวะ การเชื่อมเสียง การฟังเข้าใจ และความคล่องแคล่วในการพูดได้อย่างมีนัยสำคัญ

เทคนิค shadowing: อ่านคู่มือฉบับเต็มทีละขั้นตอน →