Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Installing new memory.  (Read 3712 times)

0 Members and 1 Guest are viewing this topic.

technology_forever

    Topic Starter


    Rookie

  • where there's a will, there's a way
    Installing new memory.
    « on: May 03, 2008, 03:11:07 AM »

    Hello guys,

    i'm reading an operating system book and i was wondering about when we install a new memory to a pc.
    do number of frames increase ? and who / how is this taken care of.


    some clarification:


    i'm talking about "vitual memory / Paging: memory address and mapping". where :
      1-memory is divided into non contiguous partitions called frames.
      2-process virtual address is divided into pages
      3-pages and frames are of equal size
      4-there is page table that maps pages in processes to frames in main memory

    Thank you for your attention :)

    Kurtiskain



      Mentor

      Thanked: 58
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Installing new memory.
    « Reply #1 on: May 03, 2008, 04:33:26 AM »
    wow um let em try get my head around this...if you are saying...does virtual memory increase when more RAM is added to a computer?

    my answer is yes...because I cant remember the exact amount but there is a certain ratio windows tries to have as virtual compared to physical memory.

    and oddly enough...it works in the oppositte way to the way you think it would.

    the more ram you have, the more virtual memory is reccommended by windows.

    For instance, the computers at my school have 256MB ram...and the recommended virtual memory is around 300MB...however I have 768MB of ram and windows recommends 1154MB for me, which means when you add more RAM, Virtual memory will increase, resulting in the size of the page file increasing, meaning it will have to create more pages, and therefore frames to be ready to be used when called upon :)

    Anybody correct me if I am wrong but thats my answer :)

    Kurtis

    technology_forever

      Topic Starter


      Rookie

    • where there's a will, there's a way
      Re: Installing new memory.
      « Reply #2 on: May 03, 2008, 06:45:30 AM »

      well , i see! you are saying that when we add more ram , the virtual memory increases.

      but cant it be ? i mean..shouldn't the virtual memory be "somehow" of fixed size ?

      i read that if i have, for example,  a 32-bit processor, the maximum virtual memory a process can get is 2^32.
      i'm not sure why ..but im 100% sure i read it in on of the articles i came across.

      i also read dat a 32-bit processor means that the processor can process 32-bits per cycle.

      what did they mean by "process"? did they mean "fetch-decode-execute ?" and why is it that if a process can executes 32 bit per cycle,  maximum virtual memory a process can get is 2^32?

      thank you :)

      Kurtiskain



        Mentor

        Thanked: 58
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: Installing new memory.
      « Reply #3 on: May 03, 2008, 07:16:44 AM »
      You can set the virtual memory size, yes, and it is recommended you set it to a fixed size, but windows by default changes it to suit what it thinks your computer needs.

      Quote from Wikipedia:

      "However, the page file only expands when it has been filled, which, in its default configuration, is 150% the total amount of physical memory." (that is with the Windows NT series eg, NT Workstation, 2000 and XP)

      so lets see it i am right... 50% of 768 is 384 so 150% is 768+384=1152MB...which is 2MB off what windows recommends to me :)

      for 256MB... 50% is 128 so 150% = 256+128=384...which i told you the computers at school ask for only 300 and something...

      and yes the 32 bits per cycle is correct because that is how 'wide' the bandwith path is.

      Say you had a stretch of road that is 4 lanes wide, and one full cycle would be 4 cars coming on as four cars come off, and if we make the cycle time being a second. the road would be 4-bit as it can only take 4 cars on to "process" a second :)

      so a bit is either a 1 or a 0, right? so in saying that, our road can take 4 1's or 0's at once during each second :)

      now our 32-bit cpu takes 32 1's or 0's a second, and the cycle time depends on the speed of the CPU...for instance a 1GHz (1000mhz) hz > mhz is 10^6.. so hz would = 1000x10^6 = 1000000000 cycles per second

      which means in total... our 32-bit 1Ghz CPU can take 32*1000000000 = 32000000000 1's or 0's per second.

      now with your fetch-decode-execute things...i believe it only means decode and execute, because different machines FSB speeds will generate different fetch/throughput speeds, though the CPU and FSB run at the same clock rate, if you compared two different machines, one with a slower fsb than the other...lets take a older one to show the difference... a 100Mhz FSB computer, compared to a 133Mhz FSB computer.

      The only difference you will notice here is if you exceed that of the 100Mhz data input per second and in which case the 133Mhz FSB computer will be better as it can feed 33Mhz of data a second more then the 100Mhz computer...now in saying this, you wouldhave to have identical processors to see this effect :)

      now with the virtual memory stuff...the virtual memory speed will be limited to the speed of the drive at which it is stored...if you didnt know, hard drives transfer at different speeds to the cpu and everything else, ranging from 25Mhz (UDMA 1) back then to 300Mhz (sata II) nowadays.

      Im guessing this as a older article as 2^32 is 4294967296bits = 4294.967296Mhz a sec...which I dont understand...It has me lost  :P ??? :-[ and i shall do some research quickly now :)

      copied from wikipedia...it makes a bit of sense to me might make more to you :)

      Contents of a memory location

      Each memory location, in both ROM and RAM memory, holds a generic binary number of some sort. How it is interpreted, its type, and meaning, and usage, only depends on the context of the instructions which retrieve and manipulate it. Each such coded item has a unique physical position which is described by another unique binary number, the address of that single word, much like each house on a street has a unique number. A pointer is an address itself stored, as data, in some other memory location.

      The interesting concept about items stored in memory: not only they can be interpreted as data—text data, binary numeric data, and so forth—but also as instructions themselves, in a uniform manner. This uniformity was introduced with von Neumann architecture and is prevalent in computers since the 1950s.

      Instructions in a storage address are contextually interpreted as command words to the system's main processing unit, and data is retrieved by such instructions placed in an internal and isolated memory structure called a storage register, where the subsequent instruction can manipulate it in conjunction with data retrieved into other internal memory locations (or internal addresses). Registers are the memory addresses within the part of the central processing unit known as the arithmetic logic unit (ALU), which responds to binary instructions (machine code) fetched into instruction registers selecting combinatorial logic determining which data registers should be added, subtracted, circulated (shifted), and so forth at the low machine language level of binary manipulation of data.

      [edit] Word size versus address size

      A word size is characteristic to a given computer architecture. It denotes the number of bits that a CPU can process at one time. Historically it has been sized in multiples of four and eight bits (nibbles and bytes, respectively), so sizes of 4, 8, 12, 16, 24, 32, 48, 64, and larger came into vogue with technological advances.

      Very often, when referring to the word size of a modern computer, one is also describing the size of address space on that computer. For instance, a computer said to be "32-bit" also usually allows 32-bit memory addresses; a byte-addressable 32-bit computer can address 232 = 4,294,967,296 bytes of memory, or 4 gibibytes (GiB). This seems logical and useful, as it allows one address to be efficiently stored in one word.

      However, this is not always the case. Computers often have memory addresses larger or smaller than their word size. For instance, almost all 8-bit processors, such as 6502, supported 16-bit addresses, or else they would have been limited to a mere 256 byte capacity. Similarly, the 16-bit Intel 8086 supported 20-bit addressing, allowing it to access 1 MiB rather than 64 KiBs of memory. Also popular Pentium processors since introduction of Physical Address Extensions (PAE) support 36-bit physical addresses, while generally having only a 32-bit word.

      A modern byte-addressable 64-bit computer—with proper OS support—has the capability of addressing 264 bytes (or 16 exbibytes) which as of 2007 is considered practically unlimited, being far more than the total amount of RAM ever manufactured.

      [edit] Virtual memory versus physical memory

          Main article: Virtual memory

      Virtual memory is a mapping of real memory to page tables. The purpose of virtual memory is to abstract memory allocation, allowing the physical space to be allocated as is best for the hardware (that is usually in non-contiguous blocks), and still be seen as contiguous from a program perspective. Virtual memory is supported by some operating systems (for example, Windows but not DOS) in conjunction with the hardware. It is possible to think of virtual memory as a filter, or an alternate set of memory addresses (that are mapped to real address) that allow programs (and by extension, programmers) to read from memory as quickly as possible without requiring that memory to be specifically ordered. Programs use these contiguous virtual addresses, rather than real, and often fragmented, physical addresses, to store instructions and data. When the program is actually executed, the virtual addresses are translated on the fly into real memory addresses. Logical address is a synonym of virtual address.


      Virtual memory also allows enlarging the address space, the set of addresses a program can utilize and thus allows computers to make use of secondary storage that looks, to programs, like main memory. For example, virtual address space might contain twice as many addresses as main memory with the extra addresses mapped to hard disk space in the form of a swap file (also known as page file). It copies them back (called swapping) into main memory as soon as they are needed. These movements are performed in the background and in a way invisible for programs.

      hope all of this helps :)

      Kurtis

      technology_forever

        Topic Starter


        Rookie

      • where there's a will, there's a way
        Re: Installing new memory.
        « Reply #4 on: May 03, 2008, 09:40:21 AM »
        WAOW, that was EXTREMLY helpful! thank you so much.
        lots of things are clearer in my head now.

        i still have this confusion, i copy-paste :

        "very often, when referring to the word size of a modern computer, one is also describing the size of address space on that computer. For instance, a computer said to be "32-bit" also usually allows 32-bit memory addresses; a byte-addressable 32-bit computer can address 232 = 4,294,967,296 bytes of memory, or 4 gibibytes (GiB) "

        what does it mean ..32-bit computer can "address" 232 = 4,294,967,296 bytes of memory?
        what do they mean by the use of "address" verb.?

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: Installing new memory.
        « Reply #5 on: May 03, 2008, 11:46:04 AM »
        basically you can replace it with the word "use"- a 32-bit processor cannot "Address" more then that amount of memory- it is somewhat analogous to street numbers on houses, if we only used one number, you could only "address" 9 houses on a block. Since computers use binary, they use only 1's and 0's for the memory "street addresses", and they are 32-digits long.

        also, it is interesting to note that the word size (Ie, 32-bit) that a processor accepts does not necessarily dictate the size of memory it can address (again, use is a comparable synonym), but rather the address space of the processor. As a quick example, the Pentium Pro Processor was a 32-bit processor, but had a 64-bit address space (I believe) and could thus address up to 2^64 or err- a lot of memory! (I believe 4TB, not sure)

        EDIT: I looked below and part of the Wikipedia article kind of explains this. Oh well.


        Of course it generally isn't theoretically possible to install the maximum addressable amount of memory in a computer not just because it would be prohibitively expensive but also because of motherboard limitations. Even though the Pentium processor could address 4 gigs of RAM, generally motherboards of the time maxed out at a measly 64 megabytes, and even if a renegade board allowed the installation of more RAM, the chipset Intel provided to motherboard manf. for the Pentium could only cache the first 64 megabytes anyway, dramatically reducing performance if any more were installed. Of course, this was solved in later pentium chipsets.



        and re. kurtiskains post:


        so lets see it i am right... 50% of 768 is 384 so 150% is 768+384=1152MB...which is 2MB off what windows recommends to me :)


        that's right, but the reason it is off 2MB is because windows rounds up to the nearest multiple of 64MB- 1154/64=18

        but now I'm getting off topic.


        whew, I new all those long hours spent reading almost every single article in the April 2000 snapshot of the MSDN library would be useful some day!
        I was trying to dereference Null Pointers before it was cool.

        Kurtiskain



          Mentor

          Thanked: 58
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 10
        Re: Installing new memory.
        « Reply #6 on: May 03, 2008, 08:58:21 PM »
        haha yeah I cant even believe i got some of that myself...16 Year old student here lol so its still kinda over my head  ;D but yeah training to be a computer admin so gotta learn as much as possuble! :D

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: Installing new memory.
        « Reply #7 on: May 04, 2008, 10:13:59 AM »
        I didn't really do any research for that, so some of it might be wrong. Just taking it off the top of my head. I have no idea where I learned these things from at all. I think it all started around 6 or 7 years ago(I remember it like it was yesterday!) when I started batch programming on a 286 computer in my closet (yeah, a 286 in 2002. a bit sad...) which, BTW, could address 16MB of RAM. of which I had 1MB woopee! No windows for me either. DOS 6 and two 50MB hard drives yes, I said MB.


        I sometimes think back and wonder how I ever managed to do anything useful on my old computers.

        Hey! I still have the BIOS chips from the 286. I'm sure they will be worth something someday.

        strangely enough, 6 years ago I was 15.

        I think I followed this path:

        Batch files->QBasic->Visual Basic 2->Visual Basic 6... and uhhn, I have .NET but have yet to find a good reason to learn it.

        I also learned C++ and stuff which may explain why I learned all that memory stuff.

        Now if only I could get a tech job (!)
        I was trying to dereference Null Pointers before it was cool.

        technology_forever

          Topic Starter


          Rookie

        • where there's a will, there's a way
          Re: Installing new memory.
          « Reply #8 on: May 05, 2008, 06:06:06 AM »
          kurtiskain, are you serious you are only 16 ? and you "BC_programmer", you started at the age of 15 ! wow..guys you rock ;D ;D 

          well i have this question, who decides how many physical page a process should have in memory.
          in other words, who decides how many page entry a page table should have ?

          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Installing new memory.
          « Reply #9 on: May 05, 2008, 09:47:32 AM »
          the funny thing is the only reason I ever started was because my d**n parents god rid of my N64 and Super Nintendo!

          I'd still only have that 286 if it wasn't for my Computer Science Teacher in High school, who gave me all sorts of computer stuff. Not the least of which was my only recently promoted to former computer, an AMD K6-2

          I'm not sure what you mean when you ask how many physical page a process should have in memory- and are you asking who decides how many entries a pagetable should have?


          If memory serves, you can change the number of system PTEs with the registry key:

          HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
          and the pagedpoolsize and SystemPages entri... OMG I need a life. anyway, as I was saying...


          I don't quite understand your first question, but I think your asking what decides how much physical memory a process recieves.

          Since the windows Virtual Memory Manager (or any VMM, for that matter) is responsible for paging data to disk and back transparently, it is the VMM that decides what processes get more physical memory. In general, the more "active" an application is with dealing with memory, the more physical pages it will receive. There are exceptions however, for example, if a program allocated 32MB of ram without the volatile attribute (more on that later) and never used it, it's likely that the VMM will page it to disk, freeing the memory for applications that actually want to use the memory. If the memory is marked with volatile (this is the C/C++ keyword, don't know the actual tag used in the pagetable), it instructs the VMM to keep the page in physical RAM unless the system itself requires the memory

          As Far as I know, (at least with Windows) the kernel only has a certain number of PTE's.
          This is why if a driver leaks even a single PTE in any of it's driver functions, the system will crash with the "OUT_OF_SYSTEM_PTES" (or something like that) error. I'm not sure what the maximum is....

          Oh I was wrong, the actual error is NO_MORE_SYSTEM_PTES. I was close ;)

          The saddest thing about this is I haven't ever made a serious program in C or C++.


          And I'm actually not quite sure how old I was- I think it was grade 10 though- might have been Grade 9, not sure.

          darn it! I can remember my student ID but not which grade I started getting into computers and stuff!

          The last few years seemed to be h**l on everybody else, but gr 11 and 12 were when I actually started getting good grades. 100% in advanced placement computer science 12 when I was in grade 11(don't know how I got 100%, I did jack-diddly in that class. In fact I think I was just surfing the net half the time, and working on my "Poing!" game the rest of the time). I remember the teacher laughed quite heartily at some of my comments:

          'Oh, uh, this line of code does something, but I'm not sure. *censored* am I, your guide?

          'Ok, now we do stuff

          'once this loop is done, we can do it again for no reason.

          'I think thats the right variable...

          and my personal favorite:

          'determines the existence of a file. returns true if the file exists. Raises an error if one occurs. Also raises an error every second saturday, just to keep you on your toes.

          (alright, it might not be as funny as the others, but still...)

          anyway- any more questions? :D
          « Last Edit: May 05, 2008, 04:23:14 PM by BC_Programmer »
          I was trying to dereference Null Pointers before it was cool.

          technology_forever

            Topic Starter


            Rookie

          • where there's a will, there's a way
            Re: Installing new memory.
            « Reply #10 on: May 05, 2008, 10:10:57 AM »
            lol :D

            actually dat was really funny  ;D ;D

            i should try one of these in my code .lol  ;D

            listen, mind if i add you on msn ?

            looking forward to get to know you better  :)

            technology_forever

              Topic Starter


              Rookie

            • where there's a will, there's a way
              Re: Installing new memory.
              « Reply #11 on: May 05, 2008, 10:44:04 AM »
              meanwhile , i'll ask you here  ;D

              sorry my question wasn't clear.

              Let me try again. ( and plz correct me if any of the things i say are wrong )

              when i write a program and i compile it, the compiler will generate a virtual address for the process.
              (starting from 0) .

              This virtual address will be divided into pages, (lets say 10 pages from 0 to 9 ).

              The MMU will then create a page table for the process that maps the virtual adresses to physical addresses.
              this page table will be kept in memory as long as the program is still alive. ( once the program terminates or is killed, the partition in which the page table was in will be freed ).

              this page table will have a size. ( number of entries) .and each entry maps virtual memory to physical memory.


              As you pointed out, the system has certain number of PTE's , well let me stop a bit here. ::)

              i didnt know that, i thought that for each process, the MMU will create table with no restriction on its number of entries. because as i know ,the number of entries in a table, depends on the number of bits in the virtual address and the page size.

              since in a system the page size is the same and the number of bits in the virtual address is the same, then all the processes will have the same number of entries in their page table .... im confused ???

              what im saying is :

              Assume a page size is :  1KB (2^10)  and i need to map a 32-bit address.(2^32)
              so 2^22 is the number of entries that the page table will have ...right ? :-\

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: Installing new memory.
              « Reply #12 on: May 05, 2008, 05:07:04 PM »
              as for the underline- well I fixed it- I forgot that these posts use wacky html with square brackets instead of angle brackets! (woops)


              Anyway, I'm really not really knowledgable on memory management as far as the hardware is concerned. I can get around though- but with the software side I can pull all sorts of stuff out of my head (or *censored*, as the case may be). SO now I might learn something.

              Now, bearing that in mind, here are my attempts to amend some of your statements. Perhaps incorrectly. or perhaps correctly. But definitely not sideways. (what?...)

              OK, first, I was talkin' about VMM, and now you are talking about the MMU. But I don't think there is a chip in the computer called a "memory management unit".

              Almost all memory management occurs on the software side. Why, with a quick search I found an article in the MSDN that most likely is where I originally gleaned some of my info from at some point years ago:

              http://support.microsoft.com/kb/247904

              reading the article we learn that the 4GB address space is mapped into 2GB for the system and 2GB for the active process, which I imagine will be paged back and force depending on the active app.

              And now my head hurts!

              But I'll tackle one more! with the last q about the number of pagetable entries.  I don't think the system makes pagetable entries for every single addressable part of RAM-

              Don't worry that your question wasn't clear- I know where you live  I'm easily confused!

              also, my MSN is.. oh wait- not supposed to say here ha! I put it in my profile I think... I don't run Messenger a lot though. but yay! I'll have a grand total of three contacts! I could make that four- I wonder if I can add myself....

              well, I can't add myself (darn!) but I added you. So there u go!


              Also, don't worry, they purposefully make computers as confusing as possible to keep older folks wary of "them 'puters thar", they use fancy words like "eight track" and "rock & roll"... wait a second- what was I talking about again?
              I was trying to dereference Null Pointers before it was cool.