SlideShare a Scribd company logo
Task Communication and Synchronization
Task Communications- Page 1
EEC682– Spring 2025
Inter-task communication is an important service that must be
provided by any real-time kernel. This communication is needed
to:
Inter-task communication is an important service that must be
provided by any real-time kernel. This communication is needed
to:
Task Communication and Synchronization
Task Communications- Page 1
EEC682– Spring 2025
 exchange data between tasks.
 avoid problems resulting from access to common resources.
 satisfy task precedence constraints.
Inter-task communication is an important service that must be
provided by any real-time kernel. This communication is needed
to:
Some communication mechanisms, such as semaphores, require
a shared memory among tasks. The method of message passing
is more general.
Task Communication and Synchronization
Task Communications- Page 1
EEC682– Spring 2025
 exchange data between tasks.
 avoid problems resulting from access to common resources.
 satisfy task precedence constraints.
Message queues and mailboxes
Task Communications- Page 2
EEC682– Spring 2025
A minimum set of system calls that handle message passing is the
following:
send (destination, &message)
receive (source, &message)
Message queues and mailboxes
Task Communications- Page 2
EEC682– Spring 2025
A minimum set of system calls that handle message passing is the
following:
send (destination, &message)
receive (source, &message)
Message queues and mailboxes
A message sent but not yet received is queued by the system.
Queue will have a pre-specified maximum capacity.
Task Communications- Page 2
EEC682– Spring 2025
A minimum set of system calls that handle message passing is the
following:
send (destination, &message)
receive (source, &message)
Many design options exist for the message format, addressing
methods, synchronization modes, and queuing discipline. All
these can affect program timing.
Message queues and mailboxes
A message sent but not yet received is queued by the system.
Queue will have a pre-specified maximum capacity.
Task Communications- Page 2
EEC682– Spring 2025
Message Format
Typically, message is a sequence of bytes with fixed or variable
length. Correct interpretation of message content is the
responsibility of the communicating tasks, not the operating
system.
Message queues and mailboxes
Task Communications- Page 3
EEC682– Spring 2025
Message Format
Message queues and mailboxes
Task Communications- Page 3
EEC682– Spring 2025
Typically, message is a sequence of bytes with fixed or variable
length. Correct interpretation of message content is the
responsibility of the communicating tasks, not the operating
system.
Addressing Method
 Direct addressing: using task id.
Allows only one-to-one communication.
Message Format
Typically, message is a sequence of bytes with fixed or variable
length. Correct interpretation of message content is the
responsibility of the communicating tasks, not the operating
system.
Message queues and mailboxes
Task Communications- Page 3
EEC682– Spring 2025
Addressing Method
 Direct addressing: using task id.
Allows only one-to-one communication.
 Indirect addressing : using mailboxes
