Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (2332 KB)
Chapter 6 Projects and TasksThis chapter discusses the project and task facilities of Solaris resource management. Projects and tasks are used to label workloads and separate them from one another. The project provides a network-wide administrative identifier for related work. The task collects a group of processes into a manageable entity that represents a workload component. OverviewTo optimize workload response, you must first be able to identify the workloads that are running on the system you are analyzing. This information can be difficult to obtain by using either a purely process-oriented or a user-oriented method alone. In the Solaris environment, you have two additional facilities that can be used to separate and identify workloads: the project and the task. Based on their project or task membership, running processes can be manipulated with standard Solaris commands. The extended accounting facility can report on both process usage and task usage, and tag each record with the governing project identifier. This process enables offline workload analysis to be correlated with online monitoring. The project identifier can be shared across multiple machines through the project name service database. Thus, the resource consumption of related workloads that run on (or span) multiple machines can ultimately be analyzed across all of the machines. ProjectsThe project identifier is an administrative identifier that is used to identify related work. The project identifier can be thought of as a workload tag equivalent to the user and group identifiers. A user or group can belong to one or more projects. These projects can be used to represent the workloads in which the user or group of users is allowed to participate. This membership can then be the basis of chargeback that is based on, for example, usage or initial resource allocations. Although a user must have a default project assigned, the processes that the user launches can be associated with any of the projects of which that user is a member. Determining a User's Default ProjectTo log in to the system, a user must be assigned a default project. Because each process on the system possesses project membership, an algorithm to assign a default project to the login or other initial process is necessary. The algorithm to determine a default project consists of four steps. If no default project is found, the user's login, or request to start a process, is denied. The system sequentially follows these steps to determine a user's default project:
This logic is provided by the getdefaultproj() library function (see getprojent(3PROJECT)). project DatabaseYou can store project data in a local file, in a Network Information Service (NIS) project map, or in a Lightweight Directory Access Protocol (LDAP) directory service. The /etc/project database or name service is used at login and by all requests for account management by the pluggable authentication module (PAM) to bind a user to a default project. Note - Updates to entries in the project database, whether to the /etc/project file or to a representation of the database in a network name service, are not applied to currently active projects. The updates are applied to new tasks that join the project when login(1) or newtask(1) is used. PAM SubsystemOperations that change or set identify include logging in to the system, invoking an rcp or rsh command, using ftp, or using su. When an operation involves changing or setting identity, a set of configurable modules is used to provide authentication, account management, credentials management, and session management. The account management PAM module for projects is documented in the pam_projects(5) man page. The PAM system is documented in the man pages pam(3PAM), pam.conf(4), and pam_unix(5). Name Service ConfigurationResource management supports the name service project database. The location where the project database is stored is defined in /etc/nsswitch.conf. By default, files is listed first, but the sources can be listed in any order.
If more than one source for project information is listed, the nsswitch.conf file directs the routine to start searching for the information in the first source listed. The routine then searches subsequent databases. For more information on /etc/nsswitch.conf, see "pam_unix" in System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP) and nsswitch.conf(4). Local project File FormatIf you select files as your project database in nsswitch.conf, the login process searches the /etc/project file for project information (see projects(1) and project(4)). The project file contains a one-line entry for each project recognized by the system, of the following form:
The fields are defined as follows.
Note - Routines that read this file halt when they encounter a malformed entry. Any project assignments that are specified after the incorrect entry are not made. This example shows the default /etc/project file:
This example shows the default /etc/project file with project entries added at the end:
To add resource controls to the /etc/project file, see "Using Resource Controls". Name Service Configuration for NISIf you are using NIS, you can specify in the /etc/nsswitch.conf file to search the NIS maps for projects:
The NIS map, either project.byname or project.bynumber, has the same form as the /etc/project file:
For more information, see System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP). Directory Service Configuration for LDAPIf you are using LDAP, you can specify in the /etc/nsswitch.conf file to search the LDAP entries for projects.
For more information, including the schema for project entries in an LDAP database, see "project" in System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP). TasksWith each successful login into a project, a new task that contains the login process is created. The task is a process collective that represents a set of work over time. A task can also be viewed as a workload component. Each process is a member of one task, and each task is associated with one project. Figure 6-1 Project and Task Tree
All operations on sessions, such as signal delivery, are also supported on tasks. You can also bind tasks to processor sets and set their scheduling priorities and classes, which modifies all current and subsequent processes in the task. Tasks are created at login (see login(1)), by cron(1M), by newtask(1), and by setproject(3PROJECT). The extended accounting facility can provide accounting data for processes that is aggregated at the task level. Commands Used to Administer Projects and Tasks
Command Options Used With Projects and TaskspsUse ps -o to display task and project IDs. For example, to view the project ID, type the following:
idUse id -p to print the current project ID in addition to the user and group IDs. If the user operand is provided, the project associated with that user's normal login is printed:
pgrep and pkillTo match only processes with a project ID in a specific list, type the following:
To match only processes with a task ID in a specific list, type the following:
prstatTo display various statistics for processes and projects that are currently running on your system, type the following:
To display various statistics for processes and tasks that are currently running on your system, type the following:
Note - The -J and -T options cannot be used together. Using cron and su With Projects and TaskscronThe cron command issues a settaskid to ensure that each cron, at, and batch job executes in a separate task, with the appropriate default project for the submitting user. Also, the at and batch commands capture the current project ID and ensure that the project ID is restored when running an at job. suTo switch the user's default project, and thus create a new task (as part of simulating a login) type the following:
To retain the project ID of the invoker, issue su without the - flag.
Project Administration ExamplesHow to Define a Project and View the Current ProjectThis example shows how to use the projadd and projmod commands.
How to Delete a Project From the /etc/project FileThis example shows how to use the projdel command to delete a project.
How to Obtain User and Project Membership InformationUse the id command with the -p flag to view the current project membership of the invoking process.
How to Create a New Task
How to Move a Running Process Into a New TaskThis example shows how to associate a running process with a different task and project. To perform this task, you must either be superuser, or be the owner of the process and be a member of the new project.
|
||||||||||||||||||||||||||||||||||||||||||