EP0915418A2

Method and apparatus for processor sharing

Abstract

A method and apparatus for implementing proportional sharing in a single processor system and/or in a multi-processor system. The invention can also implement proportional sharing in a system that executes multi-threaded computer programs. The invention uses the metaphor of "tickets." Each process (106) in the system (100) has a number of tickets and each ticket entitles the process (106) to use a processor (102) for a period of a time quantum. The operating system (108) allocates the processor(s) (102) first to the process (106) with the highest number of tickets. As each process (106) (or thread (107)) finishes being executed for a predetermined amount of time, the tickets of that process/thread are adjusted accordingly and a new process (or thread) is chosen for execution. Tickets can be allocated to each process in the system. Alternatively, tickets can be allocated to each process and shared by all threads of the process. Alternatively, tickets can be allocated to a group of processes and shared by all processes within the group.

EP0915418A2, drawing sheet 1
Sheet 1 of 16

Term

Term ended

Projected expiry passed 30 October 2018, 7.9 years ago.

  1. Priority
  2. Filed
  3. Published
  4. Projected expiry
  5. Today

17 claims: 10 independent, 7 dependent

  1. 1
    A method of sharing at least one processor in a data processing system between a plurality of processes, including the steps, performed by the data processing system, of:initially assigning a number of tickets to each of the plurality of processes;assigning an initial priority to a thread of each of the plurality of processes in accordance with the number of tickets assigned to the process associated with the thread;and executing the respective threads of the plurality of processes in an order indicated by the tickets assigned to the plurality of processes, so that the proportion of execution time between any two of the threads is the same as the proportion between the number of tickets of the two processes associated with the threads.
  2. 9
    A method of sharing a processor between a plurality of threads of a plurality of multi-threaded applications in a data processing system, including the steps, performed by the data processing system, of:initially assigning respective numbers of tickets to each of the plurality of multi-threaded applications;assigning a priority to each of the plurality of multi-threaded applications in accordance with a number of tickets assigned to each multi-threaded application;adding a thread of at least one of the plurality of multi-threaded applications to a dispatch queue when room becomes available for another thread on a dispatch queue;and adding a thread of at least one of the plurality of multi-threaded applications to a ticket queue, when there is not room for another process on the dispatch queue.
  3. 10
    A method of sharing at least one processor between a plurality of threads of a first multi-threaded process and a plurality of threads of a second multi-threaded process in a data processing system, including the steps, performed by the data processing system, of:initially assigning a respective numbers of tickets to the first and second multi-threaded processes;assigning a priority to at least one thread of each of the first and second multi-threaded processes in accordance with the number of tickets assigned to each multi-threaded process;and executing the threads of the first and second multi-threaded processes in an order indicated by the tickets assigned to their respective multi-threaded process, so that the proportion of execution time between any two of the processes is the same as the proportion between the number of tickets of the two multi-threaded processes.
  4. 11
    A data structure stored in a memory storage area of a data processing system, comprising:a data structure representing a first thread of a multi-threaded process;a data structure representing a second thread of a multi-threaded process;and a ticket queue data structure, that is pointed to by the data structures representing the first and second threads, where the ticket queue data structure stores a value indicating an initial number of tickets for the multi-threaded process to which the first and second threads belong and further storing a value indicating a current number of tickets for the multi-threaded process.
  5. 12
    A method of sharing at least one processor between a plurality of users in a data processing system, where the users each have a plurality of jobs to execute, including the steps, performed by the data processing system, of:initially assigning a number of tickets to each of the plurality of users;assigning a priority to each of the plurality of jobs in accordance with the number of tickets assigned to each user;and executing jobs belonging to the plurality of users in an order indicated by the tickets assigned to the plurality of users, so that the proportion of execution time between jobs of any of the two users is the same as the proportion between the number of tickets of the two users.
  6. 13
    A method of sharing at least one processor between a plurality of threads in multiple processes, comprising:initially assigning a number of tickets to the plurality of processes;where the tickets are assigned to the plurality of processes as a pool;assigning a priority to two threads associated with two of the plurality of processes, in accordance with the number of tickets assigned to the plurality of processes;and executing the two threads in an order indicated by the tickets assigned to the processes with which the threads are associated, so that the proportion of execution time between the two threads is the same as the proportion between the number of tickets of the two processes.
  7. 14
    A computer program product, including:a computer usable medium having computer readable code embodied therein for causing proportional execution times between two threads of two processes, the computer program product comprising: computer readable program code devices configured to cause a computer to effect initially assigning a number of tickets to each of the plurality of processes;computer readable program code devices configured to cause a computer to effect assigning a priority to each of the plurality of processes in accordance with the number of tickets assigned to each process;and computer readable program code devices configured to cause a computer to effect executing the plurality of processes in an order indicated by the tickets assigned to the plurality of processes, so that the proportion of execution time between any two of the processes is the same as the proportion between the number of tickets of the two processes.
  8. 15
    A computer data signal embodied in a carrier wave and representing sequences of instructions which, when executed by a processor, cause the processor to share at least one processor in a data processing system between a plurality of processes, by performing the steps of:initially assigning a number of tickets to each of the plurality of processes;assigning a priority to each of the plurality of processes in accordance with the number of tickets assigned to each process;and executing the plurality of processes in an order indicated by the tickets assigned to the plurality of processes, so that the proportion of execution time between any two of the processes is the same as the proportion between the number of tickets of the two processes.
  9. 16
    An apparatus that proportionally shares at least one processor in a data processing system between a plurality of processes, the apparatus comprising:a portion configured to initially assign a number of tickets to each of the plurality of processes;a portion configured to assign a priority to each of the plurality of processes in accordance with the number of tickets assigned to each process;and a portion configured to execute the plurality of processes in an order indicated by the tickets assigned to the plurality of processes, so that the proportion of execution time between any two of the processes is the same as the proportion between the number of tickets of the two processes.
  10. 17
    An apparatus that proportionally shares at least one processor between a plurality of threads of a plurality of multi-threaded applications, the apparatus comprising:a portion configured to initially assign respective numbers of tickets to each of the plurality of multi-threaded applications;a portion configured to assign a priority to each of the plurality of multi-threaded applications in accordance with a number of tickets assigned to each multi-threaded application;a portion configured to add a thread of at least one of the plurality of multi-threaded applications to a dispatch queue when room becomes available for another thread on a dispatch queue;and a portion configured to add a thread of at least one of the plurality of multi-threaded applications to a ticket queue, when there is not room for another process on the dispatch queue.