Home > Articles > Operating Systems, Server > Solaris

  • Print
  • + Share This
This chapter is from the book

Choosing a Language

The program that makes up a resource type can use any programming language, but two in particular are more usable—C and the Korn shell (ksh).

C

The C programming language is a useful choice for developing resource type programs, since the programs themselves can be compiled and checked for errors before actually running them, which avoids the possibility of syntax errors causing problems on a live cluster.

Furthermore, there is a range of libraries available with the Sun Cluster environment that can be accessed with C, and the Data Service Development Library (DSDL) in particular can only be accessed from C (see Chapter 9, "Using the DSDL").

Additionally, when using a compiled language like C it is possible to distribute a binary-only version of your agent. This may be important if you need to retain the intellectual property or if you want to be sure that the end user of the agent cannot change the code.

When writing an agent using C, it's important to use the correct libraries and header files. The exact paths will vary depending on whether you are using the DSDL or the basic resource management API (RMAPI). The chapters describing these facilities (Chapters 7 and 9) explain how to find and specify the correct paths to libraries and headers.

Korn Shell

Although the Sun Cluster environment provides API-like commands that can be accessed from any shell (including Bourne shell, bash, tcsh, and so forth), the SunPlex Agent Builder provides a way to automatically generate Korn shell (ksh) programs.

Shell programs are useful for prototyping a resource type, since they are easy to edit and modify, even on live cluster systems. In addition, it is not necessary to install a compiler to use shell programs.

On the other hand, agents developed with shell programs must be shipped to end users with readable source code (the scripts themselves), so if retaining intellectual property is a concern, or if you don't want users to be able to change the scripts, you should use C instead.

Others

There's nothing stopping you from using another programming or scripting language to develop the programs used by your agents. In particular, you may want to use C++ instead of C or you may prefer a full-featured scripting language like Perl instead of ksh. If you do choose to use a different language, however, you must find your own way of accessing information about the cluster because there are, for example, no native C++ libraries or Perl modules provided at the time of writing.

  • + Share This
  • 🔖 Save To Your Account