Context-switching mechanism and CHDK - General Discussion and Assistance - CHDK Forum  

Context-switching mechanism and CHDK

  • 1 Replies
Context-switching mechanism and CHDK
« on: 08 / November / 2012, 19:45:04 »
This is a spinoff from the thread about improving camera synch.
For the sake of those who are not knowledgeable (including myself) about the tasks mechanism,it would be useful if 'vnd' and others can explain it.

In RAM, there are two locations that contain the address of taskCreateHook().
They are changed to point to the CHDK version of that function.
Do we know why two RAM addresses are involved ?

taskCreateHook()is called with a pointer to a task control block (TCB) structure.
The members of that structure vary with OS version.
In taskCreateHook()we can log the name of the task.
CHDK can change the address in the TCB of certain tasks to point to its own versions.

Some mechanism exists for running a list of tasks, allocating them time slices and with different priorities.
As I understand it, a task may yield or be paused by a hardware or software interrupt.

It was suggested here that context switching without the cooperation of the individual tasks rather that cooperative multi-tasking is taking place.
Work by reyalp supported this

How does this context-switching mechanism work, what causes a context to be switched ?

'vnd' logged the tasks that run for up to two seconds after the remote switch is released;topic=8312.0;attach=7283

'vnd' said :-
I guess that this particular context switch is triggered by some event or semaphore - outside of IRQ handler.
According to the log it is not aligned to 10ms.

Where is that evident in the above log ?

@vnd, could you explain how you determined the comments in these logs ? :-

I will leave other questions for a later post.


Offline dc3

  • *
  • 6
Re: Context-switching mechanism and CHDK
« Reply #1 on: 08 / November / 2012, 21:39:08 »
« Last Edit: 09 / November / 2012, 03:25:39 by dc3 »


Related Topics

SimplePortal 2.3.6 © 2008-2014, SimplePortal