Fundamentals
A task is a program, program unit, process, or thread (lightweight process). It could be a sequential function with an infinite loop. Usually can be of two types user or kernel.
Why do we need an operating system (OS)?
Timers
Task Management
Characteristics
Should we use an OS in IoT?
Why ecosystem
IoT System
A task is a program, program unit, process, or thread (lightweight process). It could be a sequential function with an infinite loop. Usually can be of two types user or kernel.
Why do we need an operating system (OS)?
- Manage hardware and software resources
- Power Management
- Task schedulers
- Task management
- supports multitasking
- Inter-process communications
- Memory allocation and management
- Managing I/O devices and peripherals
- Analog
- motors
- valves
- Digital
- Hardware Interrupts
- ISR (Interrupt Service Routines)
- Time-sharing task scheduling
- Pre-emptive
- Non-preemptive
- Priority-based Round Robin Scheduling
Timers
- Internal core timers
- Software timers
- One shot timers
- Auto-reloaded timers
Task Management
- Managing the Task States
- Running
- Not Running
- Ready
- Suspended
- Blocked
- Context Switching
Race Condition
- Undesirable condition when multiple tasks (or threads) try to access and change the shared data simultaneously.
Thread Safety
- Locking shared resources/data using a critical section
- Intertask communication
Deadlock
Two tasks are waiting for the same resource held by the other
Deadlock Prevention
- planning resource allocation
Interprocess Communications
- Message Queues
- Interrupts
- Mutex - provides mutual exclusion when concurrent tasks access a shared resource
- semaphore
Dynamic Memory Allocation
- Heap
- First Fit Memory Allocation
Static Memory Allocation
- Stack
Characteristics
- Small Footprint
- Modularity
- Extensibility
- Flexible
- Easy to use API
- Portability
- Tools Support
Should we use an OS in IoT?
- to build an ecosystem for device drivers.
- support for extensibility
- Security
Why ecosystem
- vendor
- open source community
- user support
- community
IoT System
- managing processor
Types of Operating Systems
- General Purpose
- rich functionality
- complex functionality
- Embedded OS for resource constraint device
- e.g. coffee machines, smart sensors, wireless routers
- small footprint
- high reliability
- for optimized performance
- e.g. FreeRTOS (real-time OS), Android Things
- limited file system support