Allows many-to-one, one-to-many or many-to-many modes.
Message Format
Typically, message is a sequence of bytes with fixed or variable
length. Correct interpretation of message content is the
responsibility of the communicating tasks, not the operating
system.
Message queues and mailboxes
Task Communications- Page 3
EEC682– Spring 2025
Mailbox
s R
Mailbox
s
R1
Rn
S1
Sm
Mailbox
R1
Rn
Mailbox
S1
Sm
R
One to many
One to one Many to one
Many to many
Message queues and mailboxes
Task Communications- Page 4
EEC682– Spring 2025
If no message is available, the receiver will typically be blocked
until one arrives. Alternatively, it can return immediately with
an error code.
Task Communications- Page 7
EEC682– Spring 2025
Example (1): Mutual exclusion using messages
Message queues and mailboxes
Using messages, how to control access to resource (e.g. data)
that cannot be accessed by more than one task at the same time
Task Communications- Page 5
EEC682– Spring 2025
Example (1): Mutual exclusion using messages
To access resource, any task will use the following sequence:
receive(Access_box,&msg);
Access_resource;
send(Access_box,&msg);
Message queues and mailboxes
Using messages, how to control access to resource (e.g. data)
that cannot be accessed by more than one task at the same time
Task Communications- Page 5
EEC682– Spring 2025
Example (2): Bounded buffer problem
A buffer of size n with reader and writer tasks running at
different speeds.
Message queues and mailboxes
Task Communications- Page 6
EEC682– Spring 2025
Example (2): Bounded buffer problem
A buffer of size n with reader and writer tasks running at
different speeds.
Message queues and mailboxes
Task Communications- Page 6
EEC682– Spring 2025
buffer
writer Reader
Example (2): Bounded buffer problem
A buffer of size n with reader and writer tasks running at
different speeds.
Message queues and mailboxes
Task Communications- Page 6
EEC682– Spring 2025
Reader task
send(writer,’empty’);
receive(writer,’full’);
Read_data_item;
Example (2): Bounded buffer problem
A buffer of size n with reader and writer tasks running at
different speeds.
Message queues and mailboxes
Task Communications- Page 6
EEC682– Spring 2025
Reader task
receive(reader,’empty’);
send(writer,’empty’);
receive(writer,’full’);
Read_data_item;
Writer task
Write_data_item;
send(reader,’full’);
in asynchronous send, sender will continue operation
regardless of whether the message was received or not.
Message Synchronization Modes
If no message is available, the receiver will typically be blocked
until one arrives. Alternatively, it can return immediately with
an error code.
Sender can operate in one of two modes:
Task Communications- Page 7
EEC682– Spring 2025
in asynchronous send, sender will continue operation
regardless of whether the message was received or not.
In synchronous send, the sender will be blocked until it
receives an acknowledgment from the receiver.
Message Synchronization Modes
If no message is available, the receiver will typically be blocked
until one arrives. Alternatively, it can return immediately with
an error code.
Sender can operate in one of two modes:
Task Communications- Page 7
EEC682– Spring 2025
in asynchronous send, sender will continue operation
regardless of whether the message was received or not.
Message Synchronization Modes
If no message is available, the receiver will typically be blocked
until one arrives. Alternatively, it can return immediately with
an error code.
Sender can operate in one of two modes:
Task Communications- Page 7
EEC682– Spring 2025
In synchronous send, the sender will be blocked until it
receives an acknowledgment from the receiver.

More Related Content

PPTX
Message passing Programing and MPI.
PPTX
Inter process communication
PDF
MOM - Message Oriented Middleware
PDF
LECTURE 3,4 &5Communication.pdfDistributed systems for computer students both...
PDF
LECTURE 3,4 &5Communication.pdf distributed systems continued
PPTX
Dos unit 2
PPTX
Message and Stream Oriented Communication
Message passing Programing and MPI.
Inter process communication
MOM - Message Oriented Middleware
LECTURE 3,4 &5Communication.pdfDistributed systems for computer students both...
LECTURE 3,4 &5Communication.pdf distributed systems continued
Dos unit 2
Message and Stream Oriented Communication

Similar to Task_Comm_part1_RTS_course_Masters_degree.ppsx (20)

PPT
1 messagepassing-121015032028-phpapp01
PPT
Chapter 6 pc
PDF
Thesis11
PPTX
Inter Process Communication
PDF
Intranet Messaging Project Report -phpapp02
DOCX
Arun prjct dox
PPT
Inter-Process communication in Operating System.ppt
PPTX
Message Queue (MQ) Testing
PPTX
Message Queue (MQ) Testing
PPTX
Message Broker System and RabbitMQ
PPT
Ch4 OS
 
