Thanks Vladimir!
So I suppose if I'm looking to determine if the process can only ever
run in uniprocessor mode, I should probably be looking at the
_CONFIG_NPROC_MAX value, right?
--
- Keith
Vladimir Kotal wrote:
Keith McGuigan wrote:
Is it possible for the value returned by this to change over the
lifetime of an application? Even in a zone? The current
documentation doesn't say anything about return values being fairly
constant, though I've found some old documentation that does.
I think I've run into a situation where this returns 1, but then later
the application runs in SMP mode (in a zone with "dedicated-cpus:
ncpus 1-2"). Is this supposed to be possible?
Also, what's the difference between _SC_NPROCESSORS_CONF and
_SC_PROCESSORS_MAX?
The code from usr/src/uts/common/syscall/sysconfig.c sheds some light:
103 case _CONFIG_NPROC_CONF:
104 return (zone_ncpus_get(curproc->p_zone));
105
106 case _CONFIG_NPROC_ONLN:
107 return (zone_ncpus_online_get(curproc->p_zone));
108
109 case _CONFIG_NPROC_MAX:
110 return (max_ncpus);
The ONLN value is clear, enabling/disabling (virtual) CPU (via
psradm(1M)) affects this value during run time.
The MAX value expresses maximum number of (virtual) CPUs for given
architecture. E.g. for my lab T1000 system (with 24 virtual CPUs) it
reports the value of 256. For my workstation with Intel Core 2 (with 2
cores) it reports 2. This value is set during boot sequence and cannot
change during run time it seems.
The CONF value depends on the configuration of the system per
usr/src/uts/common/os/zone.c:
2660 /*
2661 * Get the number of cpus visible to this zone. The system-wide
global
2662 * 'ncpus' is returned if pools are disabled, the caller is in the
2663 * global zone, or a NULL zone argument is passed in.
2664 */
2665 int
2666 zone_ncpus_get(zone_t *zone)
2667 {
2668 int myncpus = zone == NULL ? 0 : zone->zone_ncpus;
2669
2670 return (myncpus != 0 ? myncpus : ncpus);
2671 }
Given poolcfg(1M) can transfer CPUs from one set to another one it seems
this value can change during run time if the zone in question is
configured with CPU pools.
Also, DR (Dynamic Reconfiguration) which is available on the high-end
systems can tinker with number of CPUs during run time I believe.
v.
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code