Ignore:
Timestamp:
Jan 4, 2018, 10:05:47 AM (4 years ago)
Author:
alain
Message:

Improve sys_exec.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/thread.h

    r409 r416  
    7272#define THREAD_FLAG_JOIN_DONE    0x0002  /*! Parent thread made a join                */
    7373#define THREAD_FLAG_SCHED        0x0004  /*! Scheduling required for this thread      */
    74 #define THREAD_FLAG_SIGNAL       0x0004  /*! Acknowledge of descheduling required     */
     74#define THREAD_FLAG_REQ_ACK      0x0008  /*! Acknowledge required from scheduler      */
     75#define THREAD_FLAG_REQ_DELETE   0x0010  /*! Destruction required by scheduler        */
    7576
    7677/***************************************************************************************
     
    119120 * - The TRDID 16 MSB bits contain the CXY of cluster containing the thread.
    120121 * - The LTID is used to index the th_tbl[] array in the local process descriptor.
    121  * This TRDID is computed by the process_register_thread() function, when the user
     122 _* This TRDID is computed by the process_register_thread() function, when the user
    122123 * thread is registered in the local copy of the process descriptor.
    123124 *
     
    153154    xptr_t              join_xp;         /*! extended pointer on joining thread       */
    154155
    155     uint32_t          * sig_rsp_count;   /*! pointer on signal response counter       */
     156    uint32_t          * ack_rsp_count;   /*! pointer on acknowledge response counter  */
    156157
    157158        intptr_t            u_stack_base;    /*! user stack base address                  */
     
    345346
    346347/***************************************************************************************
    347  * This function is used by a killer thread running in the same cluster as a target
    348  * thread to request the scheduler of the target to call the thread_handle_signal()
    349  * at the next context switch, to confirm that the target thread is blocked and
    350  * not currently running. This function executes atomically the following actions :
    351  * - it set the sig_pending flag in the target scheduler descriptor.
    352  * - it set the SIG flag in the "flags" field of the target thread descriptor.
     348 * This function is used by a "blocker" thread running in the same cluster as a "target"
     349 * thread to request the scheduler of the target thread to acknowledge that the target
     350 * thread is blocked and not running, at the next context switch.
     351 * This function executes atomically the following actions :
     352 * - it set the request_pending boolean in the target scheduler descriptor.
     353 * - it set the REQ_ACK flag in the "flags" field of the target thread descriptor.
    353354 * - It registers the responses counter pointer in the target thread descriptor.
    354  * The sig_pending flag is handled as a set/reset flip-flop by the killer thread
    355  * and by the target scheduler.
     355 * The request_pending flag is handled as a set/reset flip-flop by the "blocker" thread
     356 * and by the "target" scheduler.
    356357 ***************************************************************************************
    357358 * @ target        : local pointer on target thread.
    358  * @ sig_rsp_count : local pointer on responses counter.
    359  **************************************************************************************/
    360 void thread_set_signal( thread_t * thread,
    361                         uint32_t * sig_rsp_count );
    362 
    363 /***************************************************************************************
    364  * This function is used by the sched_handle_signal() function executed by a scheduler
    365  * to reset a pending signal in both a target <thread> descriptor, and in the target
    366  * thread scheduler.
    367  ***************************************************************************************
    368  * @ thread    : local pointer on target thread.
    369  **************************************************************************************/
    370 void thread_reset_signal( thread_t * thread );
     359 * @ ack_rsp_count : local pointer on responses counter.
     360 **************************************************************************************/
     361void thread_set_req_ack( thread_t * target,
     362                         uint32_t * ack_rsp_count );
     363
     364/***************************************************************************************
     365 * This function is used by the sched_handle_signal() function executed by the
     366 * scheduler of a "target" thread to reset a "blocked not running" acknowledge request
     367 * in both the target thread descriptor, and in the target  thread scheduler.
     368 ***************************************************************************************
     369 * @ target    : local pointer on target thread.
     370 **************************************************************************************/
     371void thread_reset_req_ack( thread_t * target );
    371372
    372373/***************************************************************************************
     
    390391 * If not, the client thread must use the RPC_THREAD_KILL.
    391392 * - When the killer thread is running on the same core as the target thread,
    392  *   This function simply detach the target thread from the scheduler,
    393  *   detach it from the parent thread if it is attached, detach it from the
    394  *   local process descriptor, and rrleases all memory allocated to the thread.
    395  * - When the killer thread is running on a different core than the target thread
    396  *   The killer send a signal to the target thread scheduler requesting this
    397  *   scheduler to confirm that the target thread is blocked and not running.
    398  *   Then, it executes the same actions as described above.
     393 *   this function simply set the BLOCKED_ GLOBAL bit and the REQ_DELETE flag
     394 *   in the target thread descriptor and return.
     395 * - When the killer thread is running on a different core than the target thread,
     396 *   the killer set the BLOCKED_GLOBAL bit and the REQ_ACK flag in target  thread,
     397 *   to ask the scheduler to confirm that the target is blocked and not running.
     398 *   Then, it set the REQ_DELETE flag in the target thread and return.
     399 * In both cases, the actual target thread destruction is done by the scheduler
     400 * at the next scheduling point.
    399401 ***************************************************************************************
    400402 * @ thread   : local pointer on the target thread.
Note: See TracChangeset for help on using the changeset viewer.