Scheduler For Mac Rating: 3,9/5 9186 reviews

May 11, 2020  Teams Scheduling with Outlook on Mac My organization recently rolled out Teams and I can't figure out how to help our Mac users with scheduling meetings. I have a PC and when I schedule a meeting from Outlook I have a button to make it a Teams Meeting and it adds the link to the invitation.

OS X is based on Mach and BSD. Like Mach and most BSD UNIX systems, it contains an advanced scheduler based on the CMU Mach 3 scheduler. This chapter describes the scheduler from the perspective of both a kernel programmer and an application developer attempting to set scheduling parameters.

This chapter begins with the Overview of Scheduling, which describes the basic concepts behind Mach scheduling at a high level, including real-time priority support.

The second section, Using Mach Scheduling From User Applications, describes how to access certain key Mach scheduler routines from user applications and from other parts of the kernel outside the scheduler.

The third section, Kernel Thread APIs, explains scheduler-related topics including how to create and terminate kernel threads and describes the BSD spl macros and their limited usefulness in OS X.

Overview of Scheduling

The OS X scheduler is derived from the scheduler used in OSFMK 7.3. In general, much documentation about prior implementations applies to the scheduler in OS X, although you will find numerous differences. The details of those differences are beyond the scope of this overview.

Mach scheduling is based on a system of run queues at various priorities that are handled in different ways. The priority levels are divided into four bands according to their characteristics, as described in Table 10-1.

Table 10-1 Thread priority bands

Priority Band

Characteristics

Normal

normal application thread priorities

System high priority

threads whose priority has been raised above normal threads

Kernel mode only

reserved for threads created inside the kernel that need to run at a higher priority than all user space threads (I/O Kit workloops, for example)

Real-time threads

threads whose priority is based on getting a well-defined fraction of total clock cycles, regardless of other activity (in an audio player application, for example).

Threads can migrate between priority levels for a number of reasons, largely as an artifact of the time sharing algorithm used. However, this migration is within a given band.

Threads marked as being real-time priority are also special in the eyes of the scheduler. A real-time thread tells the scheduler that it needs to run for A cycles out of the next B cycles. For example, it might need to run for 3000 out of the next 7000 clock cycles in order to keep up. It also tells the scheduler whether those cycles must be contiguous. Using long contiguous quanta is generally frowned upon but is occasionally necessary for specialized real-time applications.

The kernel will make every effort to honor the request, but since this is soft real-time, it cannot be guaranteed. In particular, if the real-time thread requests something relatively reasonable, its priority will remain in the real-time band, but if it lies blatantly about its requirements and behaves in a compute-bound fashion, it may be demoted to the priority of a normal thread.

Changing a thread’s priority to turn it into a real-time priority thread using Mach calls is described in more detail in Using Mach Scheduling From User Applications.

In addition to the raw Mach RPC interfaces, some aspects of a thread’s priority can be controlled from user space using the POSIX thread priority API. The POSIX thread API is able to set thread priority only within the lowest priority band (0–63). For more information on the POSIX thread priority API, see Using the pthreads API to Influence Scheduling.

Why Did My Thread Priority Change?

There are many reasons that a thread’s priority can change. This section attempts to explain the root cause of these thread priority changes.

A real-time thread, as mentioned previously, is penalized (and may even be knocked down to normal thread priority) if it exceeds its time quantum without blocking repeatedly. For this reason, it is very important to make a reasonable guess about your thread’s workload if it needs to run in the real-time band.

Threads that are heavily compute-bound are given lower priority to help minimize response time for interactive tasks so that high–priority compute–bound threads cannot monopolize the system and prevent lower–priority I/O-bound threads from running. Even at a lower priority, the compute–bound threads still run frequently, since the higher–priority I/O-bound threads do only a short amount of processing, block on I/O again, then allow the compute-bound threads to execute.

All of these mechanisms are operating continually in the Mach scheduler. This means that threads are frequently moving up or down in priority based upon their behavior and the behavior of other threads in the system.

