Author Topic: G4 Multiprocessor  (Read 8590 times)

Offline mrhappy

  • Platinum Member
  • *****
  • Posts: 1152
  • new to the forums
G4 Multiprocessor
« on: February 02, 2017, 06:46:58 AM »
So I was rummaging through some old threads on the DUC and came across this response in a 'G4 Multiprocessor' thread and thought it was interesting...

'From the 'guy' or 'gal' that wrote the OS 9 kernal.

> Your assesement of OS 9 seems on par with what I've read. But, I believe from
: what I have read so far..that the system, while slightly better than
: older OS's prior to OS 8...still lacks the capability to fully utilize a 2nd
: cpu even when the apps are multicpu aware.

This is categorically untrue. I designed the nanokernel for Mac OS 9, and it is a true multitasking and symmetric multiprocessing system.
All tasks are scheduled to run on any processor at any time. Both processors are equal citizens to the kernel's scheduler.

If applications take advantage of threading themselves using the MP API, they can see 1.7 - 2.2x speed up on a 2P system. This is not
hypothetical, it is measured real world multitasking activity.

What you probably do not know is as of Mac OS 8.6, the old MP library was tossed to implement multitasking directly in the Mac OS
nanokernel. Today's MP library, which in Mac OS 9 is entirely integrated into the system, is mostly an API shim atop the multitasking
nanokernel.

The only limitation WRT multitasking on Mac OS 9 is we needed to maintain high fidelity compatibility with existing applications and
extensions which were not written to be reentrant nor preemption safe. We did this by runnning all of them in one task (the blue task),
hence classic apps are single threaded.

Note that even on Mac OS X or Windows NT, if you run one dominant application and that app is not threaded, meaning it runs in one
task, the second processor will not be utilized. Where Mac OS X or Windows NT works well is if you have multiple applications running and
doing something other than waiting for input.

It is up to 3rd party developers to thread their applications to take advantage of multiple processors. For more information take a look at:
http://developer.apple.com/macos/multitasking.html

Offline nanopico

  • Platinum Member
  • *****
  • Posts: 767
Re: G4 Multiprocessor
« Reply #1 on: February 02, 2017, 07:17:59 AM »
That's pretty much what we have found.

The basics are the OS takes advantage of it, but because it's a cooperative multitasking, if the app is in the foreground it has full control of the system essentially so if it is not MP aware, the second CPU sits idle.

Though I had not ever read that piece you found.  Pretty cool to read that. Thank you for sharing.
If it ain't broke, don't fix it, or break it so you can fix it!

Online Protools5LEGuy

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2750
Re: G4 Multiprocessor
« Reply #2 on: February 02, 2017, 10:18:17 AM »

It is up to 3rd party developers to thread their applications to take advantage of multiple processors. For more information take a look at:
http://developer.apple.com/macos/multitasking.html

https://web.archive.org/web/20010413231719/http://developer.apple.com/macos/multiprocessing.html

Quote

Apple's multiprocessing APIs provide support for both co-operatively scheduled tasks and preemptively scheduled tasks. The APIs for preemptively tasks allow applications to create symmetrically scheduled preemptive tasks that can be run on a single processor machine, and will take full advantage of multiple processors when they are installed.
Multiprocessing API
The Multiprocessing API provides symmetrical real-time multitasking services that you can use to create tasks inside of your applications. This section provides links to web pages providing information about how to use the Multiprocessing API:

    Technote 1071, "Working with Apple's Multiprocessing API"
    Technotes describing some more obscure issues related to the Multiprocessing API.
    Multiprocessing SDK
    The software development kit for creating applications that use the Multiprocessing API. The SDK includes complete documentation for the Multiprocessing API.
    "Adding Multitasking Capability to Applications Using Multiprocessing Services"
    This document describes the Multiprocessing Services application programming interface through Multiprocessing Services 2.1. It contains conceptual information, programming examples, and a complete API reference. New features in version 2.1 include support for kernel notifications and gestalt selectors to determine the presence of preemptive task-safe system software functions.
    Click here for Multiprocessing sample code

Multitasking Development Resources
Apple tools, sample code, and documentation to help you with your multitasking projects. For general Mac OS resources, please see the Mac OS page.

    Apple Development Tools
    Learn more about Apple products for helping you develop excellent Mac OS software
    Developer Documentation
    Source for complete developer documentation
    Technical Notes
    Late-breaking docs for timely technology issues
    Technical Q&As
    Programming tips, code snippets, & FAQs by Apple's support engineers
    Sample Code
    An index of the DTS Sample Code FTP site
    Software Development Kits (SDKs)
    A listing of available Software Development Kits
    Software Licensing
    A listing of Apple Licensable Software

Thread Manager
The Thread Manager provides co-operative multitasking services allowing you to create a number of smaller tasks inside of an application. This section provides links to web pages providing information about how to use the Thread Manager:

    Thread Manager SDK
    The software development kit for creating applications that use the Thread Manager. The SDK includes complete documentation for the Thread Manager.
    Concurrent Programming With the Thread Manager
    A develop article discussing some of the more subtle issues related to using the Thread Manager.

