Groups | Search | Server Info | Keyboard shortcuts | Login | Register
| Message-ID | <fd4c387d-cf37-4702-8452-6c4bcadf9a14@googlegroups.com> (permalink) |
|---|---|
| Newsgroups | comp.std.c++ |
| From | via.usov@googlemail.com |
| Subject | Re: Refreshing cpu cache before atomic relaxed loads |
| Organization | unknown |
| References | <f2af6f2a-c936-41c5-9461-9b0d89299993@googlegroups.com> |
| Date | 2015-06-25 14:32 -0600 |
On Monday, 22 June 2015 21:30:04 UTC+2, itaj sherman wrote: > My question turned up while implementing spin-wait > when a thread needs to wait for another thread to complete a short work, > so short that locking/releasing a mutex might take longer than the work. > The problem the way I see it is the standard does not explicitly define a > clear way to refresh the cpu cache before re-loading an atomic variable. The standard does not deal with CPU caches, or even CPUs for that matter. The standard specifies an abstract machine, whose observable behaviour every conforming implementation must emulate with respect to a well-formed C++ program given to it. CPUs and caches are a detail internal to the implementation; your C++ program cannot deal with that in a standard-conforming, implementation-independent way. So the part of your question regarding refreshing the cache is meaningless for this group. With respect to "speed", the question is not very well formed. The speed of what? Of every single iteration of the while loop? Is that even important? Or the speed of the entire spin_wait_flag execution? Under what conditions? Unless your formulate your speed measurement methodology, your question cannot be answered. And if you do formulate your methodology, then you do not need this group to answer your question, because you can use your methodology to measure the speed, whatever it is. -- [ comp.std.c++ is moderated. To submit articles, try posting with your ] [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Next in thread | Find similar
Refreshing cpu cache before atomic relaxed loads itaj sherman <itajsherman@googlemail.com> - 2015-06-22 14:22 -0600 Re: Refreshing cpu cache before atomic relaxed loads via.usov@googlemail.com - 2015-06-25 14:32 -0600 Re: Refreshing cpu cache before atomic relaxed loads itaj sherman <itajsherman@googlemail.com> - 2015-06-26 01:29 -0600
csiph-web