Using Mach Scheduling From User Applications

There are three basic ways to change how a user thread is scheduled. You can use the BSD pthreads API to change basic policy and importance. You can also use Mach RPC calls to change a task’s importance. Finally, you can use RPC calls to change the scheduling policy to move a thread into a different scheduling band. This is commonly used when interacting with CoreAudio.

The pthreads API is a user space API, and has limited relevance for kernel programmers. The Mach thread and task APIs are more general and can be used from anywhere in the kernel. The Mach thread and task calls can also be called from user applications.

Using the pthreads API to Influence Scheduling

OS X supports a number of policies at the POSIX threads API level. If you need real-time behavior, you must use the Mach thread_policy_set call. This is described in Using the Mach Thread API to Influence Scheduling.

The pthreads API adjusts the priority of threads within a given task. It does not necessarily impact performance relative to threads in other tasks. To increase the priority of a task, you can use nice or renice from the command line or call getpriority and setpriority from your application.

The API provides two functions: pthread_getschedparam and pthread_setschedparam. Their prototypes look like this:

The arguments for pthread_getschedparam are straightforward. The first argument is a thread ID, and the others are pointers to memory where the results will be stored.

The arguments to pthread_setschedparam are not as obvious, however. As with pthread_getschedparam, the first argument is a thread ID.

The second argument to pthread_setschedparam is the desired policy, which can currently be one of SCHED_FIFO (first in, first out), SCHED_RR (round-robin), or SCHED_OTHER. The SCHED_OTHER policy is generally used for extra policies that are specific to a given operating system, and should thus be avoided when writing portable code.

The third argument is a structure that contains various scheduling parameters.

Here is a basic example of using pthreads functions to set a thread’s scheduling policy and priority.

This code snippet sets the scheduling policy for the current thread to round-robin scheduling, and sets the thread’s relative importance within the task to the value passed in through the priority argument.

For more information, see the manual page for pthread.

Using the Mach Thread API to Influence Scheduling

This API is frequently used in multimedia applications to obtain real-time priority. It is also useful in other situations when the pthread scheduling API cannot be used or does not provide the needed functionality.

The API consists of two functions, thread_policy_set and thread_policy_get.

The parameters of these functions are roughly the same, except that the thread_policy_get function takes pointers for the count and the get_default arguments. The count is an inout parameter, meaning that it is interpreted as the maximum amount of storage (in units of int32_t) that the calling task has allocated for the return, but it is also overwritten by the scheduler to indicate the amount of data that was actually returned.

These functions get and set several parameters, according to the thread policy chosen. The possible thread policies are listed in Table 10-2.

Table 10-2 Thread policies

Policy

Meaning

THREAD_STANDARD_POLICY

Default value

THREAD_TIME_CONSTRAINT_POLICY

Used to specify real-time behavior.

THREAD_PRECEDENCE_POLICY

Used to indicate the importance of computation relative to other threads in a given task.

The following code snippet shows how to set the priority of a task to tell the scheduler that it needs real-time performance. The example values provided in comments are based on the estimated needs of esd (the Esound daemon).

The time values are in terms of Mach absolute time units. Since these values differ on different CPUs, you should generally use numbers relative to HZ (a global variable in the kernel that contains the current number of ticks per second). You can either handle this conversion yourself by dividing this value by an appropriate quantity or use the conversion routines described in Using Kernel Time Abstractions .

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. The preemptible value (1) indicates that those 40,000 bus cycles need not be contiguous. However, the constraint value (HZ/2200) tells the scheduler that there can be no more than 60,000 bus cycles between the start of computation and the end of computation.

Note: Because the constraint sets a maximum bound for computation, it must be larger than the value for computation.

A straightforward example using this API is code that displays video directly to the framebuffer hardware. It needs to run for a certain number of cycles every frame to get the new data into the frame buffer. It can be interrupted without worry, but if it is interrupted for too long, the video hardware starts displaying an outdated frame before the software writes the updated data, resulting in a nasty glitch. Audio has similar behavior, but since it is usually buffered along the way (in hardware and in software), there is greater tolerance for variations in timing, to a point.

