Home > Articles > Software Development & Management

This chapter is from the book

3.4 Memory

To the casual observer, memory systems appear to be the most elementary part of the computer. It seems to be simply a large number of identical computer chips which store data. This is, of course, far from reality.

The memory system or main memory, as it is typically described, is the crossroads of data movement in the computer. Data moving to and from caches moves through the memory system. Input and output devices such as magnetic disk, network devices, and magnetic tape all have the main memory system as the target of their output and the source of their input.

Computer hardware vendors have, by increasing address space capabilities, themselves caused memory capacity demands to increase. During the 70’s almost all computer vendors moved from 16-bit addresses to 32-bit. As we move into the next millennium, most computers will have 64-bit address spaces. As a result, memory systems that used to be measured in kilobytes (KB) are now measured in gigabytes (GB).

With the economies of scale in processors, multiprocessor computers have evolved from simply having two processors in the 80’s to configurations with literally thousands of processors. At the same time, memory systems are expected to be capable of “feeding” all these data-consuming processors.

So, while complexity in processor design has increased at a dramatic rate, memory systems have been driven to keep up with them—albeit unsuccessfully. Added to this pressure is the tremendous increase in multiprocessor systems that require not just faster memory systems, but larger capacity systems that allow overall performance to scale with the number of processors.

3.4.1 Basics of Memory Technology

Random access memory is by far the most popular memory chip technology today. It is described as random because it allows you to address any particular memory location without having to step through memory in sequential fashion until you arrive at the desired destination. Most memory systems today (including caches) consist of dynamic random access memory (DRAM) or static random access memory (SRAM).

DRAM is less expensive as it typically requires only a single transistor per bit. The downside is that, due their simplicity, the electrical charge must be periodically refreshed. Hence, DRAM can be periodically unavailable because it is being refreshed. SRAM doesn’t require periodic refreshes, which allows it to be faster but more complex—generally requiring five to six transistors per bit. The result is a more expensive piece of hardware.

There are two times that are important in measuring memory performance: access time and cycle time. Access time is the total time from when a read or write is requested until it actually arrives at its destination. Cycle time is the minimum time between requests to memory. Note that since SRAM does not need to be refreshed, there is no difference between access time and cycle time.

3.4.2 Interleaving

Simple memory system organizations using DRAM (which is most likely since it is less expensive than SRAM) result in each memory transaction’s requiring the sum of access time plus cycle time. One way to improve this is to construct the memory system so that it consists of multiple banks of memory organized so that sequential words of memory are located in different banks. Addresses can be sent to multiple banks simultaneously and multiple words can then be retrieved simultaneously. This will improve performance substantially. Having multiple, independent memory banks benefits single processor performance as well as multiprocessor performance because, with enough banks, different processors can be accessing different sets of banks simultaneously. This practice of having multiple memory banks with sequential words distributed across them in a round-robin fashion is referred to as interleaving. Interleaving reduces the effective cycle time by enabling multiple memory requests to be performed simultaneously.

The benefits of interleaving can be defeated when the memory access pattern is such that the same banks are accessed repeatedly. Let us assume that we have a memory system with 16 banks and that the computer uses cache lines which contain 4 words, with each word being 8 bytes in size. If the following loop is executed on this computer, then the same set of banks is being accessed repeatedly (since stride = 64 words = 16 * 4 words):

double *x; 
... 
stride = 64; 
sum = 0.0; 
for( j = 0; j < jmax; j++ ) 
{
  for( i = 0; i < imax; i++ ) 
    sum += x[i*stride + j]; 
} 

As a result, each successive memory access has to wait until the previous one completes (the sum of the access time and cycle time). This causes the processor (and hence the user’s program) to stall on each memory access. This predicament is referred to as a bank stall or bank contention.

Let’s revisit the sequence of code used in the previous TLB discussion:

for( j = 0; j < jmax; j++ ) 
{
  for( i = 0; i < imax; i++ ) 
    x[i*stride + j] = 1.1 + x[i*stride + j]; 
} 

First, fix imax at 16384 and jmax at 512 so that the problem size is 64 MB in size. In Figure 3-4, we show the average access time for various hardware platforms using several values of stride. Two sets of data are charted for the HP N-4000, one using 4 KB pages and another using 1 MB pages. Note the tremendous difference in performance for the N-4000 caused by TLB misses, as illustrated by the divergence in the graphs after a stride of 16. This data was generated using 8 KB pages on the SUN UE3500 and 16 KB pages on the SGI Origin 2000. Note that, even with 1 MB pages, the N-4000’s performance decreases after a stride of 8, indicating that memory bank contention is hindering performance.

03fig04.gifFigure 3-4. Memory access time as a function of word stride for various computers.

Page size does not just benefit applications that use a lot of data, it also benefits those that have a large text (i.e., instructions) segment. Electronic design simulations, relational database engines, and operating systems are all examples of applications whose performance is sensitive to text size.

How does one alter the page size for an executable? HP-UX provides a mechanism to change the attributes of an executable file. This can be accomplished by a system utility, chatr. For the tests discussed here, the executable was modified to request four KB data pages with the following command:

chatr +pd 4K ./a.out 

Similarly,

chatr +pd 1M ./a.out 

modified the executable to request 1 MB data pages.

Does this imply that all applications should use huge, say, one MB, pages to improve performance? Not necessarily. Consider the processes that are executing constantly (e.g., daemons) on a computer; usually there are a dozen or more. Daemons typically occupy only about 100 to 200 KB of memory and hence with 4 KB pages a couple dozen of them would use less than 5 MB of memory. However, if each of them were to use one MB pages, then they would each occupy at least one MB of memory per daemon for a total of 24 MB. Since these applications run constantly, the computer will be using 19 MB (24 - 5) of memory unnecessarily! So, it’s not always a good idea to use huge pages, but for applications that use a large amount of memory, it can give large boosts in performance.

3.4.3 Hiding Latency

With processor speeds improving at a faster rate than memory speeds, there have been multiple approaches to overcome delays due to memory accesses. One solution we’ve discussed is the creation of caches. Another successful approach enables processors to issue memory requests and continue execution until the data requested is used by another instruction in the program. This is referred to as stall-on-use. Another strategy is to enable prefetching of data either automatically (in hardware) or through the use of special prefetch instructions.

Processors implemented with stall-on-use which can issue multiple memory transactions can do a good job of hiding or reducing effective memory latency. For example, suppose such a processor is capable of issuing up to 10 memory transactions and the realizable memory latency is 200 clocks. Then the effective memory latency can be as little as 200 / 10 = 20 clocks!

Prefetching can also dramatically reduce effective memory latency. Note that if a prefetch instruction can be issued for data more than 200 clocks before the data is accessed by a regular memory instruction, then the memory latency will be reduced to that of the cache latency. This is because the delay of 200 clocks or more allows the data to be moved into the cache (i.e., prefetched).

Data prefetching can be accomplished with software or hardware. Some hardware platforms actually detect when a processor is accessing memory sequentially and will begin prefetching the data from memory into the processor’s cache without any other intervention. Most computers that support prefetching do so with software prefetching. This is typically done through the use of special instructions or instruction arguments. For example, PA-RISC 2.0 processors perform software prefetching by interpreting load instructions into a special register as prefetches.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020