Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » MT and variables simple question
Re: MT and variables simple question [message #43254 is a reply to message #43241] Mon, 16 June 2014 17:45 Go to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
ManfredHerr wrote on Thu, 12 June 2014 21:44
OK!
This is another example of the experience that in IT you cannot trust to what you learned some years ago. I always considered a machine instruction, i.e. an OP-Code to be executed completely, or not at all. Even if some micro software is involved. The possibility of interrupting within an instruction is new to me. However, I wonder what value is kept in the Program Counter for return from interrupt then.

I am sorry to have caused fuss. In the future, I will keep my two cents with me.


It is not that much (in fact, not at all) about interrupting, it is more about the fact that CPU execution core is not executing opcodes as they are. Instead, everything is broken into smaller operations and executed out-of-order. So it is entirely possible that the "store" part of x++ is executed many cycles after the "load" part and a flow of other instructions or theirs parts is executed within that time.

Within single thread, these out-of-order issues are invisible to programmer, because in single thread CPU guarantees memory consistency, but with more CPU cores, the real hell begins Smile

BTW, not much mentioned effect of every mutex implementation is that it takes care about read/write ordering too, doing memory barriers as necessarry...
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [SOLVED] Fix some memory leak in IpAddrInfo
Next Topic: [SOLVED][FeatureRequests]Use HttpRequest to upload large file
Goto Forum:
  


Current Time: Wed May 15 01:43:43 CEST 2024

Total time taken to generate the page: 0.02905 seconds