![]() ![]() ![]() However, from the compiler's perspective any code that runs when a thread is asynchronously interrupted happens in different thread of execution even if that code runs in the same OS thread. When you're writing a program in C or some other higher level language it may appear that certain operations are atomic and sequentially ordered, but the compiler only generally guarantees this when viewed from the same thread that performed those operations. A weak memory ordering provides no guarantees about how accesses appear to other threads. A strong but not sequentially consistent ordering might guarantee many sorts of operations are ordered with respect to each other, but not all. Other more limited guarantees of memory ordering are possible. This guarantee always applies then when the observer is the same thread as performed the operations. Memory accesses are only sequentially consistent if they appear to an observer as happening in the order they occur in the program. A system with two CPU sockets, each populated with a quad-core CPU with two logical processors per core would have a total of 16 processors.)Ī related but different concept is memory ordering. (Note that by processor I mean what Intel's documentation would call a logical processor. Observers that can't see the effect of the operation, whether the same thread, a different thread, or a device, don't affect whether the operation is atomic or not. That observer can be anything that can see the effect of the operation, whether its the thread does the operation, a different thread on the same processor a thread on different processor, or some component or device in the system. For an operation to be atomic it must appear to be one undivided operation to any observer. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |