• Advertisement

Archived

This topic is now archived and is closed to further replies.

Multitasking on consoles?

This topic is 5843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does the Playstation 2 or XBox have any form of thread support? I assumed that XBox might, but just read an (old) article saying that Microsoft had given that up for speed. It also said no DLLs - both of which I''m having a hard time believing. Thanks for any info. Chris

Share this post


Link to post
Share on other sites
Advertisement
I don''t see why it wouldn''t work on the XBox, unless the Intel hardware is seriously crippled.

Share this post


Link to post
Share on other sites
well dreamcast runs a full distro of linux, which is multitasking.

for ps2, it shoudl also support multitasking (see linux dev kit).

xbox also should support multitasking (it is an x86 at heart, and the 386 supported multitasking enviroments). its all a qusetion of whether the dev enviroemnt you are using for the system supports multitasking.

most ppl dont realize that just because the default os that the system uses may not support multitasking, does not mean you cant go and create your own multitasking os for the system. look at unreal, it does most of its multitasking via its script engine all in one windows/linux thread since its faster then haing the os handle the threading (since he had thousands of threads running, it just too much for an os to handle efficently in a realtime stituation such as a game).

Share this post


Link to post
Share on other sites
PS2 does support multithreading.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
Multitasking doesn''t have anything to do with the processors. It all depends on the OS. You can multitask on an Z80 if you have the right OS.

Share this post


Link to post
Share on other sites
quote:
Original post by BeerNutts
Multitasking doesn''t have anything to do with the processors. It all depends on the OS. You can multitask on an Z80 if you have the right OS.


Only partially true. True preemptive multitasking needs a cpu that can timeslice. Cooperative multitasking can be done on any processor but requires thats apps voluntarely make calls to pass control to another process, which is why in pre95 windows a single app would almost always bring down the whole system if it crashed. The same applies to older versions of mac os.

Share this post


Link to post
Share on other sites
quote:

True preemptive multitasking needs a cpu that can timeslice



Some truly preemptive platforms don't have specific CPU support. Instead they set up a CPU interrupt from an external hardware timer (most platforms tend to have hardware timers capable of causing an IRQ - heck, even the C64 did).

The size of the slice is set up in the h/w timer. When the time has elapsed, an IRQ is generated, roughly the following happens:

1) The CPU saves the current context in response to the IRQ (typically the program counter, user stack pointers etc)

2) The CPU then calls the handler for that IRQ...

3) ...which is the thread/task scheduler, which saves any context the CPU didn't (e.g. FPU mode, complete register set etc).

4) The scheduler copies the complete context info into a structure representing the context for the currently running thread.

5) The scheduler sets the next ready thread to be the current active thread. (Typically round robin fashion).

6) The scheduler fetches the context for the new current thread to be scheduled and replaces the one the CPU saved for the IRQ with this one.

7) The scheduler sets any other context (FPU state etc) from the info for the new current thread.

8) The scheduler sets up the time slice in the timer for the new current thread to be scheduled.

9) Finally the interrupt handler is exited - the CPU isn't aware of what happened in stage 6, it just retrieves the context which it thinks it saved (but was really overwritten by the scheduler), and exits to the location of the _new_ current thread/task.

That's definately the way the Commodore AmigaOS used to do it (a CIA IRQ - scan the kernel ROM for STOP $2000 instructions for some interesting reading). And AFAIK its also the way Windows (>=98) does it, and also the way the newer Macs do it.


Back to the original question, yup - the consoles mentioned DO support multithreading. They don't however support multitasking in the traditional sense. PS2 has multiple processors so can be running multiple programs, but the processors are specialised (i.e. you can't run 2 games at the same time and switch between.

And as for DLLs Xbox=NO, GC=NO, PS=Yes(ish), but since none of them multiTASK, OS supported DLLs aren't required - you can just load an external block of code into the address space and call it!.

--
Simon O'Connor
Creative Asylum Ltd
www.creative-asylum.com

Edited by - S1CA on February 26, 2002 10:56:36 AM

Share this post


Link to post
Share on other sites
To multitask you need an operating system. I dony see why single-threading wont work, most consoles have separate hardware for sound, video and input anyways (or atleast the sega 68000 ones do!)

I would love to design a console system, but it is to complicated!!! thats what emulators are for :p

Share this post


Link to post
Share on other sites
merlin9x9 wrote:
quote:

Don''t forget that multitasking != multithreading



Yep. Although under Windows and some other OSes they''re actually extremely closely tied together - a process (aka ''task'') is just a logical collection of threads with its own address space (and optionally CPU) - the scheduler just thinks of itself as switching threads without making any real distinction between tasks (the virtual->real address space mapping simply being a part of the context with a bit of CPU support to make it work). Or at least that''s the impression I get of Windows from reading books like "Programming Applications For Windows" (used to be known as "Advanced Windows").


Cybertron wrote:
quote:

To multitask you need an operating system


Not necessarily - to use OS based multitasking or multithreading you do. But many programmers are essentially doing the same thing anyway when writing chains of callbacks called from a VSYNC interrupt for example. Same (as you mentioned) writing vector unit programs or IOP modules on the PS2 - I''d call that multitasking (more precisely, multiprocessing).


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
The Xbox supports one, and only one process, which itself can have multiple threads.

Here''s a link to an older Xbox XDK document, but I believe the info is still accurate.

http://www.xboxweb.com/features/xdkspecs.html

Here''s a quote:

quote:

"There will be no support for code running in user mode (Ring 3) on the Xbox game system. All code will execute in kernel mode (Ring 0). Only one process runs at a time, and that process will support multiple threads."



SS

Share this post


Link to post
Share on other sites

  • Advertisement