apsun / loliOS

Lightweight & operational Linux-inspired OS.
33 stars 1 forks source link

RTC + concurrent reads = ? #10

Closed apsun closed 7 years ago

apsun commented 7 years ago

This may or may not be a problem, but what happens if we have 2 processes who call rtc_read at the same time (one process is pre-empted while waiting for the next tick, and the other also calls read)? If the flag is set to 0 between stopping process 1 and starting process 2, the first process will miss a tick.

This probably isn't a huge issue, but it would be nice to virtualize the RTC for multple processes which should fix this problem. Each process has its own interrupt_occurred flag, and on tick all of them will be reset to 0. Also each file descriptor should have its own virtual RTC frequency.

apsun commented 7 years ago

Fixed in r13508.