From 925cbef506b12c33ef139cd7c998dad54041b003 Mon Sep 17 00:00:00 2001 From: Aleksandr Bulyshchenko Date: Sat, 14 Dec 2019 03:24:48 +0200 Subject: [PATCH] 10-ConcurrencyAndSynchronization: Homework task Signed-off-by: Aleksandr Bulyshchenko --- 10-ConcurrencyAndSynchronization/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 10-ConcurrencyAndSynchronization/README.md diff --git a/10-ConcurrencyAndSynchronization/README.md b/10-ConcurrencyAndSynchronization/README.md new file mode 100644 index 0000000..ec249ae --- /dev/null +++ b/10-ConcurrencyAndSynchronization/README.md @@ -0,0 +1,21 @@ +# Concurrency and synchronization + +## Homework + +**(based on MPU6050 driver)** + +_NB_: +Communication with peripheral device on i2c is quite slow asynchronous process +which responsiveness depends on the slave latency and bus utilisation. +Thus generally it's better to be done in background process. + +1. Move interaction with MPU6050 into separate thread. + +2. Protect static data of the driver (`g_mpu6050_data` in the master) +for the case of concurrent access. + +3. Limit interaction with MPU6050 in case of frequent requests: +Define validity interval - if the latest read data is older than this threshold +then new data reading is performed, otherwise previously read data is returned. +(This threshold should be configurable parameter with reasonable default.) +