Another policy call is THREAD_PRECEDENCE_POLICY. This is used for setting the relative importance of non-real-time threads. Its calling convention is similar, except that its structure is thread_precedence_policy, and contains only one field, an integer_t called importance. While this is a signed 32-bit value, the minimum legal value is zero (IDLE_PRI). threads set to IDLE_PRI will only execute when no other thread is scheduled to execute.

In general, larger values indicate higher priority. The maximum limit is subject to change, as are the priority bands, some of which have special purposes (such as real-time threads). Thus, in general, you should use pthreads APIs to achieve this functionality rather than using this policy directly unless you are setting up an idle thread.

Using the Mach Task API to Influence Scheduling

This relatively simple API is not particularly useful for most developers. However, it may be beneficial if you are developing a graphical user interface for Darwin. It also provides some insight into the prioritization of tasks in OS X. It is presented here for completeness.

The API consists of two functions, task_policy_set and task_policy_get.

As with thread_policy_set and thread_policy_get, the parameters are similar, except that the task_policy_get function takes pointers for the count and the get_default arguments. The count argument is an inout parameter. It is interpreted as the maximum amount of storage that the calling task has allocated for the return, but it is also overwritten by the scheduler to indicate the amount of data that was actually returned.

These functions get and set a single parameter, that of the role of a given task, which changes the way the task’s priority gets altered over time. The possible roles of a task are listed in Table 10-3.

Table 10-3 Task roles

Role

Meaning

TASK_UNSPECIFIED

Default value

TASK_RENICED

This is set when a process is executed with nice or is modified by renice.

TASK_FOREGROUND_APPLICATION

GUI application in the foreground. There can be more than one foreground application.

TASK_BACKGROUND_APPLICATION

GUI application in the background.

TASK_CONTROL_APPLICATION

Reserved for the dock or equivalent (assigned FCFS).

TASK_GRAPHICS_SERVER

Reserved for WindowServer or equivalent (assigned FCFS).

The following code snippet shows how to set the priority of a task to tell the scheduler that it is a foreground application (regardless of whether it really is).

Kernel Thread APIs

The OS X scheduler provides a number of public APIs. While many of these APIs should not be used, the APIs to create, destroy, and alter kernel threads are of particular importance. While not technically part of the scheduler itself, they are inextricably tied to it.

The scheduler directly provides certain services that are commonly associated with the use of kernel threads, without which kernel threads would be of limited utility. For example, the scheduler provides support for wait queues, which are used in various synchronization primitives such as mutex locks and semaphores.

Creating and Destroying Kernel Threads

The recommended interface for creating threads within the kernel is through the I/O Kit. It provides IOCreateThread, IOThreadSelf, and IOExitThread functions that make it relatively painless to create threads in the kernel.

The basic functions for creating and terminating kernel threads are:

With the exception of IOCreateThread (which is a bit more complex), the I/O Kit functions are fairly thin wrappers around Mach thread functions. The types involved are also very thin abstractions. IOThread is really the same as thread_t.

The IOCreateThread function creates a new thread that immediately begins executing the function that you specify. It passes a single argument to that function. If you need to pass more than one argument, you should dynamically allocate a data structure and pass a pointer to that structure.

For example, the following code creates a kernel thread and executes the function myfunc in that thread:

One other useful function is thread_terminate. This can be used to destroy an arbitrary thread (except, of course, the currently running thread). This can be extremely dangerous if not done correctly. Before tearing down a thread with thread_terminate, you should lock the thread and disable any outstanding timers against it. If you fail to deactivate a timer, a kernel panic will occur when the timer expires.

With that in mind, you may be able to terminate a thread as follows:

