• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Task dispatching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Task dispatching


  • Subject: Re: Task dispatching
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 13 Sep 2011 11:23:20 -0700

On Sep 13, 2011, at 10:11 AM, Jon Sigman wrote:

> Startup involves loading a >1GB data matrix from disk into memory. Transformations are then done using this matrix on the 1MB data blocks that are sent in via TCP/IP. That's why I can't simply start new tasks on-demand, the startup time is prohibitive so that complicates things. The first option (multiple processes) seems more robust but also harder to implement. Are there any design guidelines for implementing a "server" in Cocoa?

Does it need to be Cocoa? If you use only low-level (POSIX/BSD) APIs you can implement the server so it creates new processes by forking. The forked process is an exact clone of the original, with its address space copy-on-write, so it’s already up and running without any startup time. This technique is commonly used in Unix-level software to start new processes quickly. The reason you can’t use it with Cocoa is because unfortunately forking doesn’t copy Mach ports, so any services that use them will be broken in the forked process because the port IDs will be invalid. That includes a lot of Apple stuff like CoreGraphics, CoreServices, and on up the stack.

(If you’re interested in pursuing that, the darwin-userlevel list might be the most appropriate to ask further questions on.)

If you’re committed to using Cocoa, I think using dispatch queues (or threads) is your best option.

—Jens_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Task dispatching
      • From: Scott Ribe <email@hidden>
References: 
 >Task dispatching (From: Jon Sigman <email@hidden>)
 >Re: Task dispatching (From: Scott Ribe <email@hidden>)
 >Re: Task dispatching (From: Jon Sigman <email@hidden>)

  • Prev by Date: Re: Responder-Chain question.
  • Next by Date: Re: any way to know where a UIBarButtonItem has been drawn?
  • Previous by thread: Re: Task dispatching
  • Next by thread: Re: Task dispatching
  • Index(es):
    • Date
    • Thread