Changes in / [9042795:ed8a0d2]


Ignore:
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r9042795 red8a0d2  
    371371"""
    372372
    373         def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com, ajbeach@edu.uwaterloo.ca"
     373        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
    374374
    375375        //send email notification
  • src/benchmark/CorCtxSwitch.c

    r9042795 red8a0d2  
    2323} // Time
    2424
    25 coroutine GreatSuspender {};
     25struct GreatSuspender {
     26        coroutine_desc __cor;
     27};
     28
     29DECL_COROUTINE(GreatSuspender);
    2630
    2731void ?{}( GreatSuspender * this ) {
  • src/benchmark/bench.c

    r9042795 red8a0d2  
    8686//=======================================
    8787
    88 coroutine CoroutineDummy {};
     88struct CoroutineDummy { coroutine_desc __cor; };
     89DECL_COROUTINE(CoroutineDummy);
    8990void main(CoroutineDummy * this) {}
    9091
     
    116117}
    117118
    118 coroutine CoroutineResume {
     119struct CoroutineResume {
    119120    int N;
     121    coroutine_desc __cor;
    120122};
     123
     124DECL_COROUTINE(CoroutineResume);
    121125
    122126void ?{}(CoroutineResume* this, int N) {
     
    146150//=======================================
    147151
    148 thread ThreadDummy {};
     152struct ThreadDummy { thread_desc __thrd; };
     153DECL_THREAD(ThreadDummy);
    149154void main(ThreadDummy * this) {}
    150155
     
    172177}
    173178
    174 thread ContextSwitch {
     179struct ContextSwitch {
    175180    int N;
    176181    long long result;
     182    thread_desc __thrd;
    177183};
     184
     185DECL_THREAD(ContextSwitch);
    178186
    179187void main(ContextSwitch * this) {   
     
    233241        DynamicTaskCreateDelete( NoOfTimes );
    234242        {
    235                 ContextSwitch dummy = { (int)NoOfTimes };               // context switch
     243                scoped(ContextSwitch) dummy = { (int)NoOfTimes };               // context switch
    236244        }
    237245        sout | "\t" | endl;
  • src/benchmark/csv-data.c

    r9042795 red8a0d2  
    2525} // Time
    2626
    27 coroutine GreatSuspender {};
     27struct GreatSuspender {
     28        coroutine_desc __cor;
     29};
     30
     31DECL_COROUTINE(GreatSuspender);
    2832
    2933void ?{}( GreatSuspender * this ) {
  • src/libcfa/concurrency/monitor.c

    r9042795 red8a0d2  
    1717#include "monitor"
    1818
    19 #include <stdlib>
    20 
    2119#include "kernel_private.h"
    2220#include "libhdr.h"
     
    132130        this_thread()->current_monitors      = this->prev_mntrs;
    133131        this_thread()->current_monitor_count = this->prev_count;
    134 }
    135 
    136 void debug_break() __attribute__(( noinline ))
    137 {
    138        
    139132}
    140133
     
    178171
    179172        //Find the next thread(s) to run
    180         unsigned short thread_count = 0;
     173        unsigned short thread_count = count;
    181174        thread_desc * threads[ count ];
    182         for(int i = 0; i < count; i++) {
    183                 threads[i] = 0;
    184         }
    185 
    186         debug_break();
    187175
    188176        for( int i = 0; i < count; i++) {
    189177                thread_desc * new_owner = next_thread( this->monitors[i] );
    190                 thread_count = insert_unique( threads, thread_count, new_owner );
    191         }
    192 
    193         debug_break();
     178                thread_count = insert_unique( threads, i, new_owner );
     179        }
    194180
    195181        LIB_DEBUG_PRINT_SAFE("Will unblock: ");
     
    353339                LIB_DEBUG_PRINT_SAFE("Branding\n");
    354340                assertf( thrd->current_monitors != NULL, "No current monitor to brand condition", thrd->current_monitors );
     341                this->monitors = thrd->current_monitors;
    355342                this->monitor_count = thrd->current_monitor_count;
    356 
    357                 this->monitors = malloc( this->monitor_count * sizeof( *this->monitors ) );
    358                 for( int i = 0; i < this->monitor_count; i++ ) {
    359                         this->monitors[i] = thrd->current_monitors[i];
    360                 }
    361343        }
    362344}
    363345
    364346static inline unsigned short insert_unique( thread_desc ** thrds, unsigned short end, thread_desc * val ) {
    365         if( !val ) return end;
    366 
    367         for(int i = 0; i <= end; i++) {
     347        for(int i = 0; i < end; i++) {
    368348                if( thrds[i] == val ) return end;
    369349        }
  • src/tests/.expect/concurrent/sched-int-multi.txt

    r9042795 red8a0d2  
    1 1000
    2 2000
    3 3000
    4 4000
    5 5000
    6 6000
    7 7000
    8 8000
    9 9000
    10 10000
    11 11000
    12 12000
    13 13000
    14 14000
    15 15000
    16 16000
    17 17000
    18 18000
    19 19000
    20 20000
    21 21000
    22 22000
    23 23000
    24 24000
    25 25000
    26 26000
    27 27000
    28 28000
    29 29000
    30 30000
    31 31000
    32 32000
    33 33000
    34 34000
    35 35000
    36 36000
    37 37000
    38 38000
    39 39000
    40 40000
    41 41000
    42 42000
    43 43000
    44 44000
    45 45000
    46 46000
    47 47000
    48 48000
    49 49000
    50 50000
    51 51000
    52 52000
    53 53000
    54 54000
    55 55000
    56 56000
    57 57000
    58 58000
    59 59000
    60 60000
    61 61000
    62 62000
    63 63000
    64 64000
    65 65000
    66 66000
    67 67000
    68 68000
    69 69000
    70 70000
    71 71000
    72 72000
    73 73000
    74 74000
    75 75000
    76 76000
    77 77000
    78 78000
    79 79000
    80 80000
    81 81000
    82 82000
    83 83000
    84 84000
    85 85000
    86 86000
    87 87000
    88 88000
    89 89000
    90 90000
    91 91000
    92 92000
    93 93000
    94 94000
    95 95000
    96 96000
    97 97000
    98 98000
    99 99000
    100 100000
     1Waiting All
     2Entering A
     3Entering A & B
     4Signal
     5Leaving  A & B
     6Leaving  A
     7Done waiting
  • src/tests/sched-int-multi.c

    r9042795 red8a0d2  
    44#include <thread>
    55
    6 enum state_t { WAIT, SIGNAL, BARGE };
    7 
    86monitor global_t {};
    97
    10 monitor global_data_t {
    11         bool done;
    12         int counter;
    13         state_t state;
    14 };
    15 
    16 void ?{} ( global_data_t * this ) {
    17         this->done = false;
    18         this->counter = 0;
    19         this->state = BARGE;
    20 }
    21 
    22 void ^?{} ( global_data_t * this ) {}
    23 
     8global_t globalB;
    249global_t globalA;
    25 global_t globalB;
    26 global_data_t globalC;
    2710
    2811condition cond;
    2912
    30 thread Threads {};
     13thread Signalee {};
     14thread Signaler {};
    3115
    32 bool logicC( global_t * mutex a, global_t * mutex b, global_data_t * mutex c ) {
    33         c->counter++;
     16void signalee_action( global_t * mutex a, global_t * mutex b ) {
     17        sout | "Waiting All" | endl;
     18        wait( &cond );
     19        sout | "Done waiting" | endl;
     20}
    3421
    35         int action = c->counter % 10;
     22void main( Signalee* this ) {
     23        signalee_action( &globalA, &globalB );
     24}
    3625
    37         if( action == 1 || action == 3 ) {
    38                 if(c->state != BARGE) {
    39                         sout | "ERROR Mutual exclusion is inconsistent for wait" | endl;
    40                         abort();
    41                 }
     26void signaler_action_inner( global_t * mutex a, global_t * mutex b ) {
     27        sout | "Entering A & B" | endl;
     28        sout | "Signal" | endl;
     29        signal( &cond );
     30        sout | "Leaving  A & B" | endl;
     31}
    4232
    43                 c->state = WAIT;
    44                 wait( &cond );
     33void signaler_action( global_t * mutex a, global_t * b ) {
     34        sout | "Entering A" | endl;
     35        signaler_action_inner( a, b );
     36        sout | "Leaving  A" | endl;
     37}
    4538
    46                 if(c->state != SIGNAL) {
    47                         sout | "ERROR Barging detected" | endl;
    48                         abort();
    49                 }
    50         }
    51         else if( action == 6 ) {
    52                 if(c->state != BARGE) {
    53                         sout | "ERROR Mutual exclusion is inconsistent for signal" | endl;
    54                         abort();
    55                 }
    56 
    57                 c->state = SIGNAL;
    58 
    59                 signal( &cond );
    60                 signal( &cond );
    61         }
    62         else {
    63                 c->state = BARGE;
     39void main( Signaler* this ) {
     40        for(int i = 0; i < 10_000; i++) {
     41                asm volatile ("" : : : "memory");
    6442        }
    6543
    66         if( (c->counter % 1000) == 0 ) sout | c->counter | endl;
    67         if( c->counter == 100_000 ) c->done = true;
    68         return !c->done;
    69 }
    70 
    71 bool logicB( global_t * mutex a, global_t * mutex b ) {
    72         return logicC(a, b, &globalC);
    73 }
    74 
    75 bool logicA( global_t * mutex a ) {
    76         return logicB(a, &globalB);
    77 }
    78 
    79 void main( Threads* this ) {
    80         while( logicA(&globalA) ) { yield(); };
     44        signaler_action( &globalA, &globalB );
    8145}
    8246
    8347int main(int argc, char* argv[]) {
    84         processor p[3];
     48        processor p;
    8549        {
    86                 Threads t[20];
     50                Signalee a;
     51                Signaler b;
    8752        }
    8853}
Note: See TracChangeset for help on using the changeset viewer.