home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.convex
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!sol.ctr.columbia.edu!eff!news.oc.com!convex!convex!schnoebe
- From: schnoebe@convex.com (Eric Schnoebelen)
- Subject: Re: is there a system call to return the number of processor?
- Originator: schnoebe@duke
- Sender: usenet@news.eng.convex.com (news access account)
- Message-ID: <1993Jan22.192314.10228@news.eng.convex.com>
- Date: Fri, 22 Jan 1993 19:23:14 GMT
- Distribution: usa
- References: <1993Jan22.061023.12840@convex.com>
- Nntp-Posting-Host: duke.convex.com
- Organization: C Series System Sofware, CONVEX Computer, Richardson, Tx. USA
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 42
-
- [Someone noted that I managed to mangle one of the rlimit structure
- field names, as well as the spelling of concurrency. I've corrected
- both, and canceled the earlier article -- Eric ]
-
- rosenkra@convex.com (William Rosenkranz) writes:
- - In article <1993Jan19.132612.4970@wl.com> agrafiot@wl.com (Dimitris Agrafiotis) writes:
- - >Is there a system call that returns the number of processors available
- - >on a convex?
- - >Thanks
- -
- - getsysinfo(2) does report the number of CPUs in the box. however, if you
- - have set "limit concurrency n" from the shell to a lesser number, you can
- - also do a limit command from within a program to find out the number of
- - processes actually used (note that i don't know the behavior if your
- - launching shell is sh or ksh, i just know this works if it is csh):
-
- A much better way to get the resource limits in an application
- is to use getrlimit(2). Starting up a Cshell is such a waste!
-
- A small sample routine to get the concurrency limit of the
- current process:
-
- #include <sys/time.h>
- #include <sys/resource.h>
- #include <stdio.h>
-
- int main()
- {
- struct rlimit info;
-
- if(getrlimit(RLIMIT_CONCUR, &info)) {
- perror("rlimit");
- return 1;
- }
-
- printf("current concurrency: %d\n", info.rlim_cur);
- printf("max concurrency: %d\n", info.rlim_max);
- return 0;
- }
- --
- Eric Schnoebelen eric@cirr.com schnoebe@convex.com
- Life is the only game in which the object of the game is to learn the rules.
-