Technical Note TN2083: Daemons and Agents
The Client/Server Model If you do split your program into multiple components, try to use the client/server model. Specifically, remember that clients connect to servers, and not the other way around. This might sound obvious, but it's easy to forget this point and find yourself in the weeds. In this context, a server is the background program that contains the global state that's being shared, while the clients are the programs that want to access that state. The server might be an agent (if all of the clients run in the same login session), or it might be a daemon (if it handles clients from multiple login sessions, or it handles other daemons as clients); the key point is that there is a one-to-many relationship between the server and its clients. In this design, the server should not try to discover or connect to the clients. Rather, the clients should connect to the server. This approach is a good match for the common inter-process communication (IPC) APIs. For example, if you're using UNIX domain sockets, it's easy for a daemon to listen on a single UNIX domain socket and have the clients connect to that socket. It's also easy for the server to handle a client disconnecting (either because it quit or because it died unexpectedly). If you do things the other way around, things start to get messy.
os  x  agent  launchd  from delicious
january 2014
3d 3dscanner agent angularjs application.boost async aws bigdata binary boost c c++ calculator chef circuits clojure conversion cprogramming crash d3 database decks devops ecmascript6 electronics elixir emacs es6 fourier functional git github gui hex icons ja javascript jit json keyboard launchd learning lisp lua machine_learning math mixins mouse novelwriting optimization os osx parsing partitions peg performance postgresql ppt presentations prog programming programming/c promises rails search security snowflakemethod threading ticketing tutorials typing ui usability ux video virtualization websockets writing x

Copy this bookmark:



description:


tags: