Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8234855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:37:23+00:00 2026-06-07T18:37:23+00:00

Lets say my array is 32KB, L1 is 64 KB. Does Windows use some

  • 0

Lets say my array is 32KB, L1 is 64 KB. Does Windows use some of it while program is running? Maybe I am not able to use L1 because windows is making other programs work? Should I set priority of my program to use all cache?

for(int i=0;i<8192;i++)
{
  array_3[i]+=clock()*(rand()%256);//clock() and rand in cache too?
  //how many times do I need to use a variable to make it stay in cache?
  //or cache is only for reading? look below plz
  temp_a+=array_x[i]*my_function();
}

The program is in C/C++.

Same thing for L2 too please.

Also are functions kept in cache? Cache is read only? (If I change my array then it loses the cache bond?)

Does the compiler create the asm codes to use cache more yield?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:37:24+00:00Added an answer on June 7, 2026 at 6:37 pm

    How can i know my array is in cache?

    In general, you can’t. Generally speaking, the cache is managed directly by hardware, not by Windows. You also can’t control whether data resides in the cache (although it is possible to specify that an area of memory shouldn’t be cached).

    Does windows use some of it while program is running? Maybe i am not able to use L1 because windows is making other programs work? Should i set priority of my program to use all cache?

    The L1 and L2 caches are shared by all processes running on a given core. When your process is running, it will use all of cache (if it needs it). When there’s a context switch, some or all of the cache will be evicted, depending on what the second process needs. So next time there’s a context switch back to your process, the cache may have to be refilled all over again.

    But again, this is all done automatically by the hardware.

    also functions are kept in cache?

    On most modern processors, there is a separate cache for instructions. See e.g. this diagram which shows the arrangement for the Intel Nehalem architecture; note the shared L2 and L3 caches, but the separate L1 caches for instructions and data.

    cache is read only?(if i change my array then it loses the cache bond?)

    No. Caches can handle modified data, although this is considerably more complex (because of the problem of synchronising multiple caches in a multi-core system.)

    does the compiler create the asm codes to use cache more yield?

    As cache activity is generally all handled automatically by the hardware, no special instructions are needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a simple 1D array with 10-20 entries. Some will be
I have an Array with some String objects lets say months. [October] [May] [July]
Lets say that I have an array of 4 32-bit integers which I use
Lets say i have an Array collection, filled with some elements. If i say
How can I return an response (lets say an array) to the client with
I have an array lets say a = { 1,4,5,6,2,23,4,2}; now I have to
lets say i have one array a = numpy.arange(8*6*3).reshape((8, 6, 3)) #and another: l
Lets say I have an array numbers that contains the following values: int numbers
Lets say I have the following array in JavaScript: var skins = new Array('Light',
Lets say I have an array of length n and I want to pick

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.