Skip to content

Real-Time Operating Systems (RTOS) - Managing of 4 threads using Semaphores and Priority Ceiling Policy

Notifications You must be signed in to change notification settings

simone-contorno/rtos-priority-ceiling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Real Time Operating Systems - 4 threads managed with semaphores (Priority Ceiling Policy)

Author: Simone Contorno


Introduction

An overview of this program function.
Go to Introduction

How it works

A rapid description of how the program works.
Go to How it works

Installation and Execution

How install and run this program in Linux.
Go to Installation and Execution

Conclusion

Conclusion.
Go to Conclusion

Introduction

This program manage 4 threads, using semaphores and Priority Ceiling Policy, in order to:

  • Task 1_1 write something into the variable T1T2, Task 2_1 read from this one.
  • Task 1_2 write something into the variable T1T4, Task 4 read from this one.
  • Task 2_2 write something into the variable T2T3, Task 3 read from this one.

How it works

To do this, the following steps have been followed:

  • Set the thread with the lowest period as the first one and the thread with the highest period as the last one.
  • Compute the WCET (Worst Case Execution Time) for each task.
  • Compute the Blocking Time for each task.
  • Check if the schedulability if feasible or not computing the Utilization factor (U) and the Utilization factor lower upper bound (Ulub).
  • Set attributes (including scheduling policy and priority) of each task.
  • Set attributes (including Priority Ceiling) of each semaphore.
  • Compute the next arrival time of each task.
  • Create threads and wait for all of them.
  • When these terminates, print missed deadlines of each task and terminate the program.

Now, let's notice what each Thread does:

  • Tread 1:
    • Lock the first semaphore, execute Task 1_1 and unlock the semaphore;
    • Lock the second semaphore, execute Task 1_2 and unlock the semaphore;
    • Sleep until the next arrival time and compute the next one.
  • Tread 2:
    • Lock the third semaphore, execute Task 2_2 and unlock the semaphore;
    • Lock the first semaphore, execute Task 2_1 and unlock the semaphore;
    • Sleep until the next arrival time and compute the next one.
  • Tread 3:
    • Lock the third semaphore, execute Task 3 and unlock the semaphore;
    • Sleep until the next arrival time and compute the next one.
  • Tread 4:
    • Lock the second semaphore, execute Task 4 and unlock the semaphore;
    • Sleep until the next arrival time and compute the next one.

Installation and Execution

Download the repository:

git clone https://github.com/simone-contorno/rtos-priority-ceiling

Now, to run 'rtos_priority_ceiling' type:

./exec.sh

Conclusion

Thanks to have read this file, i hope it was clear and interesting.

About

Real-Time Operating Systems (RTOS) - Managing of 4 threads using Semaphores and Priority Ceiling Policy

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published