• 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
How to set scheduling in NSThread based application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set scheduling in NSThread based application


  • Subject: How to set scheduling in NSThread based application
  • From: Gilles Celli <email@hidden>
  • Date: Mon, 12 Feb 2007 17:34:30 +0100

Hi,

I've written a data acquisition-program under Cocoa which detach 2 new NSThreads:

One which collects data every 0.5 seconds (full second and millisecond 500 via gettimeofday()) from a multimeter via USB-to- Serial Adapter,
and another one which displays the graph of the data in NSTableView and with the Open-Source-Based
SM2DGraphView.


The data is immediately written to a ASCII based data file which works quite well.

However sometimes it misses some data :-(

So, I looked around in the Cocoa mailing-list and found out that the scheduling can be changed to get better performance.

I'm not sure but the example "Using the Mach Thread API to Influence Scheduling" to get real-time performance is what I need for my app:
http://developer.apple.com/documentation/Darwin/Conceptual/ KernelProgramming/index.html


So a few questions remains:

1. Is it a good idea to use this example in a COCOA-based app, and if yes where should the function set_realtime()
be called ? Before calling NSThread or inside the thread to collect data ?


2. The doc also says to pass 'Mach absolute time units' to the function...but since it changed in time how can this be accurate ?
"Say your computer reports 133 million for the value of HZ. If you pass the example values given as arguments to this function, your thread tells the scheduler that it needs approximately 40,000 (HZ/ 3300) out of the next 833,333 (HZ/160) bus cycles."


Any suggestions are greatly appreciated.

Gilles Celli


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: How to set scheduling in NSThread based application
      • From: Half Activist <email@hidden>
    • Re: How to set scheduling in NSThread based application
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: NSTableView display not being refreshed after a background refresh
  • Next by Date: background color of NSTextView
  • Previous by thread: Re: NSTableView display not being refreshed after a background refresh
  • Next by thread: Re: How to set scheduling in NSThread based application
  • Index(es):
    • Date
    • Thread