Regarding taskLock() and tasUnlock() - VxWorks

This is a discussion on Regarding taskLock() and tasUnlock() - VxWorks ; Hi, I am a newbie to VxWorks. I just wanted to know how the kernel is able to lock the task context switching when a task under execution calls the routine taskLock(). I have studied in many books saying the ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Regarding taskLock() and tasUnlock()

  1. Regarding taskLock() and tasUnlock()

    Hi,

    I am a newbie to VxWorks. I just wanted to know how the kernel is able
    to lock the task context switching when a task under execution calls
    the routine taskLock(). I have studied in many books saying the "when
    taskLock() is called the scheduler will be disabled". I have some
    doubts regarding this statement.

    1. When a scheduler is explicitly blocked because of calling
    taskLock(), What is system state when the task that called taskLock()
    routine blocks for some resource. In this case the system is dead
    (because as scheduler is blocked, who will schedule other task which
    owned the resource ????).

    2. When I saw the code of taskLock() (library files given in
    workbench), there is no such a concept called "Disabling the
    scheduler". There they are just incrementing the preemption lock count
    variable "lockCnt" which is part of task's TCB. my doubt is how the
    kernel able to disable the task context switch with the help of this
    variable. will the scheduler check the status of this variable before
    the context switch happens ??? (means here scheduler is not disabled,
    but scheduler able to invoke when high priority task is made ready,
    but it is not permitting to task context switch because of lockCnt
    variable set in TCB of current executing task).

    3. And Assume that kernel some how able to lock context switch with
    the help of "lockCnt" variable. So in taskUnlock() If i can decrement
    the "lockCnt" variable it is sufficient (which is opposed to increment
    of "lockCnt" variable in taskLock() function). But in the
    implementation inaddition to this there are some more manipulations
    related to Pending Queues.
    I am not able to understand what those queues are. R they holds any
    information related to tasks, which are made ready but not given
    chance to execute during the taskLock().

    Can anybody explain what is actually going on.
    Please Let me know If I'm wrong at understaning the above.

    Thanks in Advance
    Nagarjuna.

  2. Re: Regarding taskLock() and tasUnlock()

    e.nagarjunareddy@gmail.com wrote:

    >Hi,
    >
    >I am a newbie to VxWorks. I just wanted to know how the kernel is able
    >to lock the task context switching when a task under execution calls
    >the routine taskLock(). I have studied in many books saying the "when
    >taskLock() is called the scheduler will be disabled". I have some
    >doubts regarding this statement.
    >


    Read the manual page for taskLock. It works as described.


  3. Re: Regarding taskLock() and tasUnlock()

    1. taskLock() prevents a higher priority task from getting the CPU
    provided that the locked task is in a ready state. If it blocks,
    scheduling must pass to the highest priority ready task.

    2. Yes, the scheduler checks the status of this variable before
    attempting a context switch. If the current task is in a ready state,
    a new task will not be swapped in. See windALib.s. The variable has
    to be in the TCB as it is a property of the task, and not of the
    system.

    3. I can not remember the purpose of the queues.

    pcm

    e.nagarjunare...@gmail.com wrote:
    > Hi,
    >
    > I am a newbie to VxWorks. I just wanted to know how the kernel is able
    > to lock the task context switching when a task under execution calls
    > the routine taskLock(). I have studied in many books saying the "when
    > taskLock() is called the scheduler will be disabled". I have some
    > doubts regarding this statement.
    >
    > 1. When a scheduler is explicitly blocked because of calling
    > taskLock(), What is system state when the task that called taskLock()
    > routine blocks for some resource. In this case the system is dead
    > (because as scheduler is blocked, who will schedule other task which
    > owned the resource ????).
    >
    > 2. When I saw the code of taskLock() (library files given in
    > workbench), there is no such a concept called "Disabling the
    > scheduler". There they are just incrementing the preemption lock count
    > variable "lockCnt" which is part of task's TCB. my doubt is how the
    > kernel able to disable the task context switch with the help of this
    > variable. will the scheduler check the status of this variable before
    > the context switch happens ??? (means here scheduler is not disabled,
    > but scheduler able to invoke when high priority task is made ready,
    > but it is not permitting to task context switch because of lockCnt
    > variable set in TCB of current executing task).
    >
    > 3. And Assume that kernel some how able to lock context switch with
    > the help of "lockCnt" variable. So in taskUnlock() If i can decrement
    > the "lockCnt" variable it is sufficient (which is opposed to increment
    > of "lockCnt" variable in taskLock() function). But in the
    > implementation inaddition to this there are some more manipulations
    > related to Pending Queues.
    > I am not able to understand what those queues are. R they holds any
    > information related to tasks, which are made ready but not given
    > chance to execute during the taskLock().
    >
    > Can anybody explain what is actually going on.
    > Please Let me know If I'm wrong at understaning the above.
    >
    > Thanks in Advance
    > Nagarjuna.


+ Reply to Thread