Patent ID: 8006005
Filing Date: 2011-08-23
Classification: G06F

Abstract:
1. A centralized polling system for providing constant time select call functionality to a plurality of polling tasks in an operating system kernel, comprising a non-transitory computer-readable medium including: a system interface to the operating system kernel providing a callback function for returning active sockets and corresponding read/write event types; a data structure for maintaining a profile for each of said polling tasks including a service number associated with each of said polling tasks, and current read and write ready sockets for each of said polling tasks, said data structure further includes a socket-read and socket-write byte mask corresponding to read/write event types for each one of said polling tasks, each said socket-read and socket-write byte mask being indexed by an associated file descriptor subscribed to by said one of said polling tasks and containing the associated service number therefore, and a service list containing polling records indexed by each said service number, each of said polling records includes a task ID for identifying said one of said polling tasks, and circular socket-read and socket-write stores containing current read and write ready sockets for said one of said polling tasks, and wherein each of said circular socket-read and socket-write stores is indexed by a system pointer to a current available entry for said callback function to write a file descriptor for which an I/O ready event has arrived, and a user pointer to a current available entry for said one of said polling tasks to read; and an application programming interface for registering said polling tasks, receiving said active sockets and said corresponding read/write event types via said system interface, updating said profile within said data structure for each of said polling tasks, and returning said current read and write ready sockets to respective ones of said polling tasks in a time that is not related to total number of sockets being polled, and further including code for (i) registering each said one of said polling tasks for socket services and in response allocating said associated service number and task ID, (ii) de-registering each said one of said polling tasks from said socket services, (iii) adding said associated file descriptor to said socket-read and socket-write byte mask for each of said read/write event types, respectively, (iv) for clearing said associated file descriptor from said socket-read and socket-write byte mask for each of said read/write event types, respectively, (v) determining a total number of said active sockets corresponding to said read/write event types, (vi) returning said active sockets corresponding to said read/write event types to respective ones of said polling tasks, and (vii) accessing each respective one of said polling records via said associated service number, writing said file descriptor to an appropriate entry of the associated circular socket-read store pointed to by said system pointer, and incrementing said system pointer, thereby preventing an add-racing-condition.