Task management in OpenCPU

Is it possible to manually schedule task or in general doing task management (creation, killing etc) in OpenCPU?

NO for OpenCPU, YES for ThreadX
M66, MC60/M OpenCPU tasks is pre-defined in custom_task_cfg.h
you can only enable/disable task (once)

Thnx mate, one more thing, is the names (proc_subtask & subtask id) are fixed?

this struct is “auto” enumerated for taskID 0 or 1 from beginig, you can print proc_task argument to see

proc_main_task, is application main task
proc_reserved1, for RIL (user hidden) { if you disable this two tasks you can not use RIL }
proc_reserved2, for RIL helper (user hidden)

proc_subtaskX is user-ware sub tasks

1 Like

I have linked question.
How task scheduling works in OpenCPU ? There is any preemptive algorithms, any different task priorities and so on ?
Unfortunately, official guide even doesn’t mention, what RTOS used…

I did a small experiment. We have two tasks, and first sends to second some message through Ql_OS_SendMessage.
It looks like second task runs only when first paused (for example, calls Ql_OS_GetMessage()).
It is always correct, or in any circumstances second task can interrupt first task ?

RTOS: nucleus(M66, MC60), FreeRTOS (BC66)

if tasks priorities are equal - you must block task to switch other…
Ql_sleep() blocks too

Georgi, thanks!

It looks like priorities for all user tasks are equal (and have values DEFAULT_VALUE1 or DEFAULT_VALUE2 :wink: )

And do you know message queue length ? Or it dynamically get additional space from heap ?
Also anyone have troubles with heap memory fragmentation ? (sorry, i dont have any expirence with small systems with MMU).

yep :slight_smile: DEFAULT_VALUE1 или DEFAULT_VALUE2 (stack and prio)

task queue length is const and a little ( I do not remember … ask Quectel )

fragmentation: this Mediatek SDK is older than Android and probably the most used SDK for gsm phones and modules … for user-ware use, I didn’t notice any problems

not have MMU…

BG9x ThreadX modules have MMU

MC60’s message queue length is up to 30. Thanks!