PPT
Process
PPT
PDF
Distributed systems short notes module 1
PPTX
CSC 2205 OS Lecture 08 IPC P-2 on 14-10-2024 ONLINE.pptx
PPT
41_P17CSC104_20201209054563635172951.ppt
PPT
message passing
PPTX
MPI.pptx
ODP
Apache ActiveMQ and Apache Camel
1 messagepassing-121015032028-phpapp01
Chapter 6 pc
Thesis11
Inter Process Communication
Intranet Messaging Project Report -phpapp02
Arun prjct dox
Inter-Process communication in Operating System.ppt
Message Queue (MQ) Testing
Message Queue (MQ) Testing
Message Broker System and RabbitMQ
Ch4 OS
 
Process
Distributed systems short notes module 1
CSC 2205 OS Lecture 08 IPC P-2 on 14-10-2024 ONLINE.pptx
41_P17CSC104_20201209054563635172951.ppt
message passing
MPI.pptx
Apache ActiveMQ and Apache Camel
Ad

Recently uploaded (20)

PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Classroom Observation Tools for Teachers
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Lesson notes of climatology university.
PPTX
Institutional Correction lecture only . . .
PPTX
Cell Types and Its function , kingdom of life
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Complications of Minimal Access Surgery at WLH
PDF
01-Introduction-to-Information-Management.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Presentation on HIE in infants and its manifestations
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Classroom Observation Tools for Teachers
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Microbial disease of the cardiovascular and lymphatic systems
Lesson notes of climatology university.
Institutional Correction lecture only . . .
Cell Types and Its function , kingdom of life
Final Presentation General Medicine 03-08-2024.pptx
A systematic review of self-coping strategies used by university students to ...
Complications of Minimal Access Surgery at WLH
01-Introduction-to-Information-Management.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Presentation on HIE in infants and its manifestations
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Final Presentation General Medicine 03-08-2024.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial diseases, their pathogenesis and prophylaxis
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Ad

