Viability of multithreading on the V5 brain

This year, our group is trying to leverage multithreading to improve performance. We are running a custom aim module that needs to be as fast as possible, and memory efficient. I have 2 questions:
1: How many Cortex A9 CPU cores does the V5 brain have?
2: Are virtual cores supported by the system?
3: How do you determine the memory in use by VexOS at any given time?
Not sure how this should be categorized, i’m willing to change it to something more fitting.

Custom aim modules, both threaded and not, can be written and run on the V5. Your other questions, while interesting perhaps, are likely to distract you from accomplishing your real goal.

4 Likes

If you mean like what is essentially aimbot from FPS shooter games, and you want it to shoot from anywhere in the field, then you really shouldn’t have a problem with memory. You’d be surprised how little memory some things take up: had an int array that was absolutely humongous, as it was supposed to represent pixels, but then it was only 1.4MB of RAM. In my code, it probably takes maybe 300 bytes of RAM, at least in variables. When it comes to the math, it’s almost trivial.

You can multithread if you so choose. But I think that thread would be better spent on PID, Odometry, or any performance intensive code.

Although I’m not sure if that’s what you meant. If you meant something else, please explain.

To both of you, but especially @UvuvwevweOnyetenye , I would urge you to follow Gall’s Law:

A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system

I would add a corollary, that a simple solution that works is better than a complicated system that works.

14 Likes

I was originally attempting to ask was if multithreading was viable. I appreciate the responses that were probably guiding me to a better solution, but I am still asking these 3 questions that have remained unanswered above.
Thank you for the advice, even if it wasn’t what I was looking for.

Yes, this is interlaced with PID and odometry.

To remind you, none of the three questions you asked were, “Is multi-threading viable on V5?” You got vague answers because you seemed unsure of what you wanted. People tried to imagine what you should want and tried to explain why you should want it. I think people have a hard time understanding why you need to know technical specs of the V5 brain to determine if multi-threading is viable.

To answer

But also, yes, many, many teams have multi-threaded without issues. It’s not multi-threading that’s unviable, it’s your idea of how your program needs to do something.

4 Likes

There are two cores, but only one is used for user code, the other is dedicated to vexos functionality, the UI, smartport communication etc.

No

You are not running on an OS like Linux or windows, we run code as more or less a bare metal application with a cooperative scheduler if using VEXcode or as tasks in FreeRTOS if using PROS.

7 Likes