Page 1 of 1

Threads -parallel process-

Posted: Thu Jan 07, 2010 3:31 am
by elnanni
Ok, so I want to draw something in the touch screen, and it takes a while, but at the same time I want to draw something else in the other screen, so, I know I can do both drawings at the same time, but I don't want to mix drawings, so, is there a way to do parallel processing in the DS?? If not, I think I can try to do it by using pointers to functions :S, any idea :S??

Re: Threads -parallel process-

Posted: Thu Jan 07, 2010 4:25 am
by elhobbs
Threads are not supported with libnds. You are probably better off breaking the large job into small chunks and do a little bit at a time. Though it is possible to map VRAM banks C and D to the arm7 processor it is probably not worth the effort.

Re: Threads -parallel process-

Posted: Thu Jan 07, 2010 12:44 pm
by StevenH
Actually there is a proof of concept code that WolfgangSt wrote that uses fibers to do parallel processing, but the work involved in taking it past the PoC stage is a little too much for most of the usefull things that you need fibers for (also the overhead on the stack, etc is sometimes a little too much for the DS's lack of MMU).

The best way, and the only way IMO, would be to mix the drawings and do a part of the drawings on each screen. I know that the official SDK has threads in them (This knowledge is from reading the libdual* source code BTW not any official docs) but talking to WinterMute at the time about it (even when the fiber test app was floating about) the limited DS stack and lack of support for hardware memory management means that a lot of the tools and features that you take for granted on a PC just does not exist on the DS.


* libdual was a rebranding of a leaked copy of an early version of the offical sdk that a few of us downloaded as it was advertised on the gbadev forums as the "Official Nintendo Homebrew SDK" and "libnds beater". It opened my eyes on how much thought had went into the official SDK, and how much work has went into libnds. The site has since been taken down after it being reported to Nintendo.

Re: Threads -parallel process-

Posted: Fri Jan 08, 2010 12:53 am
by WinterMute
It really depends on what exactly it is you want to do, what's being drawn on the touch screen and what do you want to draw on the other screen?

Neither fibers nor threads are parallel processing, they're both methods of task switching. The DS does have two processors but the arm7 doesn't have access to video hardware and limited memory which makes it difficult to do anything particularly useful in parallel.