Task_Comm_part1_RTS_course_Masters_degree.ppsx

  • 1. Task Communication and Synchronization Task Communications- Page 1 EEC682– Spring 2025 Inter-task communication is an important service that must be provided by any real-time kernel. This communication is needed to:
  • 2. Inter-task communication is an important service that must be provided by any real-time kernel. This communication is needed to: Task Communication and Synchronization Task Communications- Page 1 EEC682– Spring 2025  exchange data between tasks.  avoid problems resulting from access to common resources.  satisfy task precedence constraints.
  • 3. Inter-task communication is an important service that must be provided by any real-time kernel. This communication is needed to: Some communication mechanisms, such as semaphores, require a shared memory among tasks. The method of message passing is more general. Task Communication and Synchronization Task Communications- Page 1 EEC682– Spring 2025  exchange data between tasks.  avoid problems resulting from access to common resources.  satisfy task precedence constraints.
  • 4. Message queues and mailboxes Task Communications- Page 2 EEC682– Spring 2025
  • 5. A minimum set of system calls that handle message passing is the following: send (destination, &message) receive (source, &message) Message queues and mailboxes Task Communications- Page 2 EEC682– Spring 2025
  • 6. A minimum set of system calls that handle message passing is the following: send (destination, &message) receive (source, &message) Message queues and mailboxes A message sent but not yet received is queued by the system. Queue will have a pre-specified maximum capacity. Task Communications- Page 2 EEC682– Spring 2025
  • 7. A minimum set of system calls that handle message passing is the following: send (destination, &message) receive (source, &message) Many design options exist for the message format, addressing methods, synchronization modes, and queuing discipline. All these can affect program timing. Message queues and mailboxes A message sent but not yet received is queued by the system. Queue will have a pre-specified maximum capacity. Task Communications- Page 2 EEC682– Spring 2025
  • 8. Message Format Typically, message is a sequence of bytes with fixed or variable length. Correct interpretation of message content is the responsibility of the communicating tasks, not the operating system. Message queues and mailboxes Task Communications- Page 3 EEC682– Spring 2025
  • 9. Message Format Message queues and mailboxes Task Communications- Page 3 EEC682– Spring 2025 Typically, message is a sequence of bytes with fixed or variable length. Correct interpretation of message content is the responsibility of the communicating tasks, not the operating system.
  • 10. Addressing Method  Direct addressing: using task id. Allows only one-to-one communication. Message Format Typically, message is a sequence of bytes with fixed or variable length. Correct interpretation of message content is the responsibility of the communicating tasks, not the operating system. Message queues and mailboxes Task Communications- Page 3 EEC682– Spring 2025
  • 11. Addressing Method  Direct addressing: using task id. Allows only one-to-one communication.  Indirect addressing : using mailboxes Allows many-to-one, one-to-many or many-to-many modes. Message Format Typically, message is a sequence of bytes with fixed or variable length. Correct interpretation of message content is the responsibility of the communicating tasks, not the operating system. Message queues and mailboxes Task Communications- Page 3 EEC682– Spring 2025
  • 12. Mailbox s R Mailbox s R1 Rn S1 Sm Mailbox R1 Rn Mailbox S1 Sm R One to many One to one Many to one Many to many Message queues and mailboxes Task Communications- Page 4 EEC682– Spring 2025
  • 13. If no message is available, the receiver will typically be blocked until one arrives. Alternatively, it can return immediately with an error code. Task Communications- Page 7 EEC682– Spring 2025
  • 14. Example (1): Mutual exclusion using messages Message queues and mailboxes Using messages, how to control access to resource (e.g. data) that cannot be accessed by more than one task at the same time Task Communications- Page 5 EEC682– Spring 2025
  • 15. Example (1): Mutual exclusion using messages To access resource, any task will use the following sequence: receive(Access_box,&msg); Access_resource; send(Access_box,&msg); Message queues and mailboxes Using messages, how to control access to resource (e.g. data) that cannot be accessed by more than one task at the same time Task Communications- Page 5 EEC682– Spring 2025
  • 16. Example (2): Bounded buffer problem A buffer of size n with reader and writer tasks running at different speeds. Message queues and mailboxes Task Communications- Page 6 EEC682– Spring 2025
  • 17. Example (2): Bounded buffer problem A buffer of size n with reader and writer tasks running at different speeds. Message queues and mailboxes Task Communications- Page 6 EEC682– Spring 2025 buffer writer Reader
  • 18. Example (2): Bounded buffer problem A buffer of size n with reader and writer tasks running at different speeds. Message queues and mailboxes Task Communications- Page 6 EEC682– Spring 2025 Reader task send(writer,’empty’); receive(writer,’full’); Read_data_item;
  • 19. Example (2): Bounded buffer problem A buffer of size n with reader and writer tasks running at different speeds. Message queues and mailboxes Task Communications- Page 6 EEC682– Spring 2025 Reader task receive(reader,’empty’); send(writer,’empty’); receive(writer,’full’); Read_data_item; Writer task Write_data_item; send(reader,’full’);
  • 20. in asynchronous send, sender will continue operation regardless of whether the message was received or not. Message Synchronization Modes If no message is available, the receiver will typically be blocked until one arrives. Alternatively, it can return immediately with an error code. Sender can operate in one of two modes: Task Communications- Page 7 EEC682– Spring 2025
  • 21. in asynchronous send, sender will continue operation regardless of whether the message was received or not. In synchronous send, the sender will be blocked until it receives an acknowledgment from the receiver. Message Synchronization Modes If no message is available, the receiver will typically be blocked until one arrives. Alternatively, it can return immediately with an error code. Sender can operate in one of two modes: Task Communications- Page 7 EEC682– Spring 2025
  • 22. in asynchronous send, sender will continue operation regardless of whether the message was received or not. Message Synchronization Modes If no message is available, the receiver will typically be blocked until one arrives. Alternatively, it can return immediately with an error code. Sender can operate in one of two modes: Task Communications- Page 7 EEC682– Spring 2025 In synchronous send, the sender will be blocked until it receives an acknowledgment from the receiver.