written 5.9 years ago by |
Message Queue
A buffer like data structure through tasks and ISRs communicating with each other by sending and receiving message and sync with data.
Mailboxes
Mailboxes are much similar to message queues.
used for one way messaging.
Function of RTOS - to create, to write, to read from the mailbox and to destroy it if no longer needed.
Pipes
are objects created for unstructured data exchange between tasks and facilitate sync among tasks.
unidirectional data exchange.
When pipe is created, 2 descriptors are created.
Semaphore
A kernel object which is used for coordinating or sync activities in which multiple tasks tries to acquire same resource.
used to control the access of shared resource to one task out of multiple.
Thus - semaphore - acts as key.
(i) Binary semaphores
simple '0' and '1' $\to$ key available or not
used in cases where only one task can access the given shared resource.
tasks $\to$ resource $\to$ check semaphore
$\to$ if '1' - available $\to$ task access the shared resource making semaphore '0'.
(ii) Counting semaphores
$\to$ Resource is accessed by multiple tasks at a given time.
$\to$ n tasks can access the shared resource.
Mutual exclusion(Mutex semaphore)
Datatypes
char $\to$ 1 Byte $\;\;\;\;\;\;$ (-127 to 128)
signed $\to$ 1 Byte $\;\;\;\;$ (-127 to 128)
unsigned $\to$ 1 Byte $\;$ (0 to 255)
int $\to$ 2 Byte $\;\;\;\;\;\;\;\;$ (-32768 to 32767)
signed $\to$ 2 Byte
unsigned $\to$ 2 Byte
short int $\to$ 2 Byte
long int $\to$ 4 Byte
float $\to$ 4 Byte
double $\to$ 8 Byte
long $\to$ 10 Byte