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

Context-switching mechanism and CHDK

  • 1 Replies
  • 2829 Views
Context-switching mechanism and CHDK
« on: 08 / November / 2012, 19:45:04 »
Advertisements
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 http://chdk.setepontos.com/index.php?topic=8312.msg87897#msg87897 that context switching without the cooperation of the individual tasks rather that cooperative multi-tasking is taking place.
Work by reyalp supported this http://chdk.setepontos.com/index.php?topic=8312.msg87942#msg87942

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
http://chdk.setepontos.com/index.php?action=dlattach;topic=8312.0;attach=7283

'vnd' said :-
Quote
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 ? :-

http://chdk.setepontos.com/index.php?topic=8312.msg92623#msg92623

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 »
Deleted
« Last Edit: 09 / November / 2012, 03:25:39 by dc3 »

 

Related Topics


SimplePortal © 2008-2014, SimplePortal