• 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: Thread Priority?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread Priority?


  • Subject: Re: Thread Priority?
  • From: Basavaraj <email@hidden>
  • Date: Fri, 21 Sep 2007 22:56:33 +0530

Hi,

I also get this problem. Apple, please suggest some solution to this problem.

Why reading data on network sometimes take more time than usually.
In my case it is very critical, server drops video and audio packets if client don't receive in allowed time.
Problem is more prominent in Linux and Mac OS X, but in Windows, it just works fine.


If we launch or do some operation on some cpu intensive application or simple X11 apps, then problem is more frequent.

Problem is not because of receiving data. I saw tcp dump on Ethereal, actual problem is with TCP acknowledgment.
Acknowledgments are not going immediately after receiving packets. Disabling Naggle algorithm didn't helped.
Please help any one or Apple.


Thank you for any help or suggestions.

Regards,
Basavaraj





Nelson Lee wrote:
I am currently setting the thread priority of my networking thread as follows and it works!

int set_realtime(int period, int computation, int constraint) {
    struct thread_time_constraint_policy ttcpolicy;
    struct thread_time_constraint_policy ttcpolicyGet;
    int ret;
    ttcpolicy.period=period; // HZ/160
    ttcpolicy.computation=computation; // HZ/3300;
    ttcpolicy.constraint=constraint; // HZ/2200;
    //ttcpolicy.preemptible=1;
    ttcpolicy.preemptible=0 ;

    if ((ret=thread_policy_set(mach_thread_self(),
        THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t)&ttcpolicy,
        THREAD_TIME_CONSTRAINT_POLICY_COUNT)) != KERN_SUCCESS) {
        fprintf(stderr, "set_realtime() failed with code %d.\n",ret);
            return 0;
    }
    return 1;
}

and the call is:       set_realtime(1250000,60000,90000);


In my thread, I make a networking call using select; more specifically, I am reading from a socket. From timing debug outputs, the reading occurs at regular intervals (~1 ms), but occasionally, the receive call takes 10 ms which throws off my application (it's audio). Is this a networking issue or should setting the priority as real-time take care of this?


Thanks,
-n

------------------------------------------------------------------------

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Thread Priority?
      • From: Terry Lambert <email@hidden>
    • Re: Thread Priority?
      • From: "Shawn Erickson" <email@hidden>
    • Re: Thread Priority?
      • From: Jonas Maebe <email@hidden>
References: 
 >Thread Priority? (From: "Nelson Lee" <email@hidden>)

  • Prev by Date: Thread Priority?
  • Next by Date: Re: Thread Priority?
  • Previous by thread: Thread Priority?
  • Next by thread: Re: Thread Priority?
  • Index(es):
    • Date
    • Thread