Go to main content

Administering Resource Management in Oracle® Solaris 11.4

Exit Print View

Updated: August 2018
 
 

Example: How to Set the Maximum Number of LWPs for Each Task in a Project

This procedure adds a project named x-files to the /etc/project file and sets a maximum number of LWPs for a task created in the project.

  1. Assume the root role.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.4.

  2. Create a project called x-files and set the maximum number of LWPs for each task created in the project to 3.
    $ projadd -K 'task.max-lwps=(privileged,3,deny)' x-files
  3. View the entry in the /etc/project file by using one of the following methods:
    • Run the project -l command.
      $ projects -l
      system
              projid : 0
              comment: ""
              users  : (none)
              groups : (none)
              attribs: 
      …
      x-files
              projid : 100
              comment: ""
              users  : (none)
              groups : (none)
              attribs: task.max-lwps=(privileged,3,deny)
    • Display the /etc/project file contents.
      $ cat /etc/project
      system:0:System:::
      …
      x-files:100::::task.max-lwps=(privileged,3,deny)
Example 1  Sample Session

After implementing the steps in this procedure, when the user creates a new task in project x-files by joining the project with newtask, the user will not be able to create more than three LWPs while running in this task. This is shown in the following annotated sample session.

$ newtask -p x-files csh

$ prctl -n task.max-lwps $$
process: 111107: csh
NAME    PRIVILEGE    VALUE    FLAG   ACTION            RECIPIENT
task.max-lwps
        usage            3
        privileged       3       -   deny                      -
        system       2.15G     max   deny                      -
$ id -p
uid=0(root) gid=1(other) projid=100(x-files)

$ ps -o project,taskid -p $$
 PROJECT TASKID
 x-files    73

$ csh        /* creates second LWP */

$ csh        /* creates third LWP */

$ csh        /* cannot create more LWPs */
Vfork failed
$