"time slice" in OS X

Discussion in 'Apple' started by Alan Browne, Jan 14, 2012.

  1. Alan Browne

    Alan Browne Guest

    If I'm not mistaken the basic application (user space?) process time
    slice in OS X is 10 ms. (Leaving out other aspects of the scheduler)

    Has anyone set this to a coarser value such as 25 or 50 ms? (more
    efficient).

    Or the reverse - 5ms? (less efficient - illusion of smootherishness)
     
    Alan Browne, Jan 14, 2012
    #1
    1. Advertisements

  2. A shorter time slice isn't always smoother. Shorter time slices causes
    threads to be more often interrupted while they have exclusive access to
    a shared resource, rather than having them naturally suspend/wait. It
    can cause a cascading effect resulting in very choppy and unpredictable
    performance.

    There are a few factors that make OS X feel unresponsive.

    The first, and greatest problem, is in user event handling. Classic
    MacOS recorded an accurate location and timestamp for every user event.
    OS X apps seem to lack that. When you click and drag over text in OS X,
    the highlight starts where the application wakes up rather than where
    you clicked. Double-clicks and single clicks mix up, etc.

    The second problem starts with OS 10.7. All Apple apps now write their
    internal state to a directory on every user interaction. It supports
    auto-save, restoring state, and the iOS feel. It can not be turned off!
    The OS X filesystem doesn't quite have the performance needed for this
    so Apple apps will badly lag when the computer is moderately busy.

    MacOS X memory use tuning is set by Apple. You may find that some OS X
    versions run great for you and some thrash the disk constantly. Apple's
    tuning isn't that smart and there are no visible parameters to adjust so
    YMMV.
     
    Kevin McMurtrie, Jan 14, 2012
    #2
    1. Advertisements

  3. Alan Browne

    Alan Browne Guest

    I had noticed that but that's the first explanation for it that I've seen.
    I don't disagree with anything you said.

    However with today's very fast CPU's (compared to even when intel OS X
    was released) and (typically) over generous memory, the OS time spent
    managing process switches will get smaller and smaller per time slice.
    This should not be affected by user actions at all.

    And I'm just as interested in longer time slices as shorter.
     
    Alan Browne, Jan 14, 2012
    #3
  4. Alan Browne

    JF Mezei Guest

    Time slices affect multitasking.

    Lack of responsiveness is more likely due to synchronous code. A piece
    of code that waits for an IO to complete before going back to "check the
    event queue" loop. During this time, buttons don't click etc.
     
    JF Mezei, Jan 14, 2012
    #4
  5. Alan Browne

    Alan Browne Guest

    No shit.

    But given the arbitrary value of the slice (10ms) established years ago
    with slower processors, there's room to adjust it either way.

    The time slice being reduced or increased some reasonably amount should
    not affect I/O very much (if it is not radically changed). Most events
    are interrupt driven and those that are scheduled usually have wait
    states during large writes and reads.

    I'll give it a go one of these days, probably with values of 20 ms and 5
    ms to see what affect it has - if any.
     
    Alan Browne, Jan 14, 2012
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...