Process Manager
The Process Manager provides co-operative multitasking services used for sharing the processor among applications. This section provides links to web pages providing information about how to use the Process Manager:

    Process Manager Documentation
    Complete documentation describing the Process Manager.
    The Process Manager Technote Collection
    A collection of technical notes that digress into some of the more complex issues related to using the Process Manager.
    The Process Manager Q&A Collection
    A number of short question and answer format items presented in answer to some of the more frequently asked questions about the Process Manager.

Mailing Lists

    Public Mac OS mailing lists
    Mailing lists run by Apple & others, with topic descriptions and subscription information.

Other Related Web Sites

    G4 with Velocity Engine Technology Information - Informational resources describing how to use the G4's Velocity Engine in your applications.

Report Bugs
Web forms to report bugs found in Apple software.

    Report Bugs Here
    Links to web forms for entering information to report problems found in Apple software

« Last Edit: February 02, 2017, 10:32:11 AM by Protools5LEGuy »
Looking for MacOS 9.2.4

Offline Naiw

  • Veteran Member
  • ****
  • Posts: 126
  • new to the forums
Re: G4 Multiprocessor
« Reply #3 on: November 24, 2017, 08:48:54 AM »
That's pretty much what we have found.

The basics are the OS takes advantage of it, but because it's a cooperative multitasking, if the app is in the foreground it has full control of the system essentially so if it is not MP aware, the second CPU sits idle.

Though I had not ever read that piece you found.  Pretty cool to read that. Thank you for sharing.

Sorry for the thread necromancy, I don’t know if the research on this subject revealed something new.

This is not accurate though, or I misunderstood the post.

However MPTasks are scheduled directly on the nanokernel in parallel with the bluetask (read ”macos”)
Therefore it doesn’t matter what application is scheduled in MacOS process manager, MPTasks keep executing anyway. The exception would be if an MPTask issued an RPC call in which case it has to wait for MacOS until it can execute.

This is document in the MP SDK.

macStuff

  • Guest
Re: G4 Multiprocessor
« Reply #4 on: November 24, 2017, 11:45:36 AM »
theres a few things i honestly dont + will never understand as far as mentality + attitude go on the internet..

#1) i dont understand the idea that "necro'ing threads" is a bad thing, if you are talking shit and wasting peoples times ok fine.. but that goes for both old + new threads.. and is not "old thread" specific, if you are adding information that was asked for and never answered.. then of course its adding value.. yet alot of forums will KEEP THE THREAD POSTED but lock it... making it unable to add the answer.. etc makes no sense.. what the hells the point of a forum ... where people ask questions.. if u cant answer them? and so what if thats 6months - 1 yr - 3 years - 5 years later.. even 10 years.. if anything the answers are more valuable with time because all the other sources of info will dissappear thanks to web designers who practice the next point which is:

#2) i dont understand how websites (made by major brands + companies) continually DELETE their old website + make new version ... when they could easily still host the old website at a different location... its not like webhosts charge that much for storage... its not the companies fault either thoi its the web developers common practices that make no sense, in my old web development jobs i did alot of government contracts + they would always have me ARCHIVE THE OLD CONTENT AND MAINTAIN ITS ACCESSIBILITY.. moving it to another location and providing a link to the old content.. so easy.. its the internet... its supposed to be an information archive.. but these people treat their sites like grocery coupons or Brochure spam-ware.. obviously for some of the companies OBFUSCATING OLD INFORMATION actually works in their favor as people are unable to support their old devices they move on and purchase new hardware
« Last Edit: November 24, 2017, 01:14:08 PM by macStuff »

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: G4 Multiprocessor
« Reply #5 on: March 17, 2022, 12:16:23 PM »
Is there a list of toolbox instructions that can be safely used in a MP thread?

Offline nanopico

  • Platinum Member
  • *****
  • Posts: 767
Re: G4 Multiprocessor
« Reply #6 on: March 18, 2022, 08:39:12 PM »
That's pretty much what we have found.

The basics are the OS takes advantage of it, but because it's a cooperative multitasking, if the app is in the foreground it has full control of the system essentially so if it is not MP aware, the second CPU sits idle.

Though I had not ever read that piece you found.  Pretty cool to read that. Thank you for sharing.

Sorry for the thread necromancy, I don’t know if the research on this subject revealed something new.

This is not accurate though, or I misunderstood the post.

However MPTasks are scheduled directly on the nanokernel in parallel with the bluetask (read ”macos”)
Therefore it doesn’t matter what application is scheduled in MacOS process manager, MPTasks keep executing anyway. The exception would be if an MPTask issued an RPC call in which case it has to wait for MacOS until it can execute.

This is document in the MP SDK.

MPTasks are associated with an application.  if that application is not the current application, it is my understanding that all tasks/threads/processes (MPTask or otherwise) for that application are suspended while what ever is the current application is executing.
If it ain't broke, don't fix it, or break it so you can fix it!