From: Walton Hoops Date: 2010-01-16T05:15:08+09:00 Subject: Re: How to know the OS architecture (32 or 64 bits)? On 1/15/2010 1:10 PM, Luis Lavena wrote: > On Jan 15, 1:40 pm, Walton Hoops wrote: > >> On 1/15/2010 9:36 AM, Walton Hoops wrote: >> >> >> >> >>> On 1/14/2010 4:12 PM, I�aki Baz Castillo wrote: >>> >>>> Hi, is there a reliable way under Ruby to know the OS architecture >>>> (32 or 64 >>>> bits)? >>>> >> >>>> I've just found RUBY_PLATFORM constant which returns "x86_64-linux" >>>> under 64 >>>> bits, however it doesn't send very reliable for me. >>>> >> >>>> I need a way working under Linux and BSD. Thanks for any suggestion. >>>> >> >>> I can't vouch for how accurate it is, but an OS gem was recently >>> announced on this list. >>> gem install os >>> >> >>> irb(main):001:0> require 'os' >>> => true >>> irb(main):002:0> OS.bits >>> => 64 >>> irb(main):004:0> OS.posix? >>> => true >>> irb(main):005:0> >>> >> Hmm.. it does not appear to deal with 32-bit ruby running on a 64 bit >> system though. >> On my Windows 7 x64 (with 32-bit ruby): >> irb(main):005:0> OS.bits >> => 32 >> irb(main):006:0> 1.size >> => 4 >> irb(main):007:0> >> > No matter how many bits the OS has, as long the compiled interpreter > is 32 bits, the returned values is going to be 32 bits. > > Windows can run 32bits applications along with 64bits ones, but that > doesn't mean you can access 64bits address space or tools from 32bits > applications. > > -- > Luis Lavena > > Ah! But this tool doesn't claim to tell me about my address space or runtime enviornment, but rather my _OS_. Just because I'm in a 32-bit app, doesn't mean I may not care that I'm on a 64-bit os.