Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool2.mu.edu!uwm.edu!mrsvr.UUCP!kohli@gemed.ge.com From: kohli@gemed (Jim Kohli) Newsgroups: comp.unix.questions Subject: Re: determining size of physical memory Keywords: core, physical memory, size of core Message-ID: <3318@mrsvr.UUCP> Date: 28 Dec 90 23:35:36 GMT References: <1990Dec27.202715.27688@Neon.Stanford.EDU> <1368@prcrs.UUCP> <7325@plains.NoDak.edu> Sender: news@mrsvr.UUCP Reply-To: kohli@gemed.ge.com (Jim Kohli) Followup-To: comp.unix.questions Organization: GE Medical Systems, Applied Sciences Lab Lines: 31 In article <7325@plains.NoDak.edu>, bakke@plains.NoDak.edu (Jeffrey P. Bakke) writes: >In article <1990Dec27.202715.27688@Neon.Stanford.EDU>, hitt@Neon.Stanford.EDU (Daniel Hitt) writes: >> Is there a standard UNIX program or system call that determines >> the size of the physical memory of the machine on which it is >> running? >> >> I'd like to be able to do this on Ultrix, SunOS, and the NeXT OS, >> and possibly HP-UX. > >Well, I'm not positive that this is the best way or the that it will work >correctly under all instances but if you have read access to the /dev/mem >(or /dev/kmem) you might just try >'wc -c < /dev/mem' using the word count program to count the number of >bytes. I've found on most systems that it will return the correct physical >memory size (not swap space though). > While in theory this should work, there seems to be a problem with SunOS 4.01-- the /dev/mem driver gives you an early EOF indicating fewer bytes than there really are. I don't know if it's fixed in SunOS 4.1. There's approach also presents the problem of needing to run as root, since /dev/mem is (or SHOULD BE) read-protected. It would be nice if there was a way to find out how much physical memory there is in a Sun without rebooting. Jim Kohli