Skip to content
Snippets Groups Projects
Forked from Lehrstuhl für Informatik 4 (Systemsoftware) / manycore / emper
Source project has a limited visibility.
  • Florian Schmaus's avatar
    8d252617
    Fix race condition in io::Stats · 8d252617
    Florian Schmaus authored
    The workerStats std::vector was modified concurrently without being
    synchronized. The Stats are constructed together with IoContext and
    the worker IoContexts are constructed concurrently at the beginning of
    the worker loop. And in the Stats constructor the workerStats
    std::vector was modified by adding the Stats instance that is
    currently being constructed to it.
    
    Turns out, we don't need the workerStats data structure at all. We
    simply provide the global and worker IoContexts to
    io::Stats::printStats(). This results IMHO in a cleaner design of
    printStats() since there is no longer a data structure called
    workerStats, that in fact, not only holds the worker's stats. And
    while we at it, we rename io::Stats::printWorkerStats() to
    io::Stats::printsStats(), since it does, in fact, not only print the
    worker stats, but more or less all related worker stats.
    8d252617
    History
    Fix race condition in io::Stats
    Florian Schmaus authored
    The workerStats std::vector was modified concurrently without being
    synchronized. The Stats are constructed together with IoContext and
    the worker IoContexts are constructed concurrently at the beginning of
    the worker loop. And in the Stats constructor the workerStats
    std::vector was modified by adding the Stats instance that is
    currently being constructed to it.
    
    Turns out, we don't need the workerStats data structure at all. We
    simply provide the global and worker IoContexts to
    io::Stats::printStats(). This results IMHO in a cleaner design of
    printStats() since there is no longer a data structure called
    workerStats, that in fact, not only holds the worker's stats. And
    while we at it, we rename io::Stats::printWorkerStats() to
    io::Stats::printsStats(), since it does, in fact, not only print the
    worker stats, but more or less all related worker stats.