computer architecture – Query Regarding Direct cache mapping

Thank you for looking into this, I have a problem regarding direct cache mapping, My problem really though is with the question formation itself and the problem I am about to present seems to have inconsistency and has unclear description. So the problem is as follows ( I am presenting exactly as given )

32 bit architecture
Main memory size = 8GB
cache size = 512KB
Block size = 32 words

To Find

  1. Number of bits required for Byte Offset = ?
  2. Number of bits required for main memory address = ?
  3. Number of bits required for main memory block number = ?
  4. Cache Index bits = ?
  5. Tag-bits = ?
  6. Size of Tag Directory = ?

Now My Interpretation of the solution is as follows

As it is 32 bit architecture which means Word size is 4 Byte ( I am confused about this part the most as the question states cache block size in Words but expects to calculate Byte offset ) but for the sake of this problem, moving on main memory size is 8GB that’s 233Bytes, cache size ( blocks only, this does not include tag directory which is part of cache controller ) Block size of 32 Words or 128 Bytes, now If you agree with me on this much, or else this is probably where I am wrong so please correct me right here. Now assuming I am correct so far, I will first calculate main memory address bits, that will be, first let’s calculate it’s size then let’s do binary log, that will be 233Bytes / 4 Bytes per word this comes out to be 231 Words means 31 bits for memory address and our second answer, next I calculate number of main memory blocks that will be 233Bytes / 128 Bytes per block this comes out to be 226 Blocks of main memory so the number of bits required for main memory block number would be 26 bits, so this gives our third answer, moving forward as I assume a single cache/main memory block to be of 128 Bytes and not Words. So for byte offset within a block it must be 7 bits ( Point of highest concern ) and this should be our first answer according to the question. Now let’s calculate number of cache blocks that will be 219Bytes / 128 Bytes per block which is 212 Blocks so cache index size will be 12 bits which is our fourth answer, we’re almost done ! Now Tag bits should be and since it’s direct mapped it should be memory address size – ( cache index + Word or Byte offset ) that is ( 31 – (12 + 7)) = 12 bits that is our fifth answer and finally size of cache directory will be 212Cache Blocks * 12bits per tag, Now not going into exact answer in KB’s is this approach right or have I made a mistake or is the problem formulation incorrect ( as I think the mistake must be with cache blocks being in bytes or words ) ?

8 – How to cache a custom rest resource when using Url::fromUri

I have a custom rest resource that is returning data using new ResourceResponse():

$node = Node::load($nid);
$data = load_data('node', $node);
$response = new ResourceResponse($data);
$response->addCacheableDependency($node);
return $response;

This works fine, but if I use the function Url::fromUri into the load_data function I get the error:

LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early.

I can get it to work if I use ModifiedResourceResponse instead of ResourceResponse, but as far as I understand this will disable all caching. As this resource might end up getting intensive I want to make sure it is cached – how can I do this?

Many thanks in advance!

Seeding Microservice data cache or materialised view

In dealing with distributed data across Microservices common solutions I’ve read for sharing this data are

a] using a local cache where the cache is updated from domain events coming from the service that owns that data,

b] creating a materialized view, updating via domain events or database triggers.

Say we have services for Orders and Customers and we introduce a new Coupons service that needs to initialize all Customers with a Coupon based on their Sales data. How does this new service get all the existing Sales and Customer data when it’s first launched? Is it standard to seed the cache or materialized view with some data loading script first before switching to event or triggers based updates after that?

Seeding microservices data cache or materialised view

In dealing with distributed data across microservices common solutions I’ve read for sharing this data are a] using a local cache where the cache is updated from domain events coming from the service that owns that data, b] creating a materialised view, updating via domain events or database triggers.

Say we have services for Orders and Customers and we introduce a new Coupons service that needs to initialise all Customers with a Coupon based on their Sales data. How does this new service get all the existing Sales and Customer data when it’s first launched? Is it standard to seed the cache or materialised view with some data loading script first before switching to event or triggers based updates after that?

When use node_view cache tag?

When should we use the cache tag node_view? I guess it is a core cache tag? When does it get invalidated?

$build['#cache'] = ['tags' => [
    'node_view',
    // ...
]];

How to disable disk cache of NVMe SSD

I know hdparm -W0 /dev/sata-ssd can disable disk cache for SATA SSD, but this does not work on my NVMe SSD (i.e., Samsung 980 pro). Maybe some option of nvme can do it, but I failed to find it.

How can I make this?

Thanks.

8 – What are my options for a url based cache tag?

I have a controller that serves a path, /get-messages, which requires a query argument, path. An example request to this path will look like /get-messages?path=/about/team.

I have a content type, Message. Each message has a textarea field that allows the editor to enter paths that the message should appear on. Example content:

/about/team
/about/*

With javascript, on page load, I make a request to my controller, e.g. /get-messages?path=/the/current/path, to get all messages that should be displayed on the current page.

This all works fine and is no problem. The issue I’m having is with how to cache my responses correctly.

With core’s default caching options, I might setup a cache render array like:

(
  'keys' => ('my_module_get_messages'),
  'contexts' => ('url.query_args'), // or `url.query_args:path`
  'max-age' = Cache::PERMANENT,
)

I can even add any message entities as cache dependencies to make sure their cache tags get added and the cache is broken if they’re edited. This also works fine.

The issue I’m having is if someone adds a new message that should display on a path that’s already cached, by default, creating the new entity won’t clear the cache for any already existing cache entries.

I think I need a cache tag based on my url. Is there an existing cache tag I can use, or do I need to create/manage my own custom tags (as described in Implementing Custom Cache Tags)? Or an alternative caching approach?

web applications – Is it possible to cache a full website and load it offline from memory next time visiting it

If I went into, say, facebook, it would take a few seconds to load depending on the internet connection speed.

If I were to cache everything (js, css, html) onto my laptop, and next time I open facebook, would it work if I were to load everything from cached, and then diff the newly loaded data and replace the outdated places? Of course it would be a problem if apis have changed, and then I’d have to wait for the new code, but other than that would it be possible for most applications? (google docs, asana, figma, any other application that is pretty much the same every time you open it)

Example use-case: I’d like to build a plugin that just caches every “every day use” websites and see if i can decrease load time

How to manually Cache SQL queries?

Recently, we began me and my friend to rollout from CMS into custom website. Now[URL="https:… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1835208&goto=newpost

Cache on micro sd – Android Enthusiasts Stack Exchange

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange