By default, the main thread is given the highest priority, as it is assumed that most processing will be done in loop(). If you want to use the RTOS to manage threads, you can try lowering the main thread priority in \AppData\Local\Arduino15\packages\realtek\hardware\Ameba1\2.0.10\cores\arduino\main.cpp in order to suit your application.
I am using os priority (OS_PRIORITY_REALTIME) in second thread also ,same as main thread(loop()) ,should’nt wifi_service_thread get cpu (microcontroller) time because of round robin scheduling , when I put wifi service thread in loop() , it gets all the cpu time and other thread does not get any cpu time
I can’t seem to replicate your problem, running the code below, the task outputs appear to be normal, both tasks set at the same priority as main gets called.
12:03:24.706 -> B
12:03:24.706 -> A
12:03:24.706 -> MMM [...abbreviated...] MB
12:03:27.711 -> MA
12:03:27.711 -> MMM [...abbreviated...] MB
12:03:30.713 -> MA
12:03:30.713 -> MMM [...abbreviated...] MB
12:03:33.669 -> MA
12:03:33.669 -> MMM [...abbreviated...] MB
12:03:36.673 -> MA
12:03:36.673 -> MMM [...abbreviated...] MB
12:03:39.679 -> MA
If the priority of thread A and B are set to OS_PRIORITY_REALTIME - 1, neither will get called, which is expected since the main thread is only yielding and not blocking.