Projects

From pressy's brainbackup
Revision as of 11:01, 25 March 2011 by WikiSysop (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Projects

Overview

                              Old             Old       New         New
    Resource control          tunable         default   Max value   default
    ----------------------    -------------   -------   ---------   ----------
    process.max-msg-qbytes    msginfo_msgmnb  4096      ULONG_MAX   65536
    process.max-msg-messages  msginfo_msgtql  40        UINT_MAX    8192
    process.max-sem-ops       seminfo_semopm  10        INT_MAX     512
    process.max-sem-nsems     seminfo_semmsl  25        SHRT_MAX    512
    project.max-shm-memory    shminfo_shmmax  0x800000  UINT64_MAX  1/4 physmem
    project.max-shm-ids       shminfo_shmmni  100       2**24       128
    project.max-msg-ids       msginfo_msgmni  50        2**24       128
    project.max-sem-ids       seminfo_semmni  10        2**24       128

Not used anymore


    Shared Memory        Semaphores             Message-Queue
    --------------       --------------         ---------------
    shminfo_shmseg       seminfo_semmns         msginfo_msgmax 
    shminfo_shmmin       seminfo_semvmx         msginfo_msgssz 
    shminfo_shmmax*      seminfo_semmnu         msginfo_msgmni*
    shminfo_shmmni*      seminfo_semaem         msginfo_msgtql*
                         seminfo_semume         msginfo_msgmnb*
                         seminfo_semusz         msginfo_msgmap
                         seminfo_semmap         msginfo_msgseg
                         seminfo_semmsl*
                         seminfo_semopm*
                         seminfo_semmni*

values ending in * are technically obsolete, but if they are present in the /etc/system file then at boot the kernel will translate the values into global resource controls.

How to configure

# projadd -c "disc blabla" group.<name> 
# projmod -sK "project.max-shm-memory=(privileged,2g,deny)" \ group.<name>
# projects -l 
# prstat -T  
# id -p
# prctl -n project.max-shm-memory -i process $$

To set the user's default project (/etc/user_attr):

# usermod -K project=<proj> <user> 

Change & Modify

# prctl -n project.max-shm-memory -r -v 4g -i project <proj-name>
# projmod -rK "project.max-shm-memory=(privileged,2g,deny)" user.pressy
# projmod -rK project.max-shm-memory <proj-name>
# projdel <proj-name>

To start up a process under a project, run:

newtask -p <project> command

A running process can be associated with the project:

newtask -v -p <project> -c <PID> 

Test it

Eat some memory (eg. 100MB)

# perl -e '$a = "pressy" x 8_200_000; sleep 3600' &

Burn CPU

# perl -e 'while (true){$x=sqrt(2.0);}'
# perl -e 'while (1) { \$cpuflog++ }