Changes in / [4ae78c1:3100754]


Ignore:
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/cycle.cfa

    r4ae78c1 r3100754  
    6262                }
    6363
    64                 printf("Duration (ms)       : %'ld\n", (end - start)`ms);
    65                 printf("Number of processors: %'d\n", nprocs);
    66                 printf("Number of threads   : %'d\n", tthreads);
    67                 printf("Cycle size (# thrds): %'d\n", ring_size);
     64                printf("Took %'ld ms\n", (end - start)`ms);
    6865                printf("Yields per second   : %'18.2lf\n", ((double)global_counter) / (end - start)`s);
    6966                printf("ns per yields       : %'18.2lf\n", ((double)(end - start)`ns) / global_counter);
  • benchmark/readyQ/cycle.go

    r4ae78c1 r3100754  
    126126
    127127        p := message.NewPrinter(language.English)
    128         p.Printf("Duration (ms)       : %f\n", delta.Seconds());
    129         p.Printf("Number of processors: %d\n", nprocs);
    130         p.Printf("Number of threads   : %d\n", tthreads);
    131         p.Printf("Cycle size (# thrds): %d\n", ring_size);
     128        p.Printf("Took %f ms\n", delta.Seconds())
    132129        p.Printf("Yields per second   : %18.2f\n", float64(global_counter) / delta.Seconds())
    133130        p.Printf("ns per yields       : %18.2f\n", float64(delta.Nanoseconds()) / float64(global_counter))
  • libcfa/src/concurrency/invoke.h

    r4ae78c1 r3100754  
    157157
    158158                // current execution status for coroutine
    159                 // Possible values are:
    160                 //    - TICKET_BLOCKED (-1) thread is blocked
    161                 //    - TICKET_RUNNING ( 0) thread is running
    162                 //    - TICKET_UNBLOCK ( 1) thread should ignore next block
    163159                volatile int ticket;
    164160                enum __Coroutine_State state:8;
  • libcfa/src/concurrency/io/setup.cfa

    r4ae78c1 r3100754  
    250250                                        // Fixup the thread state
    251251                                        thrd.state = Blocked;
    252                                         thrd.ticket = TICKET_BLOCKED;
     252                                        thrd.ticket = 0;
    253253                                        thrd.preempted = __NO_PREEMPTION;
    254254
  • libcfa/src/concurrency/kernel.cfa

    r4ae78c1 r3100754  
    299299                int old_ticket = __atomic_fetch_sub(&thrd_dst->ticket, 1, __ATOMIC_SEQ_CST);
    300300                switch(old_ticket) {
    301                         case TICKET_RUNNING:
     301                        case 1:
    302302                                // This is case 1, the regular case, nothing more is needed
    303303                                break RUNNING;
    304                         case TICKET_UNBLOCK:
     304                        case 2:
    305305                                // This is case 2, the racy case, someone tried to run this thread before it finished blocking
    306306                                // In this case, just run it again.
     
    410410        int old_ticket = __atomic_fetch_add(&thrd->ticket, 1, __ATOMIC_SEQ_CST);
    411411        switch(old_ticket) {
    412                 case TICKET_RUNNING:
     412                case 1:
    413413                        // Wake won the race, the thread will reschedule/rerun itself
    414414                        break;
    415                 case TICKET_BLOCKED:
     415                case 0:
    416416                        /* paranoid */ verify( ! thrd->preempted != __NO_PREEMPTION );
    417417                        /* paranoid */ verify( thrd->state == Blocked );
     
    422422                default:
    423423                        // This makes no sense, something is wrong abort
    424                         abort("Thread %p (%s) has mismatch park/unpark\n", thrd, thrd->self_cor.name);
     424                        abort();
    425425        }
    426426}
  • libcfa/src/concurrency/kernel/startup.cfa

    r4ae78c1 r3100754  
    441441
    442442static void ?{}( $thread & this, current_stack_info_t * info) with( this ) {
    443         ticket = TICKET_RUNNING;
     443        ticket = 1;
    444444        state = Start;
    445445        self_cor{ info };
  • libcfa/src/concurrency/kernel_private.hfa

    r4ae78c1 r3100754  
    6565// KERNEL ONLY unpark with out disabling interrupts
    6666void __unpark( struct __processor_id_t *, $thread * thrd );
    67 
    68 #define TICKET_BLOCKED (-1) // thread is blocked
    69 #define TICKET_RUNNING ( 0) // thread is running
    70 #define TICKET_UNBLOCK ( 1) // thread should ignore next block
    7167
    7268static inline bool __post(single_sem & this, struct __processor_id_t * id) {
  • libcfa/src/concurrency/thread.cfa

    r4ae78c1 r3100754  
    2929        context{ 0p, 0p };
    3030        self_cor{ name, storage, storageSize };
    31         ticket = TICKET_RUNNING;
     31        ticket = 1;
    3232        state = Start;
    3333        preempted = __NO_PREEMPTION;
Note: See TracChangeset for help on using the changeset viewer.