summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-02-26 21:06:38 +0100
committerMaciej Wereski <m.wereski@partner.samsung.com>2015-04-02 17:24:19 +0200
commit9d52feac44dccc20209d24c3d1f411c27b7cb92c (patch)
treef4531ca6c9415243ea4e60daea5e79a883cd8362 /README
parent4c81a23b1f43cd1a662da67a8e437b0ea156241a (diff)
downloadlinux-3.10-9d52feac44dccc20209d24c3d1f411c27b7cb92c.tar.gz
linux-3.10-9d52feac44dccc20209d24c3d1f411c27b7cb92c.tar.bz2
linux-3.10-9d52feac44dccc20209d24c3d1f411c27b7cb92c.zip
kdbus: add walk-through user space example
Provide a walk-through example that explains how to use the low-level ioctl API that kdbus offers. This example is meant to be useful for developers who want to gain a in-depth understanding of how the kdbus API works by reading a well-documented real-world example. This program computes prime-numbers based on the sieve of Eratosthenes. The master sets up a shared memory region and spawns workers which clear out the non-primes. The master reacts to keyboard input and to client-requests to control what each worker does. Note that this is in no way meant as efficient way to compute primes. It should only serve as example how a master/worker concept can be implemented with kdbus used as control messages. The main process is called the 'master'. It creates a new, private bus which will be used between the master and its workers to communicate. The master then spawns a fixed number of workers. Whenever a worker dies (detected via SIGCHLD), the master spawns a new worker. When done, the master waits for all workers to exit, prints a status report and exits itself. The master process does *not* keep track of its workers. Instead, this example implements a PULL model. That is, the master acquires a well-known name on the bus which each worker uses to request tasks from the master. If there are no more tasks, the master will return an empty task-list, which casues a worker to exit immediately. As tasks can be computationally expensive, we support cancellation. Whenever the master process is interrupted, it will drop its well-known name on the bus. This causes kdbus to broadcast a name-change notification. The workers check for broadcast messages regularly and will exit if they receive one. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Djalal Harouni <tixxdz@opendz.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions