Ignore:
Timestamp:
Feb 19, 2021, 1:47:09 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4f762d3
Parents:
b44959f
Message:

New implementation of io based on instance burrowing.
Trying to avoid the unbounded growth of the previous flat combining approach.

File:
1 edited

Legend:

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

    rb44959f r78da4ab  
    4141
    4242//-----------------------------------------------------------------------------
     43// I/O
     44struct cluster;
     45struct $io_context;
     46struct $io_arbiter;
     47
     48struct io_context_params {
     49        int num_entries;
     50};
     51
     52void  ?{}(io_context_params & this);
     53
     54struct io_context {
     55        $io_context * ctx;
     56        cluster * cltr;
     57};
     58void  ?{}(io_context & this, struct cluster & cl);
     59void ^?{}(io_context & this);
     60
     61//-----------------------------------------------------------------------------
    4362// Processor
    4463extern struct cluster * mainCluster;
     
    7897        pthread_t kernel_thread;
    7998
     99        struct {
     100                $io_context * volatile ctx;
     101                volatile bool lock;
     102        } io;
     103
    80104        // Preemption data
    81105        // Node which is added in the discrete event simulaiton
     
    116140
    117141DLISTED_MGD_IMPL_OUT(processor)
    118 
    119 //-----------------------------------------------------------------------------
    120 // I/O
    121 struct __io_data;
    122 
    123 // IO poller user-thread
    124 // Not using the "thread" keyword because we want to control
    125 // more carefully when to start/stop it
    126 struct $io_ctx_thread {
    127         struct __io_data * ring;
    128         single_sem sem;
    129         volatile bool done;
    130         $thread self;
    131 };
    132 
    133 
    134 struct io_context {
    135         $io_ctx_thread thrd;
    136 };
    137 
    138 struct io_context_params {
    139         int num_entries;
    140         int num_ready;
    141         int submit_aff;
    142         bool eager_submits:1;
    143         bool poller_submits:1;
    144         bool poll_submit:1;
    145         bool poll_complete:1;
    146 };
    147 
    148 void  ?{}(io_context_params & this);
    149 
    150 void  ?{}(io_context & this, struct cluster & cl);
    151 void  ?{}(io_context & this, struct cluster & cl, const io_context_params & params);
    152 void ^?{}(io_context & this);
    153 
    154 struct io_cancellation {
    155         __u64 target;
    156 };
    157 
    158 static inline void  ?{}(io_cancellation & this) { this.target = -1u; }
    159 static inline void ^?{}(io_cancellation &) {}
    160 bool cancel(io_cancellation & this);
    161142
    162143//-----------------------------------------------------------------------------
     
    244225
    245226        struct {
    246                 io_context * ctxs;
    247                 unsigned cnt;
     227                $io_arbiter * arbiter;
     228                io_context_params params;
    248229        } io;
    249230
Note: See TracChangeset for help on using the changeset viewer.