There thread is of type thread_t. In general, you can only be assured that you can kill yourself, not other threads in the system. The function thread_terminate takes a single parameter of type thread_act_t (a thread activation). The function getact_thread takes a thread shuttle (thread_shuttle_t) or thread_t and returns the thread activation associated with it.

SPL and Friends

BSD–based and Mach–based operating systems contain legacy functions designed for basic single-processor synchronization. These include functions such as splhigh, splbio, splx, and other similar functions. Since these functions are not particularly useful for synchronization in an SMP situation, they are not particularly useful as synchronization tools in OS X.

If you are porting legacy code from earlier Mach–based or BSD–based operating systems, you must find an alternate means of providing synchronization. In many cases, this is as simple as taking the kernel or network funnel. In parts of the kernel, the use of spl functions does nothing, but causes no harm if you are holding a funnel (and results in a panic if you are not). In other parts of the kernel, spl macros are actually used. Because spl cannot necessarily be used for its intended purpose, it should not be used in general unless you are writing code it a part of the kernel that already uses it. You should instead use alternate synchronization primitives such as those described in Synchronization Primitives.

Wait Queues and Wait Primitives

The wait queue API is used extensively by the scheduler and is closely tied to the scheduler in its implementation. It is also used extensively in locks, semaphores, and other synchronization primitives. The wait queue API is both powerful and flexible, and as a result is somewhat large. Not all of the API is exported outside the scheduler, and parts are not useful outside the context of the wait queue functions themselves. This section documents only the public API.

The wait queue API includes the following functions:

Most of the functions and their arguments are straightforward and are not presented in detail. However, a few require special attention.

Most of the functions take an event_t as an argument. These can be arbitrary 32-bit values, which leads to the potential for conflicting events on certain wait queues. The traditional way to avoid this problem is to use the address of a data object that is somehow related to the code in question as that 32-bit integer value.

For example, if you are waiting for an event that indicates that a new block of data has been added to a ring buffer, and if that ring buffer’s head pointer was called rb_head, you might pass the value &rb_head as the event ID. Because wait queue usage does not generally cross address space boundaries, this is generally sufficient to avoid any event ID conflicts.

Notice the functions ending in _locked. These functions require that your thread be holding a lock on the wait queue before they are called. Functions ending in _locked are equivalent to their nonlocked counterparts (where applicable) except that they do not lock the queue on entry and may not unlock the queue on exit (depending on the value of unlock). The remainder of this section does not differentiate between locked and unlocked functions.

The wait_queue_alloc and wait_queue_init functions take a policy parameter, which can be one of the following:

  • SYNC_POLICY_FIFO—first-in, first-out

  • SYNC_POLICY_FIXED_PRIORITY—policy based on thread priority

  • SYNC_POLICY_PREPOST—keep track of number of wakeups where no thread was waiting and allow threads to immediately continue executing without waiting until that count reaches zero. This is frequently used when implementing semaphores.

You should not use the wait_queue_init function outside the scheduler. Because a wait queue is an opaque object outside that context, you cannot determine the appropriate size for allocation. Thus, because the size could change in the future, you should always use wait_queue_alloc and wait_queue_free unless you are writing code within the scheduler itself.

Similarly, the functions wait_queue_member, wait_queue_member_locked, wait_queue_link, wait_queue_unlink, and wait_queue_unlink_one are operations on subordinate queues, which are not exported outside the scheduler.

The function wait_queue_member determines whether a subordinate queue is a member of a queue.

The functions wait_queue_link and wait_queue_unlink link and unlink a given subordinate queue from its parent queue, respectively.

The function wait_queue_unlink_one unlinks the first subordinate queue in a given parent and returns it.

The function wait_queue_assert_waitDrive power manager keygen youtube full. causes the calling thread to wait on the wait queue until it is either interrupted (by a thread timer, for example) or explicitly awakened by another thread. The interruptible flag indicates whether this function should allow an asynchronous event to interrupt waiting.

The function wait_queue_wakeup_all wakes up all threads waiting on a given queue for a particular event.

