Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Upstart, Systemd, and SMF have many of these features now, but here's what launchd brings to the table:

1) It unifies several independent systems that shared a similar purpose:

- init

- crond

- atd

- inetd

- xinetd

2) It includes user-based daemon management.

- More structured than doing it in your shell's RC file.

3) Instead of writing a shell script, you set a series of properties in a plist (XML-based).

- It's parseable.

- Daemons can be interacted with programmatically using built-in tools like defaults, PlistBuddy, and launchctl.

4) It handles a lot of special dependencies:

- Network availability

- Disk or server availability

- Filesystem availability

- User Logins

- Kernel Extensions

5) It has built-in, live, event-based triggers with almost no overhead. It can watch for:

- Changes to a file or folder

- An item to appear in an empty directory (for queueing)

- A file system to mount

- A Mach message

- A connection to a stream socket

- Traffic to a datagram port

6) It manages respawn behavior. For example:

- Run when loaded and never quit.

- Run purely on demand

- Run once when loaded an on demand thereafter

- Run on demand based on a clean exit

7) Its strict conventions prevent processes from being disassociated from their parents.

- Easier to trace who did what (nice for security and troubleshooting)

- Easier for the OS to garbage collect.

- Centralizes a lot of daemon management

8) It has a defined separation of "execution contexts" based on:

- If it does something for the currently logged-in user or all users.

- If it will be used by one app or by multiple apps.

- If it needs to display a user interface or launch a GUI app.

For more info, checkout: http://developer.apple.com/technotes/tn2005/tn2083.html

EDIT: Formatting.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: