I have sun os there Following commands are not available


The only command which is working is kstat.

Can any one please help me on finding the total memory size using only kstat command on this machine?

  • Why wouldn't you have access to prtconf, prtdiag, or psrinfo? I'm tempted to post the psrinfo PERL script.... – Andrew Henle May 2 '16 at 23:12

The physmem value from the system_pages statistics will give you the number of pages the OS sees. You need to multiply this number by the default page size which can be 4K or 8K depending on your architecture:

$ kstat -n system_pages -p -s physmem |
    nawk -v pagesize=$(pagesize) '{print $2*pagesize/1024/1024 "MB"}'

Note that this might not match the real size of RAM installed as a portion of it might already be grabbed by the hardware before the OS boots.


You might be able to use:

echo "::memstat" |mdb -k

There's also lgrpinfo (man page):


lgrpinfo prints information about the locality group (lgroup) hierarchy and its contents.

An lgroup represents the set of CPU and memory-like hardware devices that are at most some distance (latency) apart from each other. All lgroups in the system are identified by a unique integer called an lgroup ID.

lgroups are organized into a hierarchy to facilitate finding the nearest resources. Leaf lgroups each contain a set of resources that are closest (local) to each other. Each parent lgroup in the hierarchy contains the resources of its child lgroups plus their next nearest resources. Finally, the root lgroup contains all the resources in the domain within the largest latency.

A Uniform Memory Access (UMA) machine is simply represented by the root lgroup. A Non Uniform Memory Access (NUMA) machine is represented by a hierarchy of lgroups to show the corresponding levels of locality. For example, a NUMA machine with two latencies (local and remote) has an lgroup hierarchy consisting of two levels with its leaves and the root.


On an Intel x86 machine (uniform memory access), lgrpinfo without any arguments will produce output similar to

bash-4.1$ lgrpinfo
lgroup 0 (root):
    Children: none
    CPUs: 0-15
    Memory: installed 48G, allocated 15G, free 33G
    Lgroup resources: 0 (CPU); 0 (memory)
    Load: 0.0445
    Latency: 0

Do you have either swap or mdb?

Maybe kstat :::physmem, which should give you the number of pages. (8K on SPARC, 4K on x86 in most situations)

  • Except page size on SPARC is 8K – myaut May 4 '16 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.