The function wait_queue_peek_locked returns the first thread from a given wait queue that is waiting on a given event. It does not remove the thread from the queue, nor does it wake the thread. It also returns the wait queue where the thread was found. If the thread is found in a subordinate queue, other subordinate queues are unlocked, as is the parent queue. Only the queue where the thread was found remains locked.

The function wait_queue_pull_thread_locked pulls a thread from the wait queue and optionally unlocks the queue. This is generally used with the result of a previous call to wait_queue_peek_locked.

The function wait_queue_wakeup_identity_locked wakes up the first thread that is waiting for a given event on a given wait queue and starts it running but leaves the thread locked. It then returns a pointer to the thread. This can be used to wake the first thread in a queue and then modify unrelated structures based on which thread was actually awakened before allowing the thread to execute.

The function wait_queue_wakeup_one wakes up the first thread that is waiting for a given event on a given wait queue.

The function wait_queue_wakeup_thread wakes up a given thread if and only if it is waiting on the specified event and wait queue (or one of its subordinates).

The function wait_queue_remove wakes a given thread without regard to the wait queue or event on which it is waiting.



Copyright © 2002, 2013 Apple Inc. All Rights Reserved. Terms of Use Privacy Policy Updated: 2013-08-08

What are the System Requirements for JW Scheduler?

All Windows Vista, Windows 7, Windows 8 or Windows 10 computers can run JW Scheduler. Please make sure you have Microsoft .NET Framework 4.5.2. installed. This can be installed via Windows Update or from the Microsoft website.

Yes. However, you need to first install a copy of Windows using either Boot Camp, Parallels or VirtualBox. Boot Camp is free and officially support by Apple, so this is likely the best option. VirtualBox is also free.

Does JW Scheduler work on an iPad, Android tablet or Smartphone?

No, to install and run JW Scheduler you must please use either:

  • Desktop computer or Laptop running Windows, or
  • Windows Tablet (such as Surface Pro), or
  • Apple MAC running a Windows Emulator, or
  • Linux computer running a Windows Emulator.

Only the JW Scheduler – Publisher Edition App runs on iOS or Android phones and tablets.

Will JW Scheduler ever be released on iOS or Android?

There are currently no plans to release the JW Scheduler on iOS or Android. This would involve a huge amount of work, and is not really necessary. Tablets and Smartphones are wonderful tools for attending meetings & the ministry, but they are not designed for deep study, research, congregation management and scheduling.

It is entirely reasonable that all appointed brothers own a simple and affordable laptop or desktop computer. That way they can use Watchtower Library, write and print talks, perform in-depth research, write correspondence to the branch and perform other congregation duties.

In fact, a cheap laptop can be purchased for just a few hundred dollars, which is cheaper than an iPad and many smart phones!

The JW Scheduler – Publisher Edition App is an iOS and Android App that allows publishers to see upcoming Christian Life and Ministry meeting & Public Talk assignments, upcoming Duties, submit Field Service Reports, view upcoming Congregation Events and any recent Congregation Announcements.

Data inside the JW Scheduler – Publisher Edition App is generated by JW Scheduler (Desktop Edition for appointed brothers). Therefore you must be using JW Scheduler to allow publishers to use and enable the App.

Is JW Scheduler web-based or do I need to install on my computer?

JW Scheduler is not web-based. It must be installed on a Windows computer. The data is therefore always kept secure on your local computer. The latest branch direction (sfl) is very clear in not allowing web-based applications to be used for congregation matters, so we are unable to offer a web-based version.

How do I update the JW Scheduler meeting schedule?

JW Scheduler will automatically update the CLM Schedule about one week after the new English epub files appears on JW.org. This allows time for all languages to appear on JW.org. Sometimes translation teams provide epub files late, please be patient.

First, you can try to manually perform an update by clicking Settings > Update. If that doesn’t work, please check your Internet connection. Some anti-virus programs or firewalls might block JW Scheduler from connecting to the Internet, so please adjust these settings to allow JW Scheduler to connect to the Internet.

When JW Scheduler is opened, it will automatically check and detect if a new version is available, and let you know. The new version can be downloaded from the JW Scheduler Download page.

Yes! When you first open JW Scheduler, click Import Congregation from Majestic KHS. Please see How to Import from Majestic KHS for more information.

Yes! When you first open JW Scheduler, click Import Congregation from CLM Explorer. Please see How to Import data from CLM Explorer for more information.

Can I Import data from Tswin or Theocratic Software?

Yes! When you first open JW Scheduler, click Import Congregation from TSWin. Please see How to Import data from TSWin for more information.

Sorry, not at this time. But we are working on it and hope to have this functionality available in the future.

JW Scheduler Congregation Sharing allows you to automatically share all JW Scheduler data with other approved brothers in your congregation.

It is often a challenge for all appointed brothers to keep up-to-date with all congregation matters. Therefore, JW Scheduler has been designed to allow all approved brothers to quickly and easily view, organise and schedule congregation assignments and member information.

Please see Congregation Sharing Help for more information.

Yes. All data is stored on your local computer and is encrypted. Congregation Sharing does not store any confidential data online, therefore is fully compliant with sfl. Congregation Sharing is also fully compliant with the strict European GDPR Privacy Laws, since the data is never accessed by anyone outside of the European Union.

Please see Congregation Sharing for more information.

Is JW Scheduler Congregation Sharing compliant with sfl and European GDPR Privacy Laws?

Yes. Congregation Sharing does not store any confidential data online, therefore is fully compliant with sfl. Congregation Sharing is also fully compliant with the strict European GDPR Privacy Laws, since the data is never accessed by anyone outside of the European Union.

Please see Congregation Sharing for more information.

Please see Congregation Sharing Help for more information.

Yes, please click Settings and enable Password Protect.

All data is automatically saved. There is no need to press save.

  1. Open JW Scheduler
  2. Click Congregation > Congregation Information.
  3. Click Backup Congregation, and save to a USB device.
  4. Install JW Scheduler on the new computer
  5. Click Open Congregation from File and locate the USB Backup.

Alternatively, you could enable Congregation Sharing, and then click Open Congregation from Sharing on the new computer.

  1. Open JW Scheduler
  2. Click Congregation > Congregation Information > Backup Congregation
  3. Choose a safe location for the Backup file. (e.g. USB)

Click the Congregation > Congregation Information tab. You can then choose to either Restore Congregation from File or Restore Congregation from Automatic Backup.

If you want to restore a congregation on a new or different computer, you will need to first create a Backup to USB. On the new computer, click Open Congregation from File.

Yes! Your personal Registration Key can be used to install JW Scheduler on as many personal devices as you like. However, if you have an INDIVIDUAL Registration Key, please do not share your Key with anyone else.

If you want all brothers in your congregation to use the Full Version of JW Scheduler, please purchase a CONGREGATION Registration Key. Please see Register for more information.

If I move congregation or change roles, can I give my Registration Key to another brother?

Yes, that is fine. You may give your Registration Key to another brother as long as you no longer use it. Please do not share one key with multiple brothers.

I have lost my Registration Key, what should I do?

First, please check and search your email mailbox. Since all Registration Keys are emailed, most likely your mailbox still has a copy of the key. If you can’t find it, please Contact Us.

Can JW Scheduler be used in a restricted territory?

That is a personal decision each elder must make, in line with any relevant branch direction.

If I choose to use JW Scheduler in a restricted territory, what precautions should I take?

While all data on your local computer and any Shared data is fully encrypted, this is only as strong as your computer security. Therefore we recommend the following:

  1. Ensure your computer is encrypted with BitLocker or TrueCrypt.
  2. Ensure your computer has all the latest Windows Updates and Antivirus settings.
  3. Don’t store real names in the program. Use aliases or initials.
  4. Don’t store phone numbers or email addresses in the program.
  5. Use a strong password for both your computer and JW Scheduler password.