Ignore:
Timestamp:
Jun 23, 2020, 4:42:58 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
de917da3
Parents:
b232745
Message:
  • Moved snzi and subqueues outside of ready_queue.cfa.
  • Added random.hfa with multiple prng.
  • Minor optimizations to ready-queue
  • Stats now track number of local pops( bias pops )
  • Fixed stats for io
  • Fixed calculaton of nprocessors
  • Fixed IO to work with new ready-queue
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.cfa

    rb232745 r13c5e19  
    229229static void * __invoke_processor(void * arg);
    230230
    231 void ?{}(processor & this, const char name[], cluster & cltr) with( this ) {
     231void ?{}(processor & this, const char name[], cluster & _cltr) with( this ) {
    232232        this.name = name;
    233         this.cltr = &cltr;
     233        this.cltr = &_cltr;
    234234        id = -1u;
    235235        terminated{ 0 };
     
    245245
    246246        this.stack = __create_pthread( &this.kernel_thread, __invoke_processor, (void *)&this );
     247        __atomic_fetch_add( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
    247248
    248249        __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this);
     
    264265
    265266        free( this.stack );
     267
     268        __atomic_fetch_sub( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
    266269}
    267270
     
    269272        this.name = name;
    270273        this.preemption_rate = preemption_rate;
     274        this.nprocessors = 0;
    271275        ready_queue{};
    272276
     
    324328        }
    325329
    326         doregister(this->cltr, this);
    327 
    328330        {
    329331                // Setup preemption data
     
    357359                __cfadbg_print_safe(runtime_core, "Kernel : core %p stopping\n", this);
    358360        }
    359 
    360         unregister(this->cltr, this);
    361361
    362362        V( this->terminated );
     
    845845                runner{ &this };
    846846                __cfadbg_print_safe(runtime_core, "Kernel : constructed main processor context %p\n", &runner);
     847
     848                __atomic_fetch_add( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
    847849        }
    848850
     
    918920        void ^?{}(processor & this) with( this ){
    919921                /* paranoid */ verify( this.do_terminate == true );
     922                __atomic_fetch_sub( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
    920923                __cfaabi_dbg_print_safe("Kernel : destroyed main processor context %p\n", &runner);
    921924        }
     
    11501153}
    11511154
    1152 void doregister( cluster * cltr, processor * proc ) {
    1153         // lock      (cltr->idle_lock __cfaabi_dbg_ctx2);
    1154         // cltr->nprocessors += 1;
    1155         // push_front(cltr->procs, *proc);
    1156         // unlock    (cltr->idle_lock);
    1157 }
    1158 
    1159 void unregister( cluster * cltr, processor * proc ) {
    1160         // lock  (cltr->idle_lock __cfaabi_dbg_ctx2);
    1161         // remove(cltr->procs, *proc );
    1162         // cltr->nprocessors -= 1;
    1163         // unlock(cltr->idle_lock);
    1164 }
    1165 
    11661155//-----------------------------------------------------------------------------
    11671156// Debug
Note: See TracChangeset for help on using